Hi Dan,<br><br>thanx for your support. Here's the code.Please take a look. Michael.<br>If you want, I can send images acoording to the filter steps an the dicom data.<br><br>Michael<br><br><div id=":j9" class="ii gt">///////////////////////////////////////////<br>
<br>const double initialDistance = 5.0;<br>const double sigma = 1.0;<br>const double alpha = -0.3;<br>const double beta = 2.0;<br>const double curvatureScaling = 0.05;<br>const double propagationScaling = 1.0;<br><br>
typedef itk::Image< float,3 > InternalImageType;<br>typedef itk::Image< short,3 > ShortImageType;<br><br>typedef itk::CurvatureAnisotropicDiffusionImageFilter <ShortImageType, InternalImageType> SmoothingFilterType;<br>
typedef itk::GradientMagnitudeRecursiveGaussianImageFilter <InternalImageType, InternalImageType> GradientFilterType;<br>typedef itk::SigmoidImageFilter <InternalImageType, InternalImageType> SigmoidFilterType;<br>
typedef itk::FastMarchingImageFilter <InternalImageType, InternalImageType> FastMarchingFilterType;<br>typedef itk::ShapeDetectionLevelSetImageFilter <InternalImageType, InternalImageType> ShapeDetectionFilterType;<br>
typedef itk::BinaryThresholdImageFilter <InternalImageType, InternalImageType> ThresholdingFilterType;<br><br>ThresholdingFilterType::Pointer thresholder = ThresholdingFilterType::New();<br>SmoothingFilterType::Pointer smoothing = SmoothingFilterType::New();<br>
GradientFilterType::Pointer gradientMagnitude = GradientFilterType::New();<br>SigmoidFilterType::Pointer sigmoid = SigmoidFilterType::New();<br>FastMarchingFilterType::Pointer fastMarching = FastMarchingFilterType::New();<br>
ShapeDetectionFilterType::Pointer shapeDetection = ShapeDetectionFilterType::New();<br><br>// the input comes from a dicomreader<br>smoothing->SetInput( m_Dicomreader->GetITKOutput() );<br>gradientMagnitude->SetInput( smoothing->GetOutput() );<br>
sigmoid->SetInput( gradientMagnitude->GetOutput() );<br>shapeDetection->SetInput( fastMarching->GetOutput() );<br>shapeDetection->SetFeatureImage( sigmoid->GetOutput() );<br>thresholder->SetInput( shapeDetection->GetOutput() );<br>
<br>smoothing->SetTimeStep(0.0625);<br>smoothing->SetNumberOfIterations(5);<br>smoothing->SetConductanceParameter(9.0);<br><br>gradientMagnitude->SetSigma(sigma);<br><br>sigmoid->SetOutputMinimum(0.0);<br>
sigmoid->SetOutputMaximum(1.0);<br>
sigmoid->SetAlpha(alpha);<br>sigmoid->SetBeta(beta);<br><br>typedef FastMarchingFilterType::NodeContainer NodeContainer;<br>typedef FastMarchingFilterType::NodeType NodeType;<br>NodeContainer::Pointer seeds = NodeContainer::New();<br>
<br>InternalImageType::IndexType seedPosition;<br><br>seedPosition[0] = 250;<br>seedPosition[1] = 300;<br>seedPosition[2] = 0;<br><br>NodeType node;<br>const double seedValue = - initialDistance;<br><br>node.SetValue( seedValue );<br>
node.SetIndex( seedPosition );<br><br>seeds->Initialize();<br>seeds->InsertElement( 0, node );<br><br>fastMarching->SetTrialPoints( seeds );<br>fastMarching->SetSpeedConstant( 1.0 );<br>fastMarching->SetOutputSize( m_Dicomreader->GetITKOutput()->GetBufferedRegion().GetSize() );<br>
<br>shapeDetection->SetPropagationScaling( propagationScaling );<br>shapeDetection->SetCurvatureScaling( curvatureScaling );<br>shapeDetection->SetMaximumRMSError( 0.02 );<br>shapeDetection->SetNumberOfIterations( 800 );<br>
<br>thresholder->SetLowerThreshold(-1000.0 );<br>thresholder->SetUpperThreshold(0.0 );<br>thresholder->SetOutsideValue( 0 );<br>thresholder->SetInsideValue( 255 );<br><br>// here I use a VtkImageViewer2 to show the output<br>
Utility::popUpImage(thresholder->GetOutput());<br><br>////////////////////////////////////////////////////////////////////////////////////////////////</div><br><br><br><br><div class="gmail_quote">2009/8/27 Dan Mueller <span dir="ltr"><<a href="mailto:dan.muel@gmail.com">dan.muel@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Michael,<br>
<br>
I recommended that you post the minimal source code (and possibly<br>
data) required to reproduce the issue.<br>
<br>
Regards, Dan<br>
<br>
2009/8/25 Michael Xanadu <<a href="mailto:xanadu.michael@googlemail.com">xanadu.michael@googlemail.com</a>>:<br>
<div><div></div><div class="h5">> Hi folks,<br>
><br>
> I've got a problem with all segmentation filters which have two inputs, for<br>
> example ShapeDetectionLevelSet or GeodesicActiveContour. I tryed the<br>
> accordant examples in the example folders and they work great (with image<br>
> files). But if I replace the input by a dicomreader (of course, I changed<br>
> all accordant parameters, too) I always get a black output with a little<br>
> white spot at the coordinate where I placed the seedpoint. I messed around<br>
> with the filter parameters, but I never get a segment, only the spot. Is<br>
> somebody familiar with the problem?<br>
><br>
> Michael<br>
><br>
> P.S.: dicom data = 512 x 512 x 4, short<br>
><br>
</div></div>> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><br>
><br>
</blockquote></div><br>