Matlab 写入TIFF显示为黑色,但imagesc不显示

Matlab 写入TIFF显示为黑色,但imagesc不显示,matlab,casting,tiff,Matlab,Casting,Tiff,在将tiff读入MATLAB之后,我想再次编写一个tiff。tiff文件由其他一些软件生成: [flnm,locn]=uigetfile({'*.tif','Image files'}, 'Select an image'); fp=fullfile(locn,flnm); I = double(imread(fp)); info = imfinfo(fp); . . . J2 = im2int16(J2); J2(:,:) =

在将tiff读入MATLAB之后,我想再次编写一个tiff。tiff文件由其他一些软件生成:

[flnm,locn]=uigetfile({'*.tif','Image files'}, 'Select an image');       
fp=fullfile(locn,flnm);        
I = double(imread(fp));    
info = imfinfo(fp);



.   
.
.

J2 = im2int16(J2);       
J2(:,:) = uint16((J2(:,:)./max(max(J2(:,:),[],1)))*65536);       

T = Tiff((fullfile(strcat(locn,v_f), (sprintf('%d.tif',i)))), 'w');        

tagstruct.ImageLength = size(J2, 1);         
tagstruct.ImageWidth = size(J2, 2);        
tagstruct.Compression = Tiff.Compression.None;        
tagstruct.SampleFormat = Tiff.SampleFormat.Int;         
tagstruct.Photometric = Tiff.Photometric.MinIsBlack;         
tagstruct.BitsPerSample = info.BitsPerSample; % 32;         
tagstruct.SamplesPerPixel = info.SamplesPerPixel; % 1;         
tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;         
T.setTag(tagstruct);         
T.write(J2);         
T.close();         
此线用于重新缩放强度范围:

J2(:,:) = uint16((J2(:,:)./max(max(J2(:,:),[],1)))*65536);  
是从这里借来的:。但我的照片仍然是黑色的。这种情况不应该发生,因为对于imagesc,虽然信号非常嘈杂,但输出到屏幕上的数据是有意义的,但我写入文件的TIFF是非常无用的

图像参数:

Filename: [1x172 char]
                  FileModDate: '24-Jan-2014 14:39:09'
                     FileSize: 32003
                       Format: 'tif'
                FormatVersion: []
                        Width: 125
                       Height: 125
                     BitDepth: 16
                    ColorType: 'grayscale'
              FormatSignature: [73 73 42 0]
                    ByteOrder: 'little-endian'
               NewSubFileType: 0
                BitsPerSample: 16
                  Compression: 'Uncompressed'
    PhotometricInterpretation: 'BlackIsZero'
                 StripOffsets: [8 2008 4008 6008 8008 10008 12008 14008 16008 18008 20008 22008 24008 26008 28008 30008]
              SamplesPerPixel: 1
                 RowsPerStrip: 8
              StripByteCounts: [2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 1250]
                  XResolution: 72
                  YResolution: 72
               ResolutionUnit: 'Inch'
                     Colormap: []
          PlanarConfiguration: 'Chunky'
                    TileWidth: []
                   TileLength: []
                  TileOffsets: []
               TileByteCounts: []
                  Orientation: 1
                    FillOrder: 1
             GrayResponseUnit: 0.0100
               MaxSampleValue: 65535
               MinSampleValue: 0
                 Thresholding: 1
                       Offset: 31768
             ImageDescription: '
从tiff信息:

TIFF File: '000001.tif'
                       Mode: 'r'
    Current Image Directory: 1
           Number Of Strips: 16
                SubFileType: Tiff.SubFileType.Default
                Photometric: Tiff.Photometric.MinIsBlack
                ImageLength: 125
                 ImageWidth: 125
               RowsPerStrip: 8
              BitsPerSample: 16
                Compression: Tiff.Compression.None
               SampleFormat: Tiff.SampleFormat.UInt
            SamplesPerPixel: 1
        PlanarConfiguration: Tiff.PlanarConfiguration.Chunky
           ImageDescription: 

This is frame #0000           
                Orientation: Tiff.Orientation.TopLeft

谢谢

我在
BitsPerSample
行中看到注释
%32
,但您使用的是
uint16
。输入图像上的规格是什么?为什么使用
im2int16
而不是
im2uint16
?顺便说一下,
(:,:)
对于灰度图像来说是多余的。