[ITK] LabelMap

Michael Meuli michael.meuli at gmail.com
Tue Nov 11 03:23:15 EST 2014


Hi all,

I have an assert in my program which works fine with most of my images
but now failed on one of them.
Shouldn't the assert in the following piece of code always be true?

    typedef itk::Image< unsigned short, 3 > ImageType3D;
    ImageType3D::Pointer image3Dred = extractchannel(image5D, lysosomechannel);
    typedef itk::Image< unsigned char, 3 >   BinaryImageType3D;
    typedef itk::BinaryImageToShapeLabelMapFilter<BinaryImageType3D>
BinaryImageToShapeLabelMapFilterType;
    typedef itk::LabelMapToLabelImageFilter<BinaryImageToShapeLabelMapFilterType::OutputImageType,
BinaryImageType3D> LabelMapToLabelImageFilterType;
    LabelMapToLabelImageFilterType::Pointer labelMapToLabelImageFilter
= LabelMapToLabelImageFilterType::New();
    labelMapToLabelImageFilter->SetInput(binaryImageToShapeLabelMapFilter->GetOutput());
    typedef itk::LabelImageToStatisticsLabelMapFilter<
BinaryImageType3D, ImageType3D >
LabelImageToStatisticsLabelMapFilterType;
    LabelImageToStatisticsLabelMapFilterType::Pointer
labelImageToStatisticsLabelMapFilter =
LabelImageToStatisticsLabelMapFilterType::New();
    labelImageToStatisticsLabelMapFilter->SetFeatureImage(image3Dred);
    labelImageToStatisticsLabelMapFilter->SetInput(labelMapToLabelImageFilter->GetOutput());
    labelImageToStatisticsLabelMapFilter->Update();
    assert (binaryImageToShapeLabelMapFilter->GetOutput()->GetNumberOfLabelObjects()
==

labelImageToStatisticsLabelMapFilter->GetOutput()->GetNumberOfLabelObjects());

Best regards and many thanks
Michael Meuli


More information about the Community mailing list