[Insight-users] Converting an image from unsigned char to int

Luis Ibanez luis.ibanez@kitware.com
Tue May 18 21:37:58 EDT 2004


Hi Robert,


Please try the example program in

   Insight/
      Examples/
           IO/
             ImageReadCastWrite.cxx

and modify the lines 70 to 72 from

  typedef float               InputPixelType;
  typedef unsigned char       OutputPixelType;
  const   unsigned int        Dimension = 2;

to

  typedef unsigned char       InputPixelType;
  typedef float               OutputPixelType;
  const   unsigned int        Dimension = 3;


and save the output in MetaImage format.
This will produce a .mhd and a .raw file.

Then use the ImageViewer application for
loading the MetaImage header (the file with
extension .mhd).

You will find the ImageViewer application
under

  InsightApplications/
                ImageViewer


You could also use ParaView from

      http://www.paraview.org

of VolView from

http://www.kitware.com/products/volview.html

all of these viewers will manage float pixel
types.



Regards,



   Thanks,


      Luis


----------------------
Robert Maroon wrote:

> Hi all,
> 
> I am having a problem trying to convert a raw volume
> file from a voxel type of unsigned char to float. 
> 
> I have tried using both
> itk::RescaleIntensityImageFilter and
> itk::CastImageFilter with arguments of
> ImageType(unsigned int, 3) and OutputImageType(float,
> 3) and then viewing the volume in the
> RawImageReaderViewer found in Insight-Applications. 
> 
> But when I open the float volume, the slices look
> weird, almost like it's magnified with a bunch of
> missing data (I just get a cloud of dots in the
> approximate shape of the image but bigger). 
> 
> Any suggestions?
> 
> Thanks!
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! - Internet access at a great low price.
> http://promo.yahoo.com/sbc/
> _______________________________________________
> Insight-users mailing list
> Insight-users@itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 






More information about the Insight-users mailing list