[Insight-users] Add SpatialObject To Image

Chris Turner cturnercomplex at googlemail.com
Wed Aug 11 10:06:25 EDT 2010


Hi everyone,

I'm having trouble adding a spatial object (a line) to an image. The
problem is that the resulting image is completely white (BG: 64536).

I generate the line like it's done in the itk user guide. And this is
how I add an image with that line

typedef itk::SpatialObjectToImageFilter<LineType, OutputImageType>
SpatialObjectToImageFilterType;
SpatialObjectToImageFilterType::Pointer imageFilter =
SpatialObjectToImageFilterType::New();

imageFilter->SetInput(Line);
imageFilter->SetSize( size  );  // from the image
imageFilter->SetSpacing( spacing ); // from the image
imageFilter->Update();

typedef itk::AddImageFilter<OutputImageType,OutputImageType,
OutputImageType > AddFilterType;
AddFilterType::Pointer addFilter = AddFilterType::New();
addFilter->SetInput1( itkImporter->GetOutput() ); //the image
addFilter->SetInput2( imageFilter->GetOutput() ); // the line

const OutputPixelType airHounsfieldUnits  = -1000;
const OutputPixelType boneHounsfieldUnits =   800;

Line->SetDefaultInsideValue(   boneHounsfieldUnits );
Line->SetDefaultOutsideValue( airHounsfieldUnits );

imageFilter->SetUseObjectValue( true );
imageFilter->SetOutsideValue( airHounsfieldUnits );

save addFilter->GetOutput() to file. The size and origin of the image
is correct but it's just white....

Anybody knows what I'm doing wrong?


Thanks,
Chris


More information about the Insight-users mailing list