Skip to content

Commit 49ece7f

Browse files
N-Dekkerdzenanz
authored andcommitted
COMP: Fix TransformPhysicalPointToIndex nodiscard warnings
When the `bool` return value of a `TransformPhysicalPointToIndex(point, index)` call can be ignored, it is preferable (for performance reasons) to call the `TransformPhysicalPointToIndex(point)` overload that just returns the index, preventing `[[nodiscard]]` compile warnings. These cases are found in Visual Studio, using the following regular expression: ` [^ ]+->TransformPhysicalPointToIndex\(.*,`
1 parent 639e8ff commit 49ece7f

7 files changed

+7
-11
lines changed

Modules/Nonunit/Review/include/itkMultiphaseDenseFiniteDifferenceImageFilter.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ MultiphaseDenseFiniteDifferenceImageFilter<TInputImage, TFeatureImage, TOutputIm
4949

5050
// Find the index of the target image where this Level Set
5151
// should be pasted.
52-
OutputIndexType start;
53-
output->TransformPhysicalPointToIndex(origin, start);
52+
OutputIndexType start = output->TransformPhysicalPointToIndex(origin);
5453

5554
OutputRegionType region;
5655
region.SetSize(size);

Modules/Nonunit/Review/include/itkMultiphaseSparseFiniteDifferenceImageFilter.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,8 +1353,7 @@ MultiphaseSparseFiniteDifferenceImageFilter<TInputImage, TFeatureImage, TOutputI
13531353
ImageRegionIterator<InputImageType> inIt(this->m_LevelSet[fId], this->m_LevelSet[fId]->GetRequestedRegion());
13541354

13551355
// In the context of the global coordinates
1356-
OutputIndexType start;
1357-
output->TransformPhysicalPointToIndex(origin, start);
1356+
OutputIndexType start = output->TransformPhysicalPointToIndex(origin);
13581357

13591358
// Defining sub-region in the global coordinates
13601359
OutputRegionType region;

Modules/Nonunit/Review/include/itkRegionBasedLevelSetFunctionData.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ RegionBasedLevelSetFunctionData<TInputImage, TFeatureImage>::CreateHeavisideFunc
4646

4747
const InputPointType origin = image->GetOrigin();
4848

49-
this->m_HeavisideFunctionOfLevelSetImage->TransformPhysicalPointToIndex(origin, this->m_Start);
49+
this->m_Start = this->m_HeavisideFunctionOfLevelSetImage->TransformPhysicalPointToIndex(origin);
5050

5151
for (unsigned int i = 0; i < ImageDimension; ++i)
5252
{

Modules/Nonunit/Review/include/itkScalarChanAndVeseDenseLevelSetImageFilter.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ ScalarChanAndVeseDenseLevelSetImageFilter<TInputImage, TFeatureImage, TOutputIma
3333
InputPointType origin = input->GetOrigin();
3434

3535
// In the context of the global coordinates
36-
FeatureIndexType start;
37-
this->GetInput()->TransformPhysicalPointToIndex(origin, start);
36+
FeatureIndexType start = this->GetInput()->TransformPhysicalPointToIndex(origin);
3837

3938
// Defining roi region
4039
FeatureRegionType region;

Modules/Nonunit/Review/include/itkScalarChanAndVeseSparseLevelSetImageFilter.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ ScalarChanAndVeseSparseLevelSetImageFilter<TInputImage, TFeatureImage, TOutputIm
3838
InputPointType origin = input->GetOrigin();
3939

4040
// In the context of the global coordinates
41-
FeatureIndexType start;
42-
this->GetInput()->TransformPhysicalPointToIndex(origin, start);
41+
FeatureIndexType start = this->GetInput()->TransformPhysicalPointToIndex(origin);
4342

4443
// Defining roi region
4544
FeatureRegionType region;

Modules/Registration/FEM/include/itkFEMFiniteDifferenceFunctionLoad.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ FiniteDifferenceFunctionLoad<TMoving, TFixed>::Fe(FEMVectorType Gpos) -> FEMVect
243243
physicalPoint[k] = Gpos[k];
244244
}
245245

246-
m_FixedImage->TransformPhysicalPointToIndex(physicalPoint, oindex);
246+
oindex = m_FixedImage->TransformPhysicalPointToIndex(physicalPoint);
247247

248248
for (unsigned int k = 0; k < ImageDimension; ++k)
249249
{

Modules/Registration/FEM/test/itkFEMFiniteDifferenceFunctionLoadTest.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ RunTest(InputImageType * fixedImage,
316316
{
317317
coords[d] = element->GetNodeCoordinates(n)[d];
318318
}
319-
fixedImage->TransformPhysicalPointToIndex(coords, index);
319+
index = fixedImage->TransformPhysicalPointToIndex(coords);
320320
if (!region.IsInside(index))
321321
{
322322
continue;

0 commit comments

Comments
 (0)