[Insight-users] itkShapeLabelObject sorts object by size

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Wed Aug 11 06:19:40 EDT 2010


Hi Emma,

itk::ShapeLabelObject is only a container class. It does not determine  
by itself which label it should have.
A like itk::BinaryImageToLabelMapFilter is in charge of giving a label  
to the objects, but as said by Richard in a later mail, it should be  
organised in raster order.

Can you tell us which filters you are using? A sample code would be  
nice.

That being said, you can relabel your label object based on any  
arbitrary attribute, like the raster position, with  
itk::AttributeRelabelLabelMapFilter.
All you have to do is to create a custom functor to return the value  
of interest - see itkShapeLabelObjectAccessors.h for some examples.
itk::AttributeRelabelLabelMapFilter didn't made it to the Review  
directory yet though, so you have to get it by hand from http://mima2.jouy.inra.fr/darcs/contrib-itk/binaryAttributeMorphology/

Regards,

Gaëtan


Le 9 août 10 à 19:52, Emma Ryan a écrit :

> Hello Anybody ????
>
>  Please advise.
>
> Thank you,
> Emma
>
>     Hello All,
>
>   I am using itk::ShapeLabelObject and it currently sorts the labels  
> based on
> the size of the object. Probably has an in-built call to
> itk::relablComponentFilter that does that.  Does anyone know how to  
> turn off the
> sorting. I would like the objects to be displayed as they come. Like  
> in Matlab,
> it based on Row and columns position of the object.  Is it possible  
> to do this ?
> If so, please enlighten me as well.
>
> Thank you,
> Emma
>
>
> From: "insight-users-request at itk.org" <insight-users-request at itk.org>
> To: insight-users at itk.org
> Sent: Mon, August 9, 2010 6:02:50 AM
> Subject: Insight-users Digest, Vol 76, Issue 22
>
> Send Insight-users mailing list submissions to
>     insight-users at itk.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>     http://www.itk.org/mailman/listinfo/insight-users
> or, via email, send a message with subject or body 'help' to
>     insight-users-request at itk.org
>
> You can reach the person managing the list at
>     insight-users-owner at itk.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Insight-users digest..."
>
>
> Today's Topics:
>
>   1. itkShapeLabelObject sorts object by size (Emma Ryan)
>   2. Re: Problem with passing images to functions (Sergio Vera)
>   3. What are the differences between    GetLargestPossibleRegion and
>       GetRequestedRegion? (Guang Yang)
>   4. Re: FFTImageFilter (Ming Chao)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sun, 8 Aug 2010 23:20:34 -0700 (PDT)
> From: Emma Ryan <eryanvtk at yahoo.com>
> Subject: [Insight-users] itkShapeLabelObject sorts object by size
> To: insight-users at itk.org
> Message-ID: <186154.78823.qm at web57905.mail.re3.yahoo.com>
> Content-Type: text/plain; charset="us-ascii"
>
> Hello All,
>
>   I am using itk::ShapeLabelObject and it currently sorts the labels  
> based on
> the size of the object. Probably has an in-built call to
> itk::relablComponentFilter that does that.  Does anyone know how to  
> turn off the
> sorting. I would like the objects to be displayed as they come. Like  
> in Matlab,
> it based on Row and columns position of the object.  Is it possible  
> to do this ?
> If so, please enlighten me as well.
>
> Thank you,
> Emma
>
>
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://www.itk.org/pipermail/insight-users/attachments/20100808/52a3507e/attachment-0001.htm 
> >
>
> ------------------------------
>
> Message: 2
> Date: Mon, 9 Aug 2010 10:34:26 +0200
> From: Sergio Vera <sergio.vera at alma3d.com>
> Subject: Re: [Insight-users] Problem with passing images to functions
> To: D?enan Zuki? <dzenanz at gmail.com>
> Cc: insight-users at itk.org, habibbaluwala2010 <habibbaluwala at gmail.com>
> Message-ID:
>     <AANLkTi=n2LpfFBOT4bbSsw3bP9NY8ML5oA0RFv309vSb at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Following advices from Luis Iba?ez in a previous mail of the list,  
> we now
> use the following rules:
>
> const ITKImgType *ImgIn  when images are input to a method and
>
> ITKImgType::Pointer &ImgOut  when the image will be created inside the
> function
>
> regards
>
> 2010/8/6 D?enan Zuki? <dzenanz at gmail.com>
>
> > Use ImageType::Pointer. Here is an example:
> >
> > void calc2DJointHistogram(VisualizingImageType::Pointer x,
> > VisualizingImageType::Pointer y, std::string savefilename)
> > {
> > ...
> > }
> >
> > //calling it
> > VisualizingImageType::Pointer lVis, hVis;
> > ...
> > hVis=hReader->GetOutput();
> > calc2DJointHistogram(lVis, hVis, fnNoExt+"_LH.png");
> >
> > D?enan
> >
> > On Fri, Aug 6, 2010 at 15:32, habibbaluwala2010 <habibbaluwala at gmail.com 
> >wrote:
> >
> >>
> >> Hi Everyone,
> >>                I am a biot confused on how can i pass an image  
> with smart
> >> pointers to an outside function . I basically need this to avoid
> >> reproducing
> >> the code again and again and also to avoid composite filters. It  
> would be
> >> very helpful if you can provide an example which does the job!!!  
> Anyways
> >> looking forward to your replies.
> >> --
> >> View this message in context:
> >> http://old.nabble.com/Problem-with-passing-images-to-functions-tp29356451p29356451.html
> >> Sent from the ITK - Users mailing list archive at Nabble.com.
> >>
> >> _____________________________________
> >> Powered by www.kitware.com
> >>
> >> Visit other Kitware open-source projects at
> >> http://www.kitware.com/opensource/opensource.html
> >>
> >> Kitware offers ITK Training Courses, for more information visit:
> >> http://www.kitware.com/products/protraining.html
> >>
> >> Please keep messages on-topic and check the ITK FAQ at:
> >> http://www.itk.org/Wiki/ITK_FAQ
> >>
> >> Follow this link to subscribe/unsubscribe:
> >> http://www.itk.org/mailman/listinfo/insight-users
> >>
> >
> >
> > _____________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Kitware offers ITK Training Courses, for more information visit:
> > http://www.kitware.com/products/protraining.html
> >
> > Please keep messages on-topic and check the ITK FAQ at:
> > http://www.itk.org/Wiki/ITK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.itk.org/mailman/listinfo/insight-users
> >
> >
>
>
> -- 
> Sergio Vera
>
> Alma IT Systems
> C/ Vilana, 4B, 4? 1?
> 08022 Barcelona
> T. (+34) 932 380 592
> www.alma3d.com
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://www.itk.org/pipermail/insight-users/attachments/20100809/ec530d11/attachment-0001.htm 
> >
>
> ------------------------------
>
> Message: 3
> Date: Mon, 9 Aug 2010 11:00:37 +0100
> From: Guang Yang <samggyy at gmail.com>
> Subject: [Insight-users] What are the differences between
>     GetLargestPossibleRegion and GetRequestedRegion?
> To: insight-users at itk.org
> Message-ID:
>     <AANLkTin7j=x55s2Gau6J1GAfmGjj1K0FwzMSozMEwwH=@mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi there,
>
> I am confusing about using  GetLargestPossibleRegion() and
> GetRequestedRegion(). What are the differences?
>
> GetLargestPossibleRegion() is getting all the pixels in the image.
>
> And GetRequestedRegion() is getting all the none-zero pixels. Is  
> that right?
>
>
> Cheers,
> Aaron
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://www.itk.org/pipermail/insight-users/attachments/20100809/cf971bf2/attachment-0001.htm 
> >
>
> ------------------------------
>
> Message: 4
> Date: Mon, 9 Aug 2010 08:02:43 -0500
> From: Ming Chao <mingchao2005 at gmail.com>
> Subject: Re: [Insight-users] FFTImageFilter
> To: "Yu, Yang" <yang.yu at philips.com>
> Cc: Insight Users <insight-users at itk.org>
> Message-ID:
>     <AANLkTinMK6K-0OzxAn+Mx69_bAu1o+F5jSLGeq_6KV5i at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Thanks very much to you all for looking into my "problem". Actually  
> you guys
> were absolutely correct that there was no "problem" with the sample  
> code. My
> "problem" was created when I tried to write the output real/ 
> imaginary part
> in a binary file. Sorry for the noise.
>
> Ming
>
> On Mon, Aug 9, 2010 at 3:31 AM, Yu, Yang <yang.yu at philips.com> wrote:
>
> >  I copy the code you posted and at least it works fine in my  
> program. I
> > think you should pay much attention on the realFilter part. Did  
> you  Update
> > the realFilter?
> >
> >
> >
> > *From:* insight-users-bounces at itk.org [mailto:
> > insight-users-bounces at itk.org] *On Behalf Of *Ming Chao
> > *Sent:* 2010 Aug 05 7:21 PM
> > *To:* Markus Neuner
> > *Cc:* Insight Users
> > *Subject:* Re: [Insight-users] FFTImageFilter
> >
> >
> >
> > If I changed "WriteImageType" to float/double, the code stopped  
> working b/c
> > jpeg only accepts unsigned char/int.
> >
> > On Thu, Aug 5, 2010 at 3:30 AM, Markus Neuner  
> <neuner.markus at gmx.net>
> > wrote:
> >
> > I just looked at the code in the example and all seems working (at  
> leasts
> > for me).
> > What do you expect as output?
> > Change the "WriteImageType" to float or double and try it again.
> > Open the image with paraview, imagej or any other suited image  
> viewer.
> > It may be useful to take the log of the real and complex images  
> for a
> > better contrast.
> >
> >
> >
> > On 04.08.2010 21:45, Ming Chao wrote:
> >
> > float
> >
> > On Wed, Aug 4, 2010 at 2:38 PM, Markus Neuner  
> <neuner.markus at gmx.net>
> > wrote:
> >
> > What is the pixel type of "ImageType"?
> >
> >
> >
> > On 04.08.2010 21:11, Ming Chao wrote:
> >
> >  I checked the complex image FFT created from the input image was  
> fine.
> > Also I checked the real and imaginary parts in floating point  
> format,
> > respectively. They both are fine. The problem started to happen when
> > rescaling the real/imaginary image into an interger-type image.  
> Here is part
> > of the rescaling code:
> >
> >
> >
> >  typedef unsigned char WritePixelType;
> >
> >  typedef itk::Image< WritePixelType, Dimension > WriteImageType;
> >
> >
> >
> >  typedef itk::RescaleIntensityImageFilter<ImageType,  
> WriteImageType >
> > RescaleFilterType;
> >
> >
> >
> >  RescaleFilterType::Pointer intensityRescaler =  
> RescaleFilterType::New();
> >
> >  intensityRescaler->SetOutputMinimum(  0  );
> >
> >  intensityRescaler->SetOutputMaximum( 255 );
> >
> >
> >
> >  intensityRescaler->SetInput( realFilter->GetOutput() );
> >
> >
> >
> >  typedef itk::ImageFileWriter< WriteImageType > WriterType;
> >
> >  WriterType::Pointer writer = WriterType::New();
> >
> >  writer->SetFileName( argv[2] );
> >
> >  writer->SetInput( intensityRescaler->GetOutput() );
> >
> >
> >
> >  try
> >
> >    {
> >
> > writer->Update();
> >
> >    }
> >
> >  catch( itk::ExceptionObject & excp )
> >
> >    {
> >
> > std::cerr << "Error writing the real image: " << std::endl;
> >
> > std::cerr << excp << std::endl;
> >
> > return EXIT_FAILURE;
> >
> >    }
> >
> >
> >
> >  typedef itk::ImageRegionConstIterator< WriteImageType >
> > ConstIteratorType;
> >
> >  WriteImageType::Pointer RealImage = intensityRescaler->GetOutput();
> >
> >  ConstIteratorType in( RealImage, RealImage->GetRequestedRegion() );
> >
> >
> >
> >  for ( in.GoToBegin(); !in.IsAtEnd(); ++in )
> >
> >  {
> >
> >  std::cout << in.Get() << std::endl;
> >
> >  }
> >
> >
> >
> >
> >
> > From the output I got all zeros....Apparently something wrong with  
> the
> > rescaler. Could anybody take a look? Thanks very much,
> >
> >
> >
> > Ming
> >
> >
> >
> > On Wed, Aug 4, 2010 at 9:35 AM, Ming Chao <mingchao2005 at gmail.com>  
> wrote:
> >
> > I tried to run FFTImageFilter.cxx to do an FFT of an image. The  
> input image
> > is a 512x512, 24 bit thoracic CT image in jpg format. The output  
> of the
> > example cxx code are the real and imaginary parts of FFT of the  
> input image.
> > However, when I look at the two output images, they are just  
> uniformly
> > grey/black, depending on
> >
> >
> >
> >  intensityRescaler->SetOutputMinimum(  0  );
> >
> >  intensityRescaler->SetOutputMaximum( 255 );
> >
> >
> >
> > in the code. What did I do wrong? Many thanks,
> >
> >
> >
> > Ming
> >
> >
> >
> >
> >
> >
> >
> > _____________________________________
> >
> > Powered by www.kitware.com
> >
> >
> >
> > Visit other Kitware open-source projects at
> >
> > http://www.kitware.com/opensource/opensource.html
> >
> >
> >
> > Kitware offers ITK Training Courses, for more information visit:
> >
> > http://www.kitware.com/products/protraining.html
> >
> >
> >
> > Please keep messages on-topic and check the ITK FAQ at:
> >
> > http://www.itk.org/Wiki/ITK_FAQ
> >
> >
> >
> > Follow this link to subscribe/unsubscribe:
> >
> > http://www.itk.org/mailman/listinfo/insight-users
> >
> >
> >
> >
> >
> >
> >
> > ------------------------------
> > The information contained in this message may be confidential and  
> legally
> > protected under applicable law. The message is intended solely for  
> the
> > addressee(s). If you are not the intended recipient, you are  
> hereby notified
> > that any use, forwarding, dissemination, or reproduction of this  
> message is
> > strictly prohibited and may be unlawful. If you are not the intended
> > recipient, please contact the sender by return e-mail and destroy  
> all copies
> > of the original message.
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://www.itk.org/pipermail/insight-users/attachments/20100809/aededffa/attachment.htm 
> >
>
> ------------------------------
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>
> End of Insight-users Digest, Vol 76, Issue 22
> *********************************************
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users

-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr  http://www.itk.org
http://www.mandriva.org  http://www.bepo.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100811/aa70de29/attachment-0001.pgp>


More information about the Insight-users mailing list