<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><base href="x-msg://1918/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello Scott,<div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>Brad</div><div><br><div><div>On Jan 30, 2013, at 4:00 PM, Scott Johnson <<a href="mailto:Scott.Johnson@neuwave.com">Scott.Johnson@neuwave.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple" style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="WordSection1" style="page: WordSection1; "><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="color: rgb(31, 73, 125); ">Anybody? Any ideas as to how I might debug this problem?<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="color: rgb(31, 73, 125); "> </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="color: rgb(31, 73, 125); ">Thanks<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="color: rgb(31, 73, 125); "> </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="color: rgb(31, 73, 125); "> -- Scott<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="color: rgb(31, 73, 125); "> </span></div><div><div style="border-style: solid none none; border-top-width: 1pt; border-top-color: rgb(181, 196, 223); padding: 3pt 0in 0in; "><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><b><span style="font-size: 10pt; font-family: Tahoma, sans-serif; ">From:</span></b><span style="font-size: 10pt; font-family: Tahoma, sans-serif; "><span class="Apple-converted-space"> </span><a href="mailto:insight-users-bounces@itk.org" style="color: purple; text-decoration: underline; ">insight-users-bounces@itk.org</a><span class="Apple-converted-space"> </span>[mailto:insight-<a href="mailto:users-bounces@itk.org" style="color: purple; text-decoration: underline; ">users-bounces@itk.org</a>]<span class="Apple-converted-space"> </span><b>On Behalf Of<span class="Apple-converted-space"> </span></b>Scott Johnson<br><b>Sent:</b><span class="Apple-converted-space"> </span>Tuesday, January 29, 2013 2:01 PM<br><b>To:</b><span class="Apple-converted-space"> </span>itk (<a href="mailto:Insight-users@itk.org" style="color: purple; text-decoration: underline; ">Insight-users@itk.org</a>)<br><b>Subject:</b><span class="Apple-converted-space"> </span>[Insight-users] ConnectedThresholdImageFilter Seed Problems<o:p></o:p></span></div></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">Hello,<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">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.<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">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.<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">I am using ITK 4.2 on a Windows 7 64x platform, running under VS 2008.<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">When I create the ConnectedThresholdImageFilter I set the following attributes of the new instance:<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">(This code is only partial but should give you an idea of what I’m doing.)<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span class="Apple-converted-space"> </span><span style="color: blue; ">typedef</span><span class="Apple-converted-space"> </span>itk::Image<<span style="color: blue; ">short</span>, 3> DICOMImageType;<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span class="Apple-converted-space"> </span><span style="color: blue; ">typedef</span><span class="Apple-converted-space"> </span>DICOMImageType::Pointer DICOMImagePointer;<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span class="Apple-converted-space"> </span><span style="color: blue; ">typedef</span><span class="Apple-converted-space"> </span>itk::Image<<span style="color: blue; ">unsigned</span><span class="Apple-converted-space"> </span><span style="color: blue; ">char</span>, 3> MaskImageType;<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span class="Apple-converted-space"> </span><span style="color: blue; ">typedef</span><span class="Apple-converted-space"> </span>MaskImageType::Pointer MaskImagePointer;<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span class="Apple-converted-space"> </span><span style="color: blue; ">typedef</span><span class="Apple-converted-space"> </span>itk::ConnectedThresholdImageFilter<DICOMImageType, MaskImageType><o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> SeedGrowerType;<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span class="Apple-converted-space"> </span><span style="color: blue; ">typedef</span><span class="Apple-converted-space"> </span>SeedGrowerType::Pointer SeedGrowerPointer;<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt 0.5in; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">#define</span><span style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-converted-space"> </span>LOW_THRESHOLD 100<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt 0.5in; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">#define</span><span style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-converted-space"> </span>HIGH_THRESHOLD 4095<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt 0.5in; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">#define</span><span style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-converted-space"> </span>REPLACE_VALUE 255<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> _seedGrower = SeedGrowerType::New();<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> // _smoothDiff is the result of convolving an image with<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> // a 3x3 kernel and the output image is a short.<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> _seedGrower->SetInput(_smoothDiff->GetOutput());<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> // The AddSeeds method invokes _seedGrower->AddSeed to add<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> // seeds to the instance.<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> AddSeeds(debugStream);<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> _seedGrower->SetLower(LOW_THRESHOLD);<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> _seedGrower->SetUpper(HIGH_THRESHOLD);<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> _seedGrower->SetReplaceValue(REPLACE_VALUE);<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10pt; font-family: 'Courier New'; "> _seedGrower->Update();<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">The mask in the attached image is the result of _seedGrower->GetOutput(). The mask image has a pixel type of unsigned char.<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">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.<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">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.<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">Thanks<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "> -- Scott<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div></div>_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.php<br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.itk.org/mailman/listinfo/insight-users</div></blockquote></div><br></div></body></html>