[Insight-users] ConnectedThresholdImageFilter Seed Problems

Scott Johnson Scott.Johnson at neuwave.com
Tue Jan 29 15:01:00 EST 2013


Hello,

I have been attempting to use ConnectedThresholdImageFilter to identify a feature in some images.  I'm  puzzled because it seems that the mask generated by ConnectedThresholdImageFilter works as expected the first time, but then seems to behave almost the same as the ThresholdImageFilter, in subsequent executions.  I have verified that the seed points are still there.  I have also tried to build my instance of ConnectedThresholdImageFilter from scratch each time I want to execute it.  The behavior is the same either way.

I have verified that my seed positions are valid.  I will attach an image with a small cross showing one of the seed positions and the mask generated by ConnectedThresholdImageFilter.  The seed point is within the small blob near the left side of the image, and I have verified that all of the seeds are within that same feature, and the feature is not connected to other parts of the mask.

I am using ITK 4.2 on a Windows 7 64x platform, running under VS 2008.

When I create the ConnectedThresholdImageFilter I set the following attributes of the new instance:
(This code is only partial but should give you an idea of what I'm doing.)

      typedef itk::Image<short, 3> DICOMImageType;
      typedef DICOMImageType::Pointer DICOMImagePointer;
      typedef itk::Image<unsigned char, 3> MaskImageType;
      typedef MaskImageType::Pointer MaskImagePointer;

      typedef itk::ConnectedThresholdImageFilter<DICOMImageType, MaskImageType>
            SeedGrowerType;
      typedef SeedGrowerType::Pointer SeedGrowerPointer;

#define LOW_THRESHOLD  100
#define HIGH_THRESHOLD 4095
#define REPLACE_VALUE  255

      _seedGrower = SeedGrowerType::New();
      // _smoothDiff is the result of convolving an image with
      // a 3x3 kernel and the output image is a short.
      _seedGrower->SetInput(_smoothDiff->GetOutput());
      // The AddSeeds method invokes _seedGrower->AddSeed to add
      // seeds to the instance.
      AddSeeds(debugStream);
      _seedGrower->SetLower(LOW_THRESHOLD);
      _seedGrower->SetUpper(HIGH_THRESHOLD);
      _seedGrower->SetReplaceValue(REPLACE_VALUE);
      _seedGrower->Update();

The mask in the attached image is the result of _seedGrower->GetOutput().  The mask image has a pixel type of unsigned char.

I have tried both FaceConnectivity and FullConnectivity via the SetConnectivity method, but it made no difference.  I have also dumped the output of _smoothDiff and it makes sense.

I need to determine why the ConnectedThresholdImageFilter is not always paying attention to my seed positions.  If it is paying attention to my seed points then the seed growth isn't stopping at the end of the feature.  I'd appreciate any pointers anyone can provide.

Thanks

                                -- Scott

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130129/3f530325/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MaskAndSeed.jpg
Type: image/jpeg
Size: 26782 bytes
Desc: MaskAndSeed.jpg
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130129/3f530325/attachment.jpg>


More information about the Insight-users mailing list