[Insight-users] Photographic Negative ?

Atwood, Robert C r.atwood at imperial.ac.uk
Fri, 16 Apr 2004 18:02:47 +0100


I cannot figure out a simple filter that returns the negative of an
image.=20
The RescaleImageFilter does not allow a negative scale, and ScaleShift
also seems to choke if the scale is -1


For example I have an image containing values (x) between 0 and 200, I
want to pass through an image in which each value is 200-x (output of
distance map)

Outputting the dmap->GetOutput() data shows me the correct distance map,
but output of rescaler->GetOutput() creates a file that is all zeros.
RescaleImageFilter simply returns an error if the minimum is greater
than the maximum. I am guessing that negative SetScale value is not
intended to be used in the ShiftScaleImageFilter?


What is the correct filter to use for this purpose?

Thanks,
Robert

=20
Here are the important definitions and statements used to get all zeros:



typedef itk::Image<unsigned long, 3>   LabeledImageType;
typedef itk::ShiftScaleImageFilter<LabeledImageType,LabeledImageType>
RescaleType;
RescaleType::Pointer rescaler =3D RescaleType::New();

rescaler->SetScale(-1);
rescaler->SetShift(200);

rescaler->SetInput(dmapvol->GetOutput());