Skip to content

Commit

Permalink
BUG: Use named inputs for LabelOverlapMeasuresImageFilter
Browse files Browse the repository at this point in the history
MTimes where neither modified nor check when setting inputs which
could cause improper pipeline execution.
  • Loading branch information
blowekamp authored and dzenanz committed Aug 2, 2022
1 parent 01bdd31 commit 83480a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,33 +123,12 @@ class ITK_TEMPLATE_EXPORT LabelOverlapMeasuresImageFilter : public ImageToImageF
/** Image related type alias. */
static constexpr unsigned int ImageDimension = TLabelImage::ImageDimension;

/** Set the source image. */
void
SetSourceImage(const LabelImageType * image)
{
this->SetNthInput(0, const_cast<LabelImageType *>(image));
}

/** Set the target image. */
void
SetTargetImage(const LabelImageType * image)
{
this->SetNthInput(1, const_cast<LabelImageType *>(image));
}

/** Get the source image. */
const LabelImageType *
GetSourceImage()
{
return this->GetInput(0);
}
/** Set the label image */
itkSetInputMacro(TargetImage, LabelImageType);
itkGetInputMacro(TargetImage, LabelImageType);
itkSetInputMacro(SourceImage, LabelImageType);
itkGetInputMacro(SourceImage, LabelImageType);

/** Get the target image. */
const LabelImageType *
GetTargetImage()
{
return this->GetInput(1);
}

/** Get the label set measures. */
MapType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ namespace itk
template <typename TLabelImage>
LabelOverlapMeasuresImageFilter<TLabelImage>::LabelOverlapMeasuresImageFilter()
{
Self::SetPrimaryInputName("SourceImage");
Self::AddRequiredInputName("TargetImage", 1);

// This filter requires two input images
this->SetNumberOfRequiredInputs(2);
this->DynamicMultiThreadingOff();
Expand Down

0 comments on commit 83480a0

Please sign in to comment.