[ITK] BinaryImageToShapeLabelMapFilter and vtk

Michael Meuli michael.meuli at gmail.com
Mon Jul 14 16:48:41 EDT 2014


Thanks. But than it would be nice if I could set the value of a new
attribute to the ShapeLabelObject. I found AttributeLabelObject which could
work but that's not what I get from BinaryImageToShapeLabelMapFilter...
Might make more sense to just compute the new image myself?

Best regards
Michael
 Am 10.07.2014 13:56 schrieb "Bradley Lowekamp" <blowekamp at mail.nih.gov>:

> Hello,
>
> I think the itkLabelImageToAttributeImageFilter is what you are looking
> for.
>
> If you look at the test you can see how to use it:
>
> https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/LabelMap/test/itkLabelMapToAttributeImageFilterTest1.cxx
>
> Brad
>
> On Jul 10, 2014, at 5:54 AM, Michael Meuli <michael.meuli at gmail.com>
> wrote:
>
> > Hi,
> > I am using itk::BinaryImageToShapeLabelMapFilter<itk::Image< unsigned
> char, 3 >>
> > For each object I get I'm calculating some mean value (below you can
> > see the relevant piece of code).
> > I would like to display these objects (bacteria) and color them
> > depending on that mean value in ParaView.
> > So I would like to write a freshly composed vtk file.
> > (In the end I have to count how many bacteria I have and how many of
> > them are digested within lysosomes.)
> >
> > What would be the best way to do this? Could someone point be to some
> > more reading/examples?
> >
> > Thanks a lot in advance,
> > best regards
> > Michael
> >
> >
> > BinaryImageToShapeLabelMapFilterType::Pointer
> > binaryImageToShapeLabelMapFilter =
> > BinaryImageToShapeLabelMapFilterType::New();
> > binaryImageToShapeLabelMapFilter->SetInput(binaryimage3Dbacteria);
> > binaryImageToShapeLabelMapFilter->Update();
> > unsigned int bacteriacount =
> > binaryImageToShapeLabelMapFilter->GetOutput()->GetNumberOfLabelObjects();
> > unsigned int colcount = 0;
> > for(unsigned int i = 0; i <
> > binaryImageToShapeLabelMapFilter->GetOutput()->GetNumberOfLabelObjects();
> > i++) {
> >   BinaryImageToShapeLabelMapFilterType::OutputImageType::LabelObjectType*
> > labelObject =
> binaryImageToShapeLabelMapFilter->GetOutput()->GetNthLabelObject(i);
> >   unsigned long long  pixelValue = 0;  //ImageType3D::PixelType
> > (16bit) was too short
> >   for(unsigned int pixelId = 0; pixelId < labelObject->Size();
> pixelId++) {
> >     pixelValue += image3Dred->GetPixel( labelObject->GetIndex(pixelId) );
> >     }
> >   unsigned int mean = pixelValue / (labelObject->Size());
> >   std::cout << "Mean value in lysosomechannel of object " << i << ":
> > " << mean << std::endl;
> >   if ( mean > 100 ) {
> >     colcount++;
> >     }
> >   std::cout << std::endl;
> >   }
> > std::cout << "Total bacteria counted: " << bacteriacount << std::endl;
> > std::cout << "Bacteria colocalizing in lysosomechannel: " <<
> > colcount << std::endl;
> > _______________________________________________
> > Community mailing list
> > Community at itk.org
> > http://public.kitware.com/mailman/listinfo/community
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140714/2c0a0a0d/attachment-0002.html>


More information about the Community mailing list