[Insight-users] ConnectedThresholdImageFilter Seed Problems

Bradley Lowekamp blowekamp at mail.nih.gov
Wed Jan 30 18:52:29 EST 2013


Scott,

Well if you are confident that you code is correct and don't need to debug it, then hopefully you can create a small test case to reproduce the error.

I'd also suggest running basic binary thresholding followed by connected components that should label the object you are trying to get as the same id, and not be dependent on a seed. It may help to figure out what is going on with your image.

Brad

On Jan 30, 2013, at 4:25 PM, Scott Johnson <Scott.Johnson at neuwave.com> wrote:

> Thanks for the reply Brad.
>  
> I’ve been examining the input data, by exporting it and loading into Paraview or 3DSlicer, to see if I could find anything unusual, but haven’t found it yet.  I’ll make sure I handing the appropriate pointers to the appropriate inputs/outputs.
>  
> Thanks
>  
>                                 -- Scott
>  
> From: Bradley Lowekamp [mailto:blowekamp at mail.nih.gov] 
> Sent: Wednesday, January 30, 2013 3:10 PM
> To: Scott Johnson
> Cc: itk (Insight-users at itk.org)
> Subject: Re: [Insight-users] ConnectedThresholdImageFilter Seed Problems
>  
> Hello Scott,
>  
> Nothing stuck out in you code as wrong to me. I don't think there is an issue with the code snippet you attached it's likely some place else.
>  
> I am suspicious that some how the image pointers or image buffers got mixed up. In ether an un-intended direct assignment or some filter that ran "InPlace". I add some debug print statements to you code to look at the pointers and buffers of your images.
>  
> If that doesn't narrow it down, and you think the problem is in ITK. Then I'd work on creating a minimal program which can reproduce your problem.
>  
> Brad
>  
> On Jan 30, 2013, at 4:00 PM, Scott Johnson <Scott.Johnson at neuwave.com> wrote:
> 
> 
> Anybody?  Any ideas as to how I might debug this problem?
>  
> Thanks
>  
>                                 -- Scott
>  
> From: insight-users-bounces at itk.org [mailto:insight-users-bounces at itk.org] On Behalf Of Scott Johnson
> Sent: Tuesday, January 29, 2013 2:01 PM
> To: itk (Insight-users at itk.org)
> Subject: [Insight-users] ConnectedThresholdImageFilter Seed Problems
>  
> 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
>  
> _____________________________________
> 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:
> http://www.itk.org/mailman/listinfo/insight-users
>  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130130/32db8212/attachment.htm>


More information about the Insight-users mailing list