[Insight-users] Commentary on community

Johnson, Hans J hans-johnson at uiowa.edu
Wed Feb 13 07:56:13 EST 2013


All,

I wanted to pontificate on the virtues of living a good clean coding life
:) .

A need was identified on the user mailing list,
--February 8th, a SimpleITK suggestions was made
--February 12th, a re-implementation of that was provided in C++
--February 13th, an insight-journal article with illustrations,
alternative approaches, AND implementation files was submitted and is
available to the community
--Future these tools are being deployed TODAY for advancing our
understanding of human diseasee

It is wonderful to be part of such a distinguished community.

GO TEAM ITK!

Hans

On 2/13/13 4:34 AM, "Richard Beare" <richard.beare at gmail.com> wrote:

>The parallel classes for this are now on InsightJournal. Article
>includes some comparisons - hope it helps:
>
>http://hdl.handle.net/10380/3399
>
>
>On Tue, Feb 12, 2013 at 8:20 AM, Dženan Zukić <dzenanz at gmail.com> wrote:
>> Today I finally managed to try it myself, and it works. Below is
>> implementation in ITK, if anyone needs it.
>>
>> typedef itk::Image<unsigned char, 3> VisualizingImageType;
>> typedef itk::Image<float, 3> InternalImageType;
>>
>> //function call example
>> std::vector<VisualizingImageType::IndexType> centers;
>> for (int i=0; i<vertebra.size(); i++)
>> centers.push_back(vertebra[i]->centerIndex);
>> VisualizingImageType::Pointer vInfluence=multilabelDilation(region, 50,
>> centers);
>>
>>
>> VisualizingImageType::Pointer multilabelDilation(itk::ImageRegion<3>
>>region,
>> float radius, std::vector<VisualizingImageType::IndexType> points)
>> {
>>     typedef
>> itk::BinaryBallStructuringElement<VisualizingImageType::PixelType,3>
>> BallType;
>>     BallType ball;
>>     ball.SetRadius(radius);
>>     ball.CreateStructuringElement();
>>     typedef itk::BinaryDilateImageFilter<VisualizingImageType,
>> VisualizingImageType, BallType> growType;
>>     growType::Pointer grow=growType::New();
>>     grow->SetKernel(ball); //grow->SetRadius(radius);
>>
>>     VisualizingImageType::Pointer image=VisualizingImageType::New();
>>     image->SetRegions(region);
>>     image->Allocate();
>>     image->FillBuffer(0);
>>     for (int i=0; i<points.size(); i++)
>>         image->SetPixel(points[i], grow->GetDilateValue());
>>
>>     grow->SetInput(image);
>>     grow->Update();
>>     writeImage(grow->GetOutput(), "1dilate.nrrd"); //debug
>>
>>     typedef
>>itk::SignedMaurerDistanceMapImageFilter<VisualizingImageType,
>> InternalImageType> DistanceMapType;
>>     DistanceMapType::Pointer dm=DistanceMapType::New();
>>     dm->SetInput(image);
>>     dm->SetUseImageSpacing(true);
>>     dm->InsideIsPositiveOff();
>>     dm->Update();
>>     writeImage(dm->GetOutput(), "2distanceMap.nrrd"); //debug
>>
>>     for (int i=0; i<points.size(); i++)
>>         image->SetPixel(points[i], i+1); //now set index+1
>>
>>     typedef
>> itk::MorphologicalWatershedFromMarkersImageFilter<InternalImageType,
>> VisualizingImageType> morphoWSfMType;
>>     morphoWSfMType::Pointer ws=morphoWSfMType::New();
>>     ws->SetInput1(dm->GetOutput());
>>     ws->SetInput2(image);
>>     ws->Update();
>>     writeImage(ws->GetOutput(), "3watershed.nrrd"); //debug
>>
>>     typedef itk::AndImageFilter<VisualizingImageType> AndType;
>>     AndType::Pointer and=AndType::New();
>>     and->SetInput1(ws->GetOutput());
>>     and->SetInput2(grow->GetOutput());
>>     and->Update();
>>     writeImage(and->GetOutput(), "4multiplied.nrrd"); //debug
>>
>>     return and->GetOutput();
>> }
>>
>>
>> On Fri, Feb 8, 2013 at 11:36 AM, Bradley Lowekamp
>><blowekamp at mail.nih.gov>
>> wrote:
>>>
>>> Unfortunately, my helpful e-mail was too big to make it to the list. So
>>> here is the important bit, which defines a function in Python with
>>> SimpleITK:
>>>
>>>
>>> def MultilabelDilation(img,
>>> radius=1,kernel=sitk.BinaryDilateImageFilter.Ball):
>>>
>>>     distImg = sitk.SignedMaurerDistanceMap(img != 0,
>>> insideIsPositive=False, squaredDistance=False, useImageSpacing=False)
>>>
>>>     dilatImg = sitk.BinaryDilate(img!=0, radius, kernel)
>>>
>>>     wsImg = sitk.MorphologicalWatershedFromMarkers(distImg, img)
>>>
>>>     return dilatImg*wsImg
>>>
>>>
>>>
>>>
>>> On Feb 8, 2013, at 9:42 AM, Dženan Zukić <dzenanz at gmail.com> wrote:
>>>
>>> Thanks for the interest and the provided code Brad. Hopefully I will
>>>get
>>> to work today to try it out myself :D (Blizzard warning in Boston,
>>>where I
>>> am for a couple months)
>>>
>>>
>>
>_____________________________________
>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



________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
________________________________


More information about the Insight-users mailing list