[vtk-developers] New class proposal: vtkImageChangeInformation

David Gobbi dgobbi at irus.rri.on.ca
Mon Apr 16 17:43:05 EDT 2001


Hello all,

I've written a new class and want to gather people's opinions
before I commit it.

It is called vtkImageChangeInformation, and its purpose is to
modify the 'Information' for an image (the Spacing, Origin, and
Extent) without modifying the data itself.

This is useful, for example, if you received a vtkStructuredPoints
data file from somewhere that had incorrect Spacing or Origin
information and you want to correct the information.  There are
many other possible uses.

The methods are as follows:

SetOutputSpacing(float spacing[3])
SetOutputOrigin(float origin[3])
  - specify new spacing and origin (the data is not resampled, only
    the information is changed)

SetOutputExtentStart(int start[3])
  - specify new values for WholeExtent[0], WholeExtent[2], WholeExtent[4]
    while keeping the overall dimensions of the data the same

SetInformationInput(vtkImageData *infoInput)
  - copy the Spacing, Origin, and WholeExtent from the specified data set
    and apply them to the Output (only WholeExtent[0], WholeExtent[2],
    and WholeExtent[4] are copied and the dimensions of the Output will
    be the same as the Input)
  - this method is an alternative to explicitly setting the Spacing,
    Origin and WholeExtent via the above three methods

CenterImageOn/Off()
  - modify the Origin so that image coordinate (0,0,0) lies at the center
    of the image (my primary reason for providing this method is so that
    people who used to use the deprecated
       vtkImageReslice::OutputAlwaysCenteredOnInputOn()
    method will have an alternative way of achieving the same result)

SetSpacingScale(float scale[3])
SetOriginScale(float scale[3])
SetOriginTranslation(float translation[3])
SetExtentTranslation(int translation[3])
  - apply simple arithmetic operations to the scale, origin, and extent
    of the input.

Any thoughts?  The existing VTK filter that this is most similar to
is vtkImageTranslateExtent.

 - David

--
  David Gobbi, MSc                    dgobbi at irus.rri.on.ca
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario





More information about the vtk-developers mailing list