<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&nbsp;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 &lt;<a href="mailto:Scott.Johnson@neuwave.com">Scott.Johnson@neuwave.com</a>&gt; 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?&nbsp; 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); ">&nbsp;</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); ">&nbsp;</span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="color: rgb(31, 73, 125); ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- 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); ">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</span><b>On Behalf Of<span class="Apple-converted-space">&nbsp;</span></b>Scott Johnson<br><b>Sent:</b><span class="Apple-converted-space">&nbsp;</span>Tuesday, January 29, 2013 2:01 PM<br><b>To:</b><span class="Apple-converted-space">&nbsp;</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">&nbsp;</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>&nbsp;</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>&nbsp;</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.&nbsp; I’m&nbsp; 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.&nbsp; I have verified that the seed points are still there.&nbsp; I have also tried to build my instance of ConnectedThresholdImageFilter from scratch each time I want to execute it.&nbsp; 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>&nbsp;</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.&nbsp; I will attach an image with a small cross showing one of the seed positions and the mask generated by ConnectedThresholdImageFilter.&nbsp; 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>&nbsp;</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>&nbsp;</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>&nbsp;</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'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: blue; ">typedef</span><span class="Apple-converted-space">&nbsp;</span>itk::Image&lt;<span style="color: blue; ">short</span>, 3&gt; 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'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: blue; ">typedef</span><span class="Apple-converted-space">&nbsp;</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'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: blue; ">typedef</span><span class="Apple-converted-space">&nbsp;</span>itk::Image&lt;<span style="color: blue; ">unsigned</span><span class="Apple-converted-space">&nbsp;</span><span style="color: blue; ">char</span>, 3&gt; 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'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: blue; ">typedef</span><span class="Apple-converted-space">&nbsp;</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'; ">&nbsp;</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'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: blue; ">typedef</span><span class="Apple-converted-space">&nbsp;</span>itk::ConnectedThresholdImageFilter&lt;DICOMImageType, MaskImageType&gt;<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'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: blue; ">typedef</span><span class="Apple-converted-space">&nbsp;</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>&nbsp;</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">&nbsp;</span>LOW_THRESHOLD&nbsp; 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">&nbsp;</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">&nbsp;</span>REPLACE_VALUE&nbsp; 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'; ">&nbsp;</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'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _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'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // _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'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 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'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _seedGrower-&gt;SetInput(_smoothDiff-&gt;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'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // The AddSeeds method invokes _seedGrower-&gt;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'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 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'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _seedGrower-&gt;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'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _seedGrower-&gt;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'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _seedGrower-&gt;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'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _seedGrower-&gt;Update();<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p>&nbsp;</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-&gt;GetOutput().&nbsp; 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>&nbsp;</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.&nbsp; 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>&nbsp;</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.&nbsp; If it is paying attention to my seed points then the seed growth isn’t stopping at the end of the feature.&nbsp; 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>&nbsp;</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>&nbsp;</o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Scott<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p>&nbsp;</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>