[Insight-users] how to take into account of pixel size in saving
image
Renaud Isabelle
renauisa at yahoo.fr
Thu Dec 1 10:14:28 EST 2005
Hi,
I read the chapter about image formats in the software guide. However, it doesn't say what image format are taking into account the pixel size. i tried with BMP,PNG,JPEG, no one is working!!.
ISabelle
Gaetan Lehmann <gaetan.lehmann at jouy.inra.fr> a écrit :
Hi Isabelle,
You should try to resample your image with the resample image filters or use
an image format which store spacing.
There is a chapter about that in the insight software guide.
Regards,
Gaetan
On Wednesday 30 November 2005 23:04, 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::Pointer 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 !
---------------------------------
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Téléchargez le ici !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20051201/a6a0ada8/attachment.html
More information about the Insight-users
mailing list