0

I am reading an 'MHD' file which it's giving me info like below:

Filename: 'patient0001_2CH_ED_gt.mhd'
             Format: 'MHA'
     CompressedData: 'false'
         ObjectType: 'image'
 NumberOfDimensions: 3
         BinaryData: 'true'
          ByteOrder: 'false'
    TransformMatrix: [1 0 0 0 1 0 0 0 1]
   CenterOfRotation: [0 0 0]
 AnatomicalOrientation: 'RAI'
             Offset: [0 0 0]
    PixelDimensions: [0.3080 0.1540 1.5400]
         Dimensions: [549 778 1]
ElementNumberOfChannels: '1'
           DataType: 'uchar'
           DataFile: 'patient0001_2CH_ED_gt.raw'
           BitDepth: 8
         HeaderSize: 384

Then by another function, I will read the info, then produce the image. Then, I need to rescale image dimension with pixel dimension ( PixelDimensions: [0.3080 0.1540 1.5400]), and I used imagesc in order to do this like below code, but it changes the unique value of my image.

Is there any way to rescale the image without imagesc? also imagesc produces 3 channels which I don't want, and apparently, all channels are the same.

rows = 1:info.Dimensions(1);
cols = 1:info.Dimensions(2);
Im2 = imagesc(rows.*info.PixelDimensions(1),cols.*info.PixelDimensions(2),Im(:,:)');
saveas(gcf,'Output_filename.png')
Sardar Usama
  • 19,536
  • 9
  • 36
  • 58
AI_NA
  • 336
  • 2
  • 5
  • 20
  • [`imresize`](https://www.mathworks.com/help/images/ref/imresize.html)? – beaker May 16 '19 at 21:59
  • @beaker how can I used imresize to rescale the Im(:,:) to info.PixelDimensions(1), info.PixelDimensions(2)? is there any example? – AI_NA May 16 '19 at 22:01

0 Answers0