Skip to content

Commit

Permalink
ENH: Adding function to SOToImageFilter simplify output definition (#…
Browse files Browse the repository at this point in the history
…1531)

* ENH: Adding function to SOToImageFilter simplify output definition

Added SetReferenceImage( img ) function.   The size, spacing, directions,
etc of the image passed to this function are used to define the
output image format of the filter.
  • Loading branch information
aylward authored and dzenanz committed Jan 6, 2020
1 parent b309c7b commit d6e79e8
Showing 1 changed file with 12 additions and 0 deletions.
Expand Up @@ -90,6 +90,18 @@ class ITK_TEMPLATE_EXPORT SpatialObjectToImageFilter : public ImageSource<TOutpu
const InputSpatialObjectType *
GetInput(unsigned int idx);

/** Generate an output image that matches the origin,
* size, direction, and spacing of this image. */
template <class TReferenceImage>
void
SetReferenceImage(TReferenceImage * refImage)
{
this->SetOrigin(refImage->GetOrigin());
this->SetSpacing(refImage->GetSpacing());
this->SetDirection(refImage->GetDirection());
this->SetSize(refImage->GetLargestPossibleRegion().GetSize());
}

/** Spacing (size of a pixel) of the output image. The
* spacing is the geometric distance between image samples.
* It is stored internally as double, but may be set from
Expand Down

0 comments on commit d6e79e8

Please sign in to comment.