[ITK Community] ITK set pixels in a loaded image/Quickview

Annabelle Dupuis dupuis.annabelle at yahoo.fr
Wed Feb 26 04:53:14 EST 2014


Thanks Matt for your awnser but I finally solved it.
However I have another question.

I'm actually doing some segmentation so I started apllying a median filter and a threshold on my image made of 'unsigned short'.
The probleme now is that when I want to apply th morphological filters nothing happens unless If I use an 'unsigned char' image data from the begining wich mess up all the threshold filter.

Is there any way to convert an unsigned short image data to an unsigned char?

Thank you guys





Le Mercredi 26 février 2014 1h17, Matt McCormick <matt.mccormick at kitware.com> a écrit :
 
Hi Anna,

What is the complete code?

Thanks,
Matt


On Tue, Feb 25, 2014 at 4:55 AM, Annabelle Dupuis
<dupuis.annabelle at yahoo.fr> wrote:
> Hi guys, I'm a newbie in ITK and I would like to make some changes on an
> image
> that I read from a file and then check it on Quickview.
> So I use
> itk::Image<signed short, 2 >                  ImageType;
> itk::ImageFileReader<ImageType>               ReaderType;
> ReaderType::Pointer reader = ReaderType::New();
> reader->SetFileName( inputFilename );
>
> THe probleme is that when I use
>
> ImageType::RegionType region;
>   ImageType::IndexType start;
>   start[0] = 0;
>   start[1] = 0;
>
>   ImageType::SizeType size;
>   size[0] = 200;
>   size[1] = 300;
>
>   region.SetSize(size);
>   region.SetIndex(start);
>
>   ImageType::Pointer reader = ImageType::New();
>   reader->SetRegions(region);
>   reader->Allocate();
>
> for(unsigned int r = 20; r < 80; r++)
>   {
>       for(unsigned int c = 30; c < 100; c++)
>       {
>           ImageType::IndexType pixelIndex;
>           pixelIndex[0] = r;
>           pixelIndex[1] = c;
>
>           reader->SetPixel(pixelIndex, 255);
>       }
>   }
>
> well nothing happen to the loaded image.
> I'm sure I'm missing something basic but I just started coding with this
> tool.
> Thanks for your help.
>
> Anna
>
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/cgi-bin/mailman/listinfo/community
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140226/9e522709/attachment-0002.html>


More information about the Community mailing list