[vtkusers] How to threshold vtkimage data
Jim Peterson
jimcp at cox.net
Wed Oct 13 07:43:37 EDT 2010
Ali Habib wrote:
> Hi All,
>
> I read a series of DICOM files , and I want to apply threshold (for
> further segmentation) but the below cod not effect any more
>
> vtk.vtkDICOMImageReader VDR = new vtk.vtkDICOMImageReader();
> VDR.SetDirectoryName(@"E:\Master
> Degree\DataSet\case2\DICOM\PA1\ST1\SE2");
> VDR.SetDataOrigin(0, 0, 0);
> VDR.Update();
>
> vtkImageThreshold VIT = new vtkImageThreshold();
> // VIT.ThresholdBetween(-300, 300);
> VIT.ThresholdByLower(100);
> VIT.SetInputConnection(VDR.GetOutputPort());
>
> VIT.Update();
>
> vtk.vtkImageIslandRemoval2D ImageIslandRemoval2D = new
> vtk.vtkImageIslandRemoval2D();
> ImageIslandRemoval2D.SetInput(VIT.GetOutput());
> ImageIslandRemoval2D.SetAreaThreshold(1000);
>
> vtk.vtkContourFilter skinExtractor = new
> vtk.vtkContourFilter();
>
> skinExtractor.SetInputConnection(ImageIslandRemoval2D.GetOutputPort());
> //skinExtractor.SetValue(0, 500); // 1123 extract
> mandible //
> skinExtractor.GenerateValues(1, -300, 300);
> skinExtractor.ComputeGradientsOn();
>
> any suggestion pelase
So what were you expecting to have happen and what happened for you?
What did you change to cause this to "not effect any more"? Have you
been reading the vtk class documentation? See
http://www.vtk.org/doc/nightly/html/classvtkContourFilter.html for the
contour filter class doc. what are you expecting
GenerateValues(1,-300,300) to set as contour values? Does that sound
like a appropriate use of that function? how is one output value
supposed to include the min and max values?
My gut feeling is the island filter with threshold 1000 is removing all
features.
HTH,
Jim
More information about the vtkusers
mailing list