Skip to content

Commit

Permalink
COMP: Remove compiler warning of 'nodiscard' function
Browse files Browse the repository at this point in the history
Prefer inintialization to assignment.

Ignoring return value of function declared with 'nodiscard' attribute
  • Loading branch information
hjmjohnson committed Nov 25, 2024
1 parent 6ec1086 commit fe6f474
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
4 changes: 1 addition & 3 deletions include/itkConfidenceConnectedSegmentationModule.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,9 @@ ConfidenceConnectedSegmentationModule<NDimension>::GenerateData()

const LandmarkPointListType & points = inputSeeds->GetPoints();

IndexType index;

for (unsigned int i = 0; i < numberOfPoints; i++)
{
featureImage->TransformPhysicalPointToIndex(points[i].GetPositionInObjectSpace(), index);
const IndexType index = featureImage->TransformPhysicalPointToIndex(points[i].GetPositionInObjectSpace());
filter->AddSeed(index);
}

Expand Down
4 changes: 1 addition & 3 deletions include/itkConnectedThresholdSegmentationModule.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,9 @@ ConnectedThresholdSegmentationModule<NDimension>::GenerateData()

const LandmarkPointListType & points = inputSeeds->GetPoints();

IndexType index;

for (unsigned int i = 0; i < numberOfPoints; i++)
{
featureImage->TransformPhysicalPointToIndex(points[i].GetPositionInObjectSpace(), index);
const IndexType index = featureImage->TransformPhysicalPointToIndex(points[i].GetPositionInObjectSpace());
filter->AddSeed(index);
}

Expand Down
3 changes: 1 addition & 2 deletions include/itkFastMarchingSegmentationModule.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,10 @@ FastMarchingSegmentationModule<NDimension>::GenerateData()

const LandmarkPointListType & points = inputSeeds->GetPoints();

IndexType index;

for (unsigned int i = 0; i < numberOfPoints; i++)
{
featureImage->TransformPhysicalPointToIndex(points[i].GetPositionInObjectSpace(), index);
const IndexType index = featureImage->TransformPhysicalPointToIndex(points[i].GetPositionInObjectSpace());

NodeType node;

Expand Down
4 changes: 1 addition & 3 deletions src/itkImageReadRegionOfInterestAroundSeedWrite.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ main(int argc, char ** argv)

const InputImageType * inputImage = reader->GetOutput();

InputImageType::IndexType centralIndex;

inputImage->TransformPhysicalPointToIndex(seedPoint, centralIndex);
InputImageType::IndexType centralIndex = inputImage->TransformPhysicalPointToIndex(seedPoint);

InputImageType::SpacingType spacing = inputImage->GetSpacing();

Expand Down

0 comments on commit fe6f474

Please sign in to comment.