首页 文章

Matlab只打开多页tiff堆栈的第一帧

提问于
浏览
2

我在ImageJ中用宏创建了多页tiff文件,我现在正尝试使用matlab打开它,但我只能访问第一帧 .

这是imfinfo(文件名)的结果 . 因此,我明白了

length(imfinfo(filename)) = 1

Filename: [1x129 char]
              FileModDate: '28-nov-2013 12:27:51'
                 FileSize: 6.7905e+09
                   Format: 'tif'
            FormatVersion: []
                    Width: 512
                   Height: 512
                 BitDepth: 8
                ColorType: 'grayscale'
          FormatSignature: [77 77 0 42]
                ByteOrder: 'big-endian'
           NewSubFileType: 0
            BitsPerSample: 8
              Compression: 'Uncompressed'
PhotometricInterpretation: 'BlackIsZero'
             StripOffsets: 932625
          SamplesPerPixel: 1
             RowsPerStrip: 512
          StripByteCounts: 262144
              XResolution: []
              YResolution: []
           ResolutionUnit: 'None'
                 Colormap: []
      PlanarConfiguration: 'Chunky'
                TileWidth: []
               TileLength: []
              TileOffsets: []
           TileByteCounts: []
              Orientation: 1
                FillOrder: 1
         GrayResponseUnit: 0.0100
           MaxSampleValue: 255
           MinSampleValue: 0
             Thresholding: 1
                   Offset: 8
         ImageDescription: 'ImageJ=1.47q
 images=25900
 slices=25900
 loop=false

但是,如果我在ImageJ中打开相同的tif文件,那么我可以读取并滚动浏览25900帧......奇怪的是,matlab可以读取我在imageJ中创建的前一个多页tiff而没有我的批处理宏...

我不明白发生了什么......任何帮助都将不胜感激!谢谢,史蒂文

2 回答

  • 1

    您必须遍历堆栈中的所有图像:

    fname = 'my_file_with_lots_of_images.tif';
    info = imfinfo(fname);
    imageStack = [];
    numberOfImages = length(info);
    for k = 1:numberOfImages
        currentImage = imread(fname, k, 'Info', info);
        imageStack(:,:,k) = currentImage;
    end
    
  • 1

    这实际上是 ImageJ 的错 . 对于大型TIFF, ImageJ 而不是使用 BigTiff 标准来保存堆栈,而是使用包含第一帧的假TIFF标头保存原始文件,并愉快地将其命名为 .tif . 您可以与 ImageJ 开发人员讨论为什么他们认为这是一个好主意 .

    要将这些堆栈读入Matlab,您可以使用 memmapfileMappedTensor .

相关问题