Skip to content

Commit 35dd8e8

Browse files
committed
COMP: Fix discarding return value warning introduced by ITK 5.4
Modules/Remote/MinimalPathExtraction/include/itkSpeedFunctionToPathFilter.hxx:239:51: warning: ignoring return value of 'bool itk::ImageBase<VImageDimension>::TransformPhysicalPointToContinuousIndex(const itk::Point<TCoordRep, VImageDimension>&, itk::ContinuousIndex<TIndexRep, VImageDimension>&) const [with TCoordRep = double; TIndexRep = double; unsigned int VImageDimension = 2]', declared with attribute 'nodiscard' [-Wunused-result]
1 parent f042f3e commit 35dd8e8

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

include/itkArrivalFunctionToPathFilter.hxx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,10 @@ ArrivalFunctionToPathFilter<TInputImage, TOutputPath>::Execute(const Object * ob
244244
}
245245

246246
// Convert point to continuous index
247-
InputImagePointer input = const_cast<InputImageType *>(this->GetInput());
248-
ContinuousIndexType cindex;
249-
input->TransformPhysicalPointToContinuousIndex(point, cindex);
247+
InputImagePointer input = const_cast<InputImageType *>(this->GetInput());
248+
const ContinuousIndexType cindex =
249+
input->template TransformPhysicalPointToContinuousIndex<typename ContinuousIndexType::ValueType,
250+
typename PointType::ValueType>(point);
250251

251252
// Add point as vertex in path
252253
typename OutputPathType::Pointer output = this->GetOutput(m_CurrentOutput);

include/itkSpeedFunctionToPathFilter.hxx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ SpeedFunctionToPathFilter<TInputImage, TOutputPath>::ComputeArrivalFunction()
8181

8282
for (auto it = PrevFront.begin(); it != PrevFront.end(); it++)
8383
{
84-
IndexType indexTargetPrevious;
85-
NodeType nodeTargetPrevious;
86-
speed->TransformPhysicalPointToIndex(*it, indexTargetPrevious);
84+
NodeType nodeTargetPrevious;
85+
const IndexType indexTargetPrevious =
86+
speed->template TransformPhysicalPointToIndex<typename PointType::ValueType>(*it);
8787
nodeTargetPrevious.SetValue(0.0);
8888
nodeTargetPrevious.SetIndex(indexTargetPrevious);
8989
targets->InsertElement(0, nodeTargetPrevious);
@@ -92,9 +92,8 @@ SpeedFunctionToPathFilter<TInputImage, TOutputPath>::ComputeArrivalFunction()
9292

9393
for (auto it = NextFront.begin(); it != NextFront.end(); it++)
9494
{
95-
IndexType indexTargetNext;
96-
NodeType nodeTargetNext;
97-
speed->TransformPhysicalPointToIndex(*it, indexTargetNext);
95+
NodeType nodeTargetNext;
96+
const IndexType indexTargetNext = speed->template TransformPhysicalPointToIndex<typename PointType::ValueType>(*it);
9897
nodeTargetNext.SetValue(0.0);
9998
nodeTargetNext.SetIndex(indexTargetNext);
10099
targets->InsertElement(1, nodeTargetNext);
@@ -112,9 +111,8 @@ SpeedFunctionToPathFilter<TInputImage, TOutputPath>::ComputeArrivalFunction()
112111

113112
for (auto it = CurrentFront.begin(); it != CurrentFront.end(); it++)
114113
{
115-
IndexType indexTrial;
116-
NodeType nodeTrial;
117-
speed->TransformPhysicalPointToIndex(*it, indexTrial);
114+
NodeType nodeTrial;
115+
const IndexType indexTrial = speed->template TransformPhysicalPointToIndex<typename PointType::ValueType>(*it);
118116
nodeTrial.SetValue(0.0);
119117
nodeTrial.SetIndex(indexTrial);
120118
trial->InsertElement(0, nodeTrial);
@@ -234,9 +232,10 @@ SpeedFunctionToPathFilter<TInputImage, TOutputPath>::Execute(const Object *
234232
else if (currentValue >= Superclass::m_TerminationValue)
235233
{
236234
// Convert point to continuous index
237-
InputImagePointer input = const_cast<InputImageType *>(this->GetInput());
238-
ContinuousIndexType cindex;
239-
input->TransformPhysicalPointToContinuousIndex(point, cindex);
235+
InputImagePointer input = const_cast<InputImageType *>(this->GetInput());
236+
const ContinuousIndexType cindex =
237+
input->template TransformPhysicalPointToContinuousIndex<typename ContinuousIndexType::ValueType,
238+
typename PointType::ValueType>(point);
240239

241240
// Add point as vertex in path
242241
OutputPathPointer output = this->GetOutput(Superclass::m_CurrentOutput);

0 commit comments

Comments
 (0)