<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><base href="x-msg://1918/"><style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks Brad. I’ll try that.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> -- Scott<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Bradley Lowekamp [mailto:blowekamp@mail.nih.gov] <br><b>Sent:</b> Wednesday, January 30, 2013 5:52 PM<br><b>To:</b> Scott Johnson<br><b>Cc:</b> Bradley Lowekamp; itk (Insight-users@itk.org)<br><b>Subject:</b> Re: [Insight-users] ConnectedThresholdImageFilter Seed Problems<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Scott,<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>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.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>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.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Brad<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>On Jan 30, 2013, at 4:25 PM, Scott Johnson <<a href="mailto:Scott.Johnson@neuwave.com">Scott.Johnson@neuwave.com</a>> wrote:<o:p></o:p></p></div><p class=MsoNormal><br><br><o:p></o:p></p><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks for the reply Brad.</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>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.</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> -- Scott</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p></div><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><div><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span class=apple-converted-space><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> </span></span><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Bradley Lowekamp [mailto:blowekamp@<a href="http://mail.nih.gov"><span style='color:purple'>mail.nih.gov</span></a>]<span class=apple-converted-space> </span><br><b>Sent:</b><span class=apple-converted-space> </span>Wednesday, January 30, 2013 3:10 PM<br><b>To:</b><span class=apple-converted-space> </span>Scott Johnson<br><b>Cc:</b><span class=apple-converted-space> </span>itk (<a href="mailto:Insight-users@itk.org"><span style='color:purple'>Insight-users@itk.org</span></a>)<br><b>Subject:</b><span class=apple-converted-space> </span>Re: [Insight-users] ConnectedThresholdImageFilter Seed Problems</span><o:p></o:p></p></div></div></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>Hello Scott,<o:p></o:p></p></div><div><div><p class=MsoNormal> <o:p></o:p></p></div></div><div><div><p class=MsoNormal>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.<o:p></o:p></p></div></div><div><div><p class=MsoNormal> <o:p></o:p></p></div></div><div><div><p class=MsoNormal>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.<o:p></o:p></p></div></div><div><div><p class=MsoNormal> <o:p></o:p></p></div></div><div><div><p class=MsoNormal>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.<o:p></o:p></p></div></div><div><div><p class=MsoNormal> <o:p></o:p></p></div></div><div><div><p class=MsoNormal>Brad<o:p></o:p></p></div></div><div><div><p class=MsoNormal> <o:p></o:p></p></div><div><div><div><p class=MsoNormal>On Jan 30, 2013, at 4:00 PM, Scott Johnson <<a href="mailto:Scott.Johnson@neuwave.com"><span style='color:purple'>Scott.Johnson@neuwave.com</span></a>> wrote:<o:p></o:p></p></div></div><div><p class=MsoNormal><br><br><br><o:p></o:p></p></div><div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Anybody? Any ideas as to how I might debug this problem?</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> -- Scott</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p></div></div><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><div><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span class=apple-converted-space><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> </span></span><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><a href="mailto:insight-users-bounces@itk.org"><span style='color:purple'>insight-users-bounces@itk.org</span></a><span class=apple-converted-space> </span>[mailto:insight-<a href="mailto:users-bounces@itk.org"><span style='color:purple'>users-bounces@itk.org</span></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"><span style='color:purple'>Insight-users@itk.org</span></a>)<br><b>Subject:</b><span class=apple-converted-space> </span>[Insight-users] ConnectedThresholdImageFilter Seed Problems</span><o:p></o:p></p></div></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> </span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>Hello,</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> </span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;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.</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> </span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;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.</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> </span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>I am using ITK 4.2 on a Windows 7 64x platform, running under VS 2008.</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> </span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>When I create the ConnectedThresholdImageFilter I set the following attributes of the new instance:</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>(This code is only partial but should give you an idea of what I’m doing.)</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> </span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;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;</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;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;</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;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;</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;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;</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'> </span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;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></span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'> SeedGrowerType;</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;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;</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> </span><o:p></o:p></p></div></div><div style='margin-left:.5in'><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:blue'>#define</span><span class=apple-converted-space><span style='font-size:10.0pt;font-family:"Courier New"'> </span></span><span style='font-size:10.0pt;font-family:"Courier New"'>LOW_THRESHOLD 100</span><o:p></o:p></p></div></div><div style='margin-left:.5in'><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:blue'>#define</span><span class=apple-converted-space><span style='font-size:10.0pt;font-family:"Courier New"'> </span></span><span style='font-size:10.0pt;font-family:"Courier New"'>HIGH_THRESHOLD 4095</span><o:p></o:p></p></div></div><div style='margin-left:.5in'><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:blue'>#define</span><span class=apple-converted-space><span style='font-size:10.0pt;font-family:"Courier New"'> </span></span><span style='font-size:10.0pt;font-family:"Courier New"'>REPLACE_VALUE 255</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'> </span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'> _seedGrower = SeedGrowerType::New();</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'> // _smoothDiff is the result of convolving an image with</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'> // a 3x3 kernel and the output image is a short.</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'> _seedGrower->SetInput(_smoothDiff->GetOutput());</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'> // The AddSeeds method invokes _seedGrower->AddSeed to add</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'> // seeds to the instance.</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'> AddSeeds(debugStream);</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'> _seedGrower->SetLower(LOW_THRESHOLD);</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'> _seedGrower->SetUpper(HIGH_THRESHOLD);</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'> _seedGrower->SetReplaceValue(REPLACE_VALUE);</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'> _seedGrower->Update();</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> </span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;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.</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> </span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;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.</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> </span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;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.</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> </span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>Thanks</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> </span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> -- Scott</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> </span><o:p></o:p></p></div></div><div><p class=MsoNormal><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'>_____________________________________<br>Powered by<span class=apple-converted-space> </span><a href="http://www.kitware.com"><span style='color:purple'>www.kitware.com</span></a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html"><span style='color:purple'>http://www.kitware.com/opensource/opensource.html</span></a><br><br>Kitware offers ITK Training Courses, for more information visit:<br><a href="http://www.kitware.com/products/protraining.php"><span style='color:purple'>http://www.kitware.com/products/protraining.php</span></a><br><br>Please keep messages on-topic and check the ITK FAQ at:<br><a href="http://www.itk.org/Wiki/ITK_FAQ"><span style='color:purple'>http://www.itk.org/Wiki/ITK_FAQ</span></a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.itk.org/mailman/listinfo/insight-users"><span style='color:purple'>http://www.itk.org/mailman/listinfo/insight-users</span></a></span><o:p></o:p></p></div></div></div><div><p class=MsoNormal> <o:p></o:p></p></div></div></div></div><p class=MsoNormal><o:p> </o:p></p></div></div></body></html>