Skip to content

Commit

Permalink
BUG: Let elastix SplitRequestedRegion override ITK's ImageSource
Browse files Browse the repository at this point in the history
Adjusted `ParabolicErodeDilateImageFilter::SplitRequestedRegion` to ensure that its signature matches `ImageSource::SplitRequestedRegion` (again). Following ITK commit InsightSoftwareConsortium/ITK@c701410, June 14, 2011, which modified the signature of `ImageSource::SplitRequestedRegion`, by replacing signed with unsigned integers.

Similar to pull request #1118 commit 34bdc3b "BUG: Let `elx::ConjugateGradientFRPR` override ITK's FRPROptimizer"

Note: This commit changes the behavior (restoring the originally intended behavior), because `ParabolicErodeDilateImageFilter::SplitRequestedRegion` does avoid the current dimension (`m_CurrentDimension`), when setting the `splitAxis`.

Bug found by macos-12/clang `-Woverloaded-virtual` warnings.
  • Loading branch information
N-Dekker committed May 17, 2024
1 parent b3449e2 commit bc1ddf0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Common/itkParabolicErodeDilateImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ class ITK_TEMPLATE_EXPORT ParabolicErodeDilateImageFilter : public ImageToImageF
void
GenerateData() override;

int
SplitRequestedRegion(int i, int num, OutputImageRegionType & splitRegion);
unsigned int
SplitRequestedRegion(unsigned int i, unsigned int num, OutputImageRegionType & splitRegion) override;

void
ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId) override;
Expand Down
8 changes: 4 additions & 4 deletions Common/itkParabolicErodeDilateImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ ParabolicErodeDilateImageFilter<TInputImage, doDilate, TOutputImage>::ParabolicE


template <typename TInputImage, bool doDilate, typename TOutputImage>
int
unsigned int
ParabolicErodeDilateImageFilter<TInputImage, doDilate, TOutputImage>::SplitRequestedRegion(
int i,
int num,
unsigned int i,
unsigned int num,
OutputImageRegionType & splitRegion)
{
// Get the output pointer
Expand Down Expand Up @@ -98,7 +98,7 @@ ParabolicErodeDilateImageFilter<TInputImage, doDilate, TOutputImage>::SplitReque
int maxThreadIdUsed = (int)::ceil(range / (double)valuesPerThread) - 1;

// Split the region
if (i < maxThreadIdUsed)
if (static_cast<intmax_t>(i) < maxThreadIdUsed)
{
splitIndex[splitAxis] += i * valuesPerThread;
splitSize[splitAxis] = valuesPerThread;
Expand Down

0 comments on commit bc1ddf0

Please sign in to comment.