[Insight-users] Geodesic Active Contours Segmentation with 3D volumes

Dan Mueller dan.muel at gmail.com
Thu Jul 10 00:20:52 EDT 2008


2008/7/10 Dan Mueller <dan.muel at gmail.com>:
> Second, the Fast Marching filter does it's operation in floating
> point. In native ITK, you *can* use integer input images (such as
> signed short), provided you use the NormalizationFactor property
> (please read the documentation in itkFastMarchingImageFilter.cxx).
> Unfortunately, you have spotted a problem with ManagedITK: it does not
> produce Fast Marching wrappers for integer images. I will fix this in
> the next version. You can fix it yourself by adding the following
> lines to ManagedITK\Source\Modules\LevelSetFilters\managed_itkFastMarchingImageFilter.cmake:
>    WRAP_IMAGE_FILTER_REAL(2)
>    WRAP_IMAGE_FILTER_USIGN_INT(2) # Add this line
>    WRAP_IMAGE_FILTER_SIGN_INT(2)   # Add this line
>
> (Gaëtan: I also notice WrapITK has these lines missing/commented out.
> Another reason to integrate!)

On closer inspection, adding these two lines is not the best solution.
Wrappers should also be generated for integer inputs and real
outputs...

> Finally, the IndexOutOfRangeException seems to be occurring because
> you are creating a 2D index for SeedPosition, rather than a 3D index.
> Try something like this:
>    IndexType SeedPosition = new IndexType(int.Parse(v1),
> int.Parse(v2), int.Parse(v3));
>    Seeds.Add(new NodeType(SeedValue, SeedPosition));
>
> Hope this helps.
>
> Regards, Dan
>
> 2008/7/9 Rehab Mansour <rehab_a_eg at yahoo.co.uk>:
>> Hi everyone,
>> I am using ManagedITK with c#,i am still a  begginer so i have lots of
>> questions in my hand....i have applied Level set Geodesic Active Contours
>> Segmentation on an image and it worked effectively thank God...now i am
>> trying to  apply it on a 3D volume(series of images) ,this is the code i am
>> using
>>
>>                 itkImageBase DicomSeries = itkImage_SS3.New();
>>                 itkImageBase PNGSeries = itkImage_F3.New();
>>                 itkImageBase Segmented = itkImage_UC3.New();
>>                 DicomSeries.ReadDicomDirectory(@"C:\Rehab\p6\1");
>>                 itkRescaleIntensityImageFilter_ISS3IF3 ConvertDCMtoPNG =
>>
>> itkRescaleIntensityImageFilter_ISS3IF3.New();
>>                 ConvertDCMtoPNG.SetInput(DicomSeries);
>>                 ConvertDCMtoPNG.OutputMinimum = 0;
>>                 ConvertDCMtoPNG.OutputMaximum = 255;
>>                 ConvertDCMtoPNG.GetOutput(PNGSeries);
>>                 ConvertDCMtoPNG.Update();
>>                 itkBinaryThresholdImageFilter_IF3IUC3 ThresholdingFilterType
>> = itkBinaryThresholdImageFilter_IF3IUC3.New();
>>                 ThresholdingFilterType.SetInput(PNGSeries);
>>                 ThresholdingFilterType.LowerThreshold = -1000.0;
>>                 ThresholdingFilterType.UpperThreshold = 0.0;
>>                 ThresholdingFilterType.OutsideValue = 0;
>>                 ThresholdingFilterType.InsideValue = 255;
>>                 itkRescaleIntensityImageFilter_IF3IUC3 CastFilterType1 =
>> itkRescaleIntensityImageFilter_IF3IUC3.New();
>>                 itkRescaleIntensityImageFilter_IF3IUC3 CastFilterType2 =
>> itkRescaleIntensityImageFilter_IF3IUC3.New();
>>                 itkRescaleIntensityImageFilter_IF3IUC3 CastFilterType3 =
>> itkRescaleIntensityImageFilter_IF3IUC3.New();
>>                 itkRescaleIntensityImageFilter_IF3IUC3 CastFilterType4 =
>> itkRescaleIntensityImageFilter_IF3IUC3.New();
>>                 itkCurvatureAnisotropicDiffusionImageFilter_IF3IF3
>> SmoothingFilterType =
>> itkCurvatureAnisotropicDiffusionImageFilter_IF3IF3.New();
>>                 SmoothingFilterType.TimeStep = 0.0625;
>>                 SmoothingFilterType.NumberOfIterations = 5;
>>                 SmoothingFilterType.ConductanceParameter = 9.0;
>>
>>
>>                 itkGradientMagnitudeRecursiveGaussianImageFilter_IF3IF3
>> GradientFilterType =
>> itkGradientMagnitudeRecursiveGaussianImageFilter_IF3IF3.New();
>>                 itkSigmoidImageFilter_IF3IF3 SigmoidFilterType =
>> itkSigmoidImageFilter_IF3IF3.New();
>>                 SigmoidFilterType.OutputMinimum = 0.0;
>>                 SigmoidFilterType.OutputMaximum = 1.0;
>>                 GradientFilterType.Sigma = double.Parse(v4);
>>                 SigmoidFilterType.Alpha = double.Parse(v5);
>>                 SigmoidFilterType.Beta = double.Parse(v6);
>>                 itkFastMarchingImageFilter_IF3IF3 FastMarchingFilterType =
>> itkFastMarchingImageFilter_IF3IF3.New();
>>                 itkGeodesicActiveContourLevelSetImageFilter_IF3IF3F
>> geodesicActivecontour =
>> itkGeodesicActiveContourLevelSetImageFilter_IF3IF3F.New();
>>
>>
>>                 //command line variable
>>                 geodesicActivecontour.PropagationScaling = int.Parse(v7);
>>                 geodesicActivecontour.CurvatureScaling = 1.0;
>>                 geodesicActivecontour.AdvectionScaling = 1.0;
>>                 geodesicActivecontour.MaximumRMSError = 0.02;
>>                 geodesicActivecontour.NumberOfIterations = 800;
>>                 ///////////////The pipeline\\\\\\\\\\\\\\\\\\\\\\\\
>>                 SmoothingFilterType.SetInput(PNGSeries);
>>
>> GradientFilterType.SetInput(SmoothingFilterType.GetOutput());
>>                 SigmoidFilterType.SetInput(GradientFilterType.GetOutput());
>>                 List<NodeType> Seeds = new List<NodeType>();
>>                 double SeedValue = -double.Parse(v3);
>>                 IndexType SeedPosition = new IndexType(int.Parse(v1),
>> int.Parse(v2));
>>                 Seeds.Add(new NodeType(SeedValue, SeedPosition));
>>                 FastMarchingFilterType.TrialPoints = Seeds.ToArray();
>>                 FastMarchingFilterType.SpeedConstant = 1.0;
>>                 FastMarchingFilterType.OutputSize = PNGSeries.Size;
>>                 FastMarchingFilterType.OutputSpacing = PNGSeries.Spacing;
>>
>> //////////////////////////////////////////////////////////////////////
>>                 FastMarchingFilterType.OutputSize =
>> PNGSeries.BufferedRegion.Size;
>>
>> FastMarchingFilterType.SetInput(SigmoidFilterType.GetOutput());
>>
>> geodesicActivecontour.SetInput(FastMarchingFilterType.GetOutput());
>>
>> geodesicActivecontour.SetFeatureImage(SigmoidFilterType.GetOutput());
>>
>> ThresholdingFilterType.SetInput(geodesicActivecontour.GetOutput());
>>                 ThresholdingFilterType.Update();
>>                 ThresholdingFilterType.GetOutput(Segmented);
>>                 Segmented.WriteSeries("segmented_{0}.png","00");
>>
>> i am having a problem at the fast marching filter...it doesn't accept the
>> seeds,i am giving it for it's trial point,
>> this line:  FastMarchingFilterType.TrialPoints = Seeds.ToArray();
>> this is the exception i am getting:
>> System.IndexOutOfRangeException was caught
>>   Message="Index was outside the bounds of the array."
>>   Source="ManagedITK.Common"
>>   StackTrace:
>>        at itk.itkArray`1.get_Item(Int32 index)
>>        at
>> itk.ManagedTypes.ToNativeLevelSetNode<float,3>(LevelSetNode<float\,3>* ,
>> itkLevelSetNode managedNode)
>>        at
>> itk.ManagedTypes.ToNativeLevelSetNodeContainer<float,3>(itkLevelSetNode[]
>> managedContainer)
>>        at
>> itk.itkFastMarchingImageFilter_IF3IF3.set_TrialPoints(itkLevelSetNode[]
>> value)
>>        at LevelSetActiveContour.Form1.button5_Click(Object sender, EventArgs
>> e) in C:\Users\HP\Documents\Visual Studio
>> 2005\Projects\LevelSetActiveContour\LevelSetActiveContour\Form1.cs:line 551
>>
>>
>>
>> Any idea anyone??!!
>> i have also two questions:
>>
>> when i tried this code and before the fastmarching filter...it took so much
>> processing time to update the filters...is taking a 3D volume was a wrong
>> idea to start with???should i make a loop and apply the pipleine for each
>> slice individually..will this make it any fast???
>> the other question is ....why the filters only accept float values??..the
>> major extension we all would be working on is Dicom..so shouln't it accept
>> dicom from the start??.....(i am sorry for this silly question i am just
>> wondering)...my technique is to convert the dicom series i have into any
>> other series but when i give it a large range it takes a huge processing
>> time so i thought i will only stick to 0-->255,but it's so much waste of
>> information
>>
>> Thanx for the hep in advance
>>
>> ________________________________
>> Not happy with your email address?
>> Get the one you really want - millions of new email addresses available now
>> at Yahoo!
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>>
>


More information about the Insight-users mailing list