[ITK] [ITK-users] Binary Contour with outliers

Becksfort, Jared Jared.Becksfort at STJUDE.ORG
Thu Jan 25 18:56:15 EST 2018


Hello,

I am having some difficulty overlaying boolean masks onto Nifti images. The code below is basically what is shown here (which does work for me when I use the images on the page):. https://itk.org/ITKExamples/src/Filtering/ImageFusion/OverlayLabelMapOnTopOfAnImage/Documentation.html

The differences that I can see are that I am using 3 dimensions and Nifti float input rather than 2D images of the same pixel and file types (8-bit PNG) in the example.

Can someone please tell me what I have done wrong?  The output image is garbled beyond recognition.

Thanks,
Jared

const unsigned int Dimension = 3;

typedef float PixelType;
typedef unsigned char LabelType;

typedef itk::Image< PixelType, Dimension > ImageVolumeType;
typedef itk::Image< LabelType, Dimension > ContourVolumeType;

typedef itk::ImageFileReader<ContourVolumeType> ContourReaderType;
typedef itk::ImageFileReader< ImageVolumeType >  ReaderType;

ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( infile1 );

ContourReaderType::Pointer labelReader = ContourReaderType::New();
labelReader->SetFileName(infile2);

typedef itk::LabelObject< LabelType, Dimension > LabelObjectType;
typedef itk::LabelMap< LabelObjectType > LabelMapType;

typedef itk::LabelImageToLabelMapFilter< ContourVolumeType, LabelMapType > ConverterType;
ConverterType::Pointer converter = ConverterType::New();
converter->SetInput( labelReader->GetOutput() );

typedef itk::LabelMapOverlayImageFilter< LabelMapType, ImageVolumeType > FilterType;
FilterType::Pointer filter = FilterType::New();
filter->SetInput( converter->GetOutput() );
filter->SetFeatureImage( reader->GetOutput() );
filter->SetOpacity(0.5);


typedef itk::ImageFileWriter< FilterType::OutputImageType > WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetFileName(outfile);
writer->SetInput( filter->GetOutput() );
writer->Update();

On 1/23/18, 4:19 PM, "Insight-users on behalf of Matt McCormick" <insight-users-bounces at itk.org on behalf of matt.mccormick at kitware.com> wrote:

    Hi,

    By running OpeningByReconstructionImageFilter:

      https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fitk.org%2FDoxygen%2Fhtml%2Fclassitk_1_1OpeningByReconstructionImageFilter.html&data=01%7C01%7Cjared.becksfort%40stjude.org%7Ce86b42bd4f52460a362708d562af538f%7C22340fa892264871b677d3b3e377af72%7C0&sdata=qbR%2BtUIsnrSfh01yNV9w94GGa%2FdEA7uXrisa%2BpVyJ0k%3D&reserved=0

    before the binary contour, the smaller objects can be removed.

    HTH,
    Matt

    On Tue, Jan 23, 2018 at 5:06 PM, Abdelkhalek Bakkari
    <bakkari.abdelkhalek at hotmail.fr> wrote:
    > Hi !
    >
    > I applied the binary contour filter slice by slice to my binary mask. But
    > the result for the Axial plane is not satisfied at all since it contains
    > some outliers.
    > Please, find attached my binary contour result.
    > Is there any method to remove the outliers from the contour ?
    >
    > Thank you in advance.
    >
    > The ITK community is transitioning from this mailing list to
    > discourse.itk.org. Please join us there!
    > ________________________________
    > Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=01%7C01%7Cjared.becksfort%40stjude.org%7Ce86b42bd4f52460a362708d562af538f%7C22340fa892264871b677d3b3e377af72%7C0&sdata=wGgpmJ1V9kHLAeehfcg2TDwAl2%2B146KjXnNcJwxCUUE%3D&reserved=0
    >
    > Visit other Kitware open-source projects at
    > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=01%7C01%7Cjared.becksfort%40stjude.org%7Ce86b42bd4f52460a362708d562af538f%7C22340fa892264871b677d3b3e377af72%7C0&sdata=NV76hUF0Y4voqN%2BMyiz9V5VES8ByVlx6u8soSOw%2FUG0%3D&reserved=0
    >
    > Kitware offers ITK Training Courses, for more information visit:
    > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fproducts%2Fprotraining.php&data=01%7C01%7Cjared.becksfort%40stjude.org%7Ce86b42bd4f52460a362708d562af538f%7C22340fa892264871b677d3b3e377af72%7C0&sdata=3ZE7IOXhdYDA7yn8FEmJBbbqsRS22LsDgcLGsCOpMXI%3D&reserved=0
    >
    > Please keep messages on-topic and check the ITK FAQ at:
    > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.itk.org%2FWiki%2FITK_FAQ&data=01%7C01%7Cjared.becksfort%40stjude.org%7Ce86b42bd4f52460a362708d562af538f%7C22340fa892264871b677d3b3e377af72%7C0&sdata=zmDoewconF3K2V%2FHEljYWpZjjkqEM3zMgZomfc5XR6A%3D&reserved=0
    >
    > Follow this link to subscribe/unsubscribe:
    > https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fitk.org%2Fmailman%2Flistinfo%2Finsight-users&data=01%7C01%7Cjared.becksfort%40stjude.org%7Ce86b42bd4f52460a362708d562af538f%7C22340fa892264871b677d3b3e377af72%7C0&sdata=PBR%2BffFfgYSx2PuXw7dHbVf11DqJ9i%2BW%2Fd1GB2qzq40%3D&reserved=0
    >
    The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there!
    ________________________________
    Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=01%7C01%7Cjared.becksfort%40stjude.org%7Ce86b42bd4f52460a362708d562af538f%7C22340fa892264871b677d3b3e377af72%7C0&sdata=wGgpmJ1V9kHLAeehfcg2TDwAl2%2B146KjXnNcJwxCUUE%3D&reserved=0

    Visit other Kitware open-source projects at
    https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=01%7C01%7Cjared.becksfort%40stjude.org%7Ce86b42bd4f52460a362708d562af538f%7C22340fa892264871b677d3b3e377af72%7C0&sdata=NV76hUF0Y4voqN%2BMyiz9V5VES8ByVlx6u8soSOw%2FUG0%3D&reserved=0

    Kitware offers ITK Training Courses, for more information visit:
    https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fproducts%2Fprotraining.php&data=01%7C01%7Cjared.becksfort%40stjude.org%7Ce86b42bd4f52460a362708d562af538f%7C22340fa892264871b677d3b3e377af72%7C0&sdata=3ZE7IOXhdYDA7yn8FEmJBbbqsRS22LsDgcLGsCOpMXI%3D&reserved=0

    Please keep messages on-topic and check the ITK FAQ at:
    https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.itk.org%2FWiki%2FITK_FAQ&data=01%7C01%7Cjared.becksfort%40stjude.org%7Ce86b42bd4f52460a362708d562af538f%7C22340fa892264871b677d3b3e377af72%7C0&sdata=zmDoewconF3K2V%2FHEljYWpZjjkqEM3zMgZomfc5XR6A%3D&reserved=0

    Follow this link to subscribe/unsubscribe:
    https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fitk.org%2Fmailman%2Flistinfo%2Finsight-users&data=01%7C01%7Cjared.becksfort%40stjude.org%7Ce86b42bd4f52460a362708d562af538f%7C22340fa892264871b677d3b3e377af72%7C0&sdata=PBR%2BffFfgYSx2PuXw7dHbVf11DqJ9i%2BW%2Fd1GB2qzq40%3D&reserved=0



________________________________

Email Disclaimer: www.stjude.org/emaildisclaimer
Consultation Disclaimer: www.stjude.org/consultationdisclaimer
The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there!
________________________________
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.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
https://itk.org/mailman/listinfo/insight-users


More information about the Community mailing list