[Insight-users] how to take into account of pixel size in saving image

Luis Ibanez luis.ibanez at kitware.com
Thu Dec 1 10:23:02 EST 2005


Hi Isabelle,



          You are using JPEG as file format.



       Please don't use JPEG for Medical Images.



               It is not good for you,
        and it is not good for the patients




JPEG was designed for compressing images of natural scenes,
such as birthday parties, the picture of a horse, the picture
of a dog sleeping in a backyard, landscape pictures or the photo
of a clown with a pointy hat. The compression dictionary used by
JPEG was fine tunned for the spatial frequencies that appear
commonly in natural scenes. It was not designed for CT scans,
or MRI images, or UltraSounds.



          http://www.faqs.org/faqs/jpeg-faq/part1/

Quote:

> JPEG is designed for compressing either full-color or gray-scale images
> of natural, real-world scenes.  It works well on photographs, naturalistic
> artwork, and similar material; not so well on lettering, simple cartoons,
> or line drawings.  




If you want to manage medical images in a safely way
(and I'm sure you do want to manage them in a safe way)
you should use image file format that are intended for
medical images.


Among the many good choices that you have with ITK,
you could consider the following:

     1) Analyze
     2) MetaImages
     3) GIPL
     4) DICOM


When viewing those images, please use also viewers that
are designed for medical images. Such viewers should take
into account the pixel size of the image.


You could consider the following options:

     1) ImageViewer (in InsightApplications)
     2) Slicer    www.slicer.org
     3) ParaView  www.paraview.org
     4) VolView   www.volview.com


Don't use viewers such as Paint in Windows, or the FaxViewer
(which of course is only intended for Faxes, not for CT scans),
don't use either ImageMagick display. Those naive viewers are
not intended for medical application. They will display images
up-side-down, and will not take into account any pixel size.


Please reserve JPEG for the pictures of family reunions
and vacation trips.



   Regards,



     Luis




-----------------------
Renaud Isabelle wrote:
> Hi,
>  
> I have to save an image of 55*239 pixels with spacing as 0.1496*0.01925.
>  
> This seems to be easy. However, the image saved is not taking into 
> account my pixel size but just the number of my pixels.
>  
> */ImageType::IndexType start;/*
> */start.Fill(0); /*
> *//* 
> */ImageType::SizeType sz;/*
> */sz[0] = 239; /*
> */sz[1] = 55;/*
> *//* 
> */ImageType::RegionType region;/*
> */region.SetSize( sz );/*
> */region.SetIndex( start );/*
> *//* 
> */ImageType::Po! inter shifty = ImageType::New();/*
> */shifty->SetRegions( region );/*
> */shifty->Allocate();/*
> *//* 
> */ImageType::SpacingType spacing ; /*
> */spacing[0] = 0.01925; /*
> */spacing[1] = 0.1496;/*
> */shifty->SetSpacing( spacing );/*
> *//* 
> *///compute shifty somehow/*
> *//* 
> */typedef itk::RescaleIntensityImageFilter</*
> */ImageType, WriteImageType > RescaleFilterType;/*
> *//* 
> */RescaleFilterType::Pointer rescaler = RescaleFilterType::New();/*
> */rescaler->SetOutputMinimum( 0 );/*
> */rescaler->SetOutputMaximum( 255 );/*
> */rescaler->SetInput( shifty );/*
> *//* 
> */typedef itk::ImageFileWriter< WriteImageType > WriterType;/*
> */WriterType::Pointer writer = WriterType::New();/*
> */writer->SetFileName("shifty.jpg");/*
> */writer->SetInput( rescaler->GetOutput() );/*
> */writer->Update();/*
> *//* 
> By taking into account the pixel size, the saved image should be almost 
> twice heigher than large. However, taking into account only the number 
> of pixels, my saved image is 4 times larger than heigh.
>  
> This is a medical image so my ! pixel size is very important to be aware 
> of the physical dimensions of the image.
>  
> Isabelle
>  
> 
> ------------------------------------------------------------------------
> *Appel audio GRATUIT partout dans le monde* avec le nouveau Yahoo! Messenger
> Téléchargez le ici ! 
> <http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.messenger.yahoo.com> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users



More information about the Insight-users mailing list