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

Matt McCormick matt.mccormick at kitware.com
Tue Feb 25 19:17:24 EST 2014


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
>



More information about the Community mailing list