<div dir="ltr"><font><font face="verdana,sans-serif">I read your DICTA article, as well as the IJ article.</font></font><div><font><font face="verdana,sans-serif"><br></font></font></div><div><font><font face="verdana,sans-serif">I ran your examples with my test data, using the following command line arguments: "</font></font><font face="verdana, sans-serif">-r 50 </font><span style="font-family:verdana,sans-serif">-i image.mha </span><span style="font-family:verdana,sans-serif">-o out.mha".</span></div>
<div><span style="font-family:verdana,sans-serif"><br></span></div>
<div><font><font face="verdana,sans-serif">labelSetsDilate creates an artifact, when compared to others (such as WaterShed variant). </font></font><span style="font-family:verdana,sans-serif">I tried looking at the code, but it is not easy to find this bug myself. </span><span style="font-family:verdana,sans-serif">Images are attached.</span></div>
<div><span style="font-family:verdana,sans-serif"><br></span></div><div style><span style="font-family:verdana,sans-serif">Your implementation is significantly faster (I have not measured how much exactly). Lastly, thank you for sharing the code.</span></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 13, 2013 at 4:34 AM, Richard Beare <span dir="ltr"><<a href="mailto:richard.beare@gmail.com" target="_blank">richard.beare@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The parallel classes for this are now on InsightJournal. Article<br>
includes some comparisons - hope it helps:<br>
<br>
<a href="http://hdl.handle.net/10380/3399" target="_blank">http://hdl.handle.net/10380/3399</a><br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On Tue, Feb 12, 2013 at 8:20 AM, Dženan Zukić <<a href="mailto:dzenanz@gmail.com">dzenanz@gmail.com</a>> wrote:<br>
> Today I finally managed to try it myself, and it works. Below is<br>
> implementation in ITK, if anyone needs it.<br>
><br>
> typedef itk::Image<unsigned char, 3> VisualizingImageType;<br>
> typedef itk::Image<float, 3> InternalImageType;<br>
><br>
> //function call example<br>
> std::vector<VisualizingImageType::IndexType> centers;<br>
> for (int i=0; i<vertebra.size(); i++)<br>
> centers.push_back(vertebra[i]->centerIndex);<br>
> VisualizingImageType::Pointer vInfluence=multilabelDilation(region, 50,<br>
> centers);<br>
><br>
><br>
> VisualizingImageType::Pointer multilabelDilation(itk::ImageRegion<3> region,<br>
> float radius, std::vector<VisualizingImageType::IndexType> points)<br>
> {<br>
> typedef<br>
> itk::BinaryBallStructuringElement<VisualizingImageType::PixelType,3><br>
> BallType;<br>
> BallType ball;<br>
> ball.SetRadius(radius);<br>
> ball.CreateStructuringElement();<br>
> typedef itk::BinaryDilateImageFilter<VisualizingImageType,<br>
> VisualizingImageType, BallType> growType;<br>
> growType::Pointer grow=growType::New();<br>
> grow->SetKernel(ball); //grow->SetRadius(radius);<br>
><br>
> VisualizingImageType::Pointer image=VisualizingImageType::New();<br>
> image->SetRegions(region);<br>
> image->Allocate();<br>
> image->FillBuffer(0);<br>
> for (int i=0; i<points.size(); i++)<br>
> image->SetPixel(points[i], grow->GetDilateValue());<br>
><br>
> grow->SetInput(image);<br>
> grow->Update();<br>
> writeImage(grow->GetOutput(), "1dilate.nrrd"); //debug<br>
><br>
> typedef itk::SignedMaurerDistanceMapImageFilter<VisualizingImageType,<br>
> InternalImageType> DistanceMapType;<br>
> DistanceMapType::Pointer dm=DistanceMapType::New();<br>
> dm->SetInput(image);<br>
> dm->SetUseImageSpacing(true);<br>
> dm->InsideIsPositiveOff();<br>
> dm->Update();<br>
> writeImage(dm->GetOutput(), "2distanceMap.nrrd"); //debug<br>
><br>
> for (int i=0; i<points.size(); i++)<br>
> image->SetPixel(points[i], i+1); //now set index+1<br>
><br>
> typedef<br>
> itk::MorphologicalWatershedFromMarkersImageFilter<InternalImageType,<br>
> VisualizingImageType> morphoWSfMType;<br>
> morphoWSfMType::Pointer ws=morphoWSfMType::New();<br>
> ws->SetInput1(dm->GetOutput());<br>
> ws->SetInput2(image);<br>
> ws->Update();<br>
> writeImage(ws->GetOutput(), "3watershed.nrrd"); //debug<br>
><br>
> typedef itk::AndImageFilter<VisualizingImageType> AndType;<br>
> AndType::Pointer and=AndType::New();<br>
> and->SetInput1(ws->GetOutput());<br>
> and->SetInput2(grow->GetOutput());<br>
> and->Update();<br>
> writeImage(and->GetOutput(), "4multiplied.nrrd"); //debug<br>
><br>
> return and->GetOutput();<br>
> }<br>
><br>
><br>
> On Fri, Feb 8, 2013 at 11:36 AM, Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>><br>
> wrote:<br>
>><br>
>> Unfortunately, my helpful e-mail was too big to make it to the list. So<br>
>> here is the important bit, which defines a function in Python with<br>
>> SimpleITK:<br>
>><br>
>><br>
>> def MultilabelDilation(img,<br>
>> radius=1,kernel=sitk.BinaryDilateImageFilter.Ball):<br>
>><br>
>> distImg = sitk.SignedMaurerDistanceMap(img != 0,<br>
>> insideIsPositive=False, squaredDistance=False, useImageSpacing=False)<br>
>><br>
>> dilatImg = sitk.BinaryDilate(img!=0, radius, kernel)<br>
>><br>
>> wsImg = sitk.MorphologicalWatershedFromMarkers(distImg, img)<br>
>><br>
>> return dilatImg*wsImg<br>
>><br>
>><br>
>><br>
>><br>
>> On Feb 8, 2013, at 9:42 AM, Dženan Zukić <<a href="mailto:dzenanz@gmail.com">dzenanz@gmail.com</a>> wrote:<br>
>><br>
>> Thanks for the interest and the provided code Brad. Hopefully I will get<br>
>> to work today to try it out myself :D (Blizzard warning in Boston, where I<br>
>> am for a couple months)<br>
>><br>
>><br>
><br>
</div></div></blockquote></div><br></div>