[Insight-users] Add SpatialObject To Image
Chris Turner
cturnercomplex at googlemail.com
Wed Aug 11 13:03:30 EDT 2010
okay the problem with the white image was because of:
const OutputPixelType airHounsfieldUnits = -1000;
I put it to 0 now the output image is the same as the input image.
Means: I can't see the line.
Any idea?
Thanks Chris
On Wed, Aug 11, 2010 at 10:06 AM, Chris Turner
<cturnercomplex at googlemail.com> wrote:
> 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