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

Jon Haitz Legarreta jhlegarreta at vicomtech.org
Wed Feb 26 09:41:33 EST 2014


Dear Annabelle,
I guess the CastImageFilter [1] may do that job.

HTH,
JON HAITZ

[1] http://www.itk.org/Doxygen/html/classitk_1_1CastImageFilter.html


On 26 February 2014 10:53, Annabelle Dupuis <dupuis.annabelle at yahoo.fr>wrote:

> 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
> >
>
>
>
> _______________________________________________
> 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/f04dc546/attachment-0002.html>


More information about the Community mailing list