[Insight-users] multi-input filters unwilling to work

Michael Xanadu xanadu.michael at googlemail.com
Thu Aug 27 09:37:58 EDT 2009


Hi Dan,

thanx for your support. Here's the code.Please take a look. Michael.
If you want, I can send images acoording to the filter steps an the dicom
data.

Michael

///////////////////////////////////////////

const double initialDistance = 5.0;
const double sigma =  1.0;
const double alpha =  -0.3;
const double beta  =  2.0;
const double curvatureScaling   = 0.05;
const double propagationScaling = 1.0;

typedef itk::Image< float,3 > InternalImageType;
typedef itk::Image< short,3 > ShortImageType;

typedef itk::CurvatureAnisotropicDiffusionImageFilter <ShortImageType,
InternalImageType> SmoothingFilterType;
typedef itk::GradientMagnitudeRecursiveGaussianImageFilter
<InternalImageType, InternalImageType> GradientFilterType;
typedef itk::SigmoidImageFilter <InternalImageType, InternalImageType>
SigmoidFilterType;
typedef itk::FastMarchingImageFilter <InternalImageType, InternalImageType>
FastMarchingFilterType;
typedef itk::ShapeDetectionLevelSetImageFilter <InternalImageType,
InternalImageType> ShapeDetectionFilterType;
typedef itk::BinaryThresholdImageFilter <InternalImageType,
InternalImageType> ThresholdingFilterType;

ThresholdingFilterType::Pointer thresholder = ThresholdingFilterType::New();
SmoothingFilterType::Pointer smoothing = SmoothingFilterType::New();
GradientFilterType::Pointer gradientMagnitude = GradientFilterType::New();
SigmoidFilterType::Pointer sigmoid = SigmoidFilterType::New();
FastMarchingFilterType::Pointer fastMarching =
FastMarchingFilterType::New();
ShapeDetectionFilterType::Pointer shapeDetection =
ShapeDetectionFilterType::New();

// the input comes from a dicomreader
smoothing->SetInput( m_Dicomreader->GetITKOutput() );
gradientMagnitude->SetInput( smoothing->GetOutput() );
sigmoid->SetInput( gradientMagnitude->GetOutput() );
shapeDetection->SetInput( fastMarching->GetOutput() );
shapeDetection->SetFeatureImage( sigmoid->GetOutput() );
thresholder->SetInput( shapeDetection->GetOutput() );

smoothing->SetTimeStep(0.0625);
smoothing->SetNumberOfIterations(5);
smoothing->SetConductanceParameter(9.0);

gradientMagnitude->SetSigma(sigma);

sigmoid->SetOutputMinimum(0.0);
sigmoid->SetOutputMaximum(1.0);
sigmoid->SetAlpha(alpha);
sigmoid->SetBeta(beta);

typedef FastMarchingFilterType::NodeContainer NodeContainer;
typedef FastMarchingFilterType::NodeType NodeType;
NodeContainer::Pointer seeds = NodeContainer::New();

InternalImageType::IndexType  seedPosition;

seedPosition[0] = 250;
seedPosition[1] = 300;
seedPosition[2] = 0;

NodeType node;
const double seedValue = - initialDistance;

node.SetValue( seedValue );
node.SetIndex( seedPosition );

seeds->Initialize();
seeds->InsertElement( 0, node );

fastMarching->SetTrialPoints(  seeds  );
fastMarching->SetSpeedConstant( 1.0 );
fastMarching->SetOutputSize(
m_Dicomreader->GetITKOutput()->GetBufferedRegion().GetSize() );

shapeDetection->SetPropagationScaling(  propagationScaling );
shapeDetection->SetCurvatureScaling( curvatureScaling );
shapeDetection->SetMaximumRMSError( 0.02 );
shapeDetection->SetNumberOfIterations( 800 );

thresholder->SetLowerThreshold(-1000.0 );
thresholder->SetUpperThreshold(0.0 );
thresholder->SetOutsideValue(  0  );
thresholder->SetInsideValue(  255 );

// here I use a VtkImageViewer2 to show the output
Utility::popUpImage(thresholder->GetOutput());

////////////////////////////////////////////////////////////////////////////////////////////////




2009/8/27 Dan Mueller <dan.muel at gmail.com>

> Hi Michael,
>
> I recommended that you post the minimal source code (and possibly
> data) required to reproduce the issue.
>
> Regards, Dan
>
> 2009/8/25 Michael Xanadu <xanadu.michael at googlemail.com>:
> > Hi folks,
> >
> > I've got a problem with all segmentation filters which have two inputs,
> for
> > example ShapeDetectionLevelSet or GeodesicActiveContour. I tryed the
> > accordant examples in the example folders and they work great (with image
> > files). But if I replace the input by a dicomreader (of course, I changed
> > all accordant parameters, too) I always get a black output with a little
> > white spot at the coordinate where I placed the seedpoint. I messed
> around
> > with the filter parameters, but I never get a segment, only the spot. Is
> > somebody familiar with the problem?
> >
> > Michael
> >
> > P.S.: dicom data = 512 x 512 x 4, short
> >
> > _____________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > 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
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090827/e933d897/attachment-0001.htm>


More information about the Insight-users mailing list