Skip to content

Commit

Permalink
COMP: Address warnings
Browse files Browse the repository at this point in the history
Fixed unused variables, functions hidden by derived classes, and
variable types.

Also fixed lurking bugs related to variables being used before being set.
  • Loading branch information
aylward committed Jun 26, 2024
1 parent 11e35ed commit f7e0820
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 28 deletions.
1 change: 1 addition & 0 deletions src/Filtering/itktubeAnisotropicDiffusionTensorFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ class AnisotropicDiffusionTensorFunction

TimeStepType m_TimeStep;
bool m_UseImageSpacing;
SpacingType m_Spacing{1};

}; // End class AnisotropicDiffusionTensorFunction

Expand Down
3 changes: 3 additions & 0 deletions src/Filtering/itktubeAnisotropicDiffusionTensorFunction.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ AnisotropicDiffusionTensorFunction< TImageType >
{
DiffusionTensorNeighborhoodType tensorNeighborhood;
SpacingType spacing;
spacing = m_Spacing;
return this->ComputeUpdate( neighborhood,
tensorNeighborhood,
spacing,
Expand Down Expand Up @@ -314,6 +315,7 @@ AnisotropicDiffusionTensorFunction<TImageType>
if( useImageSpacing )
{
minSpacing = input->GetSpacing()[0];
m_Spacing = input->GetSpacing();
for( unsigned int i = 1; i < ImageDimension; i++ )
{
if( input->GetSpacing()[i] < minSpacing )
Expand All @@ -325,6 +327,7 @@ AnisotropicDiffusionTensorFunction<TImageType>
else
{
minSpacing = 1.0;
m_Spacing.Fill(1.0);
}

// TODO plus 1?
Expand Down
8 changes: 4 additions & 4 deletions src/Filtering/itktubeShrinkWithBlendingImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ ShrinkWithBlendingImageFilter< TInputImage, TOutputImage >
// We wish to perform the following mapping of outputIndex to
// inputIndex on all points in our region
outputPtr->TransformIndexToPhysicalPoint( outputIndex, tempPoint );
bool isInside = inputPtr->TransformPhysicalPointToIndex( tempPoint, inputIndex );
std::ignore = inputPtr->TransformPhysicalPointToIndex( tempPoint, inputIndex );

// Support progress methods/callbacks
ProgressReporter progress( this, threadId,
Expand Down Expand Up @@ -205,7 +205,7 @@ ShrinkWithBlendingImageFilter< TInputImage, TOutputImage >
curMipPoint[i] = inputMipPointItPtr->Get()[i];
}

isInside = inputPtr->TransformPhysicalPointToIndex( curMipPoint, inputIndex );
std::ignore = inputPtr->TransformPhysicalPointToIndex( curMipPoint, inputIndex );

// set output pixel intensity as intensity of input pixel at mip point
outIt.Set( inputPtr->GetPixel( inputIndex ) );
Expand All @@ -225,7 +225,7 @@ ShrinkWithBlendingImageFilter< TInputImage, TOutputImage >
outputIndex = outIt.GetIndex();

outputPtr->TransformIndexToPhysicalPoint( outputIndex, tempPoint );
isInside = inputPtr->TransformPhysicalPointToIndex( tempPoint, inputIndex );
std::ignore = inputPtr->TransformPhysicalPointToIndex( tempPoint, inputIndex );

for( unsigned int i = 0; i < ImageDimension; ++i )
{
Expand Down Expand Up @@ -484,7 +484,7 @@ ShrinkWithBlendingImageFilter< TInputImage, TOutputImage >

outputPtr->TransformIndexToPhysicalPoint( outputRequestedRegionStartIndex,
tempPoint );
bool isInside = inputPtr->TransformPhysicalPointToIndex( tempPoint,
std::ignore = inputPtr->TransformPhysicalPointToIndex( tempPoint,
inputRequestedRegionStartIndex );
for( unsigned int i = 0; i < TInputImage::ImageDimension; i++ )
{
Expand Down
8 changes: 6 additions & 2 deletions src/Filtering/itktubeSpatialObjectFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,14 @@ class SpatialObjectFilter
SpatialObjectFilter( void );
virtual ~SpatialObjectFilter( void ) {}

// To remove warning "was hidden [-Woverloaded-virtual]"
void SetInput( const typename Superclass::DataObjectIdentifierType &,
// from itkProcessObject
virtual void SetInput( const
itk::ProcessObject::DataObjectIdentifierType &,
itk::DataObject * ) override {};

virtual void SetInput( unsigned int, const SpatialObjectType *
) override {};

private:
// purposely not implemented
SpatialObjectFilter( const Self & );
Expand Down
4 changes: 4 additions & 0 deletions src/Filtering/itktubeSpatialObjectToSpatialObjectFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ class SpatialObjectToSpatialObjectFilter
SpatialObjectToSpatialObjectFilter( void );
virtual ~SpatialObjectToSpatialObjectFilter( void ) {}

// To remove warning "was hidden [-Woverloaded-virtual]"
//void SetInput( const typename Superclass::DataObjectIdentifierType &,
//itk::DataObject * ) override {};

private:
// purposely not implemented
SpatialObjectToSpatialObjectFilter( const Self & );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class SymmetricEigenVectorAnalysisFunction
inline TMatrix operator()( const TInput & x )
{
TOutput eigenValues;
eigenValues.Fill(0);
TMatrix eigenVectorMatrix;
m_Calculator.ComputeEigenValuesAndVectors( x, eigenValues,
eigenVectorMatrix );
Expand Down
5 changes: 1 addition & 4 deletions src/MetaIO/itktubeMetaClassPDF.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ PrintInfo( void ) const
if( ! m_ObjectId.empty() )
{
std::cout << m_ObjectId[0];
for( int i = 1; i < m_ObjectId.size(); i++ )
for( std::vector<double>::size_type i = 1; i < m_ObjectId.size(); i++ )
{
std::cout << ", " << m_ObjectId[i];
}
Expand Down Expand Up @@ -878,9 +878,6 @@ M_Read( void )
}
}

unsigned int nFeatures = static_cast< unsigned int >(
MetaImage::NDims() );

MET_FieldRecordType * mF = MET_GetFieldRecord( "NObjects",
&m_Fields );
unsigned int nObjects = ( unsigned int )mF->value[0];
Expand Down
13 changes: 8 additions & 5 deletions src/ObjectDocuments/itktubeObjectDocumentToImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,16 @@ ObjectDocumentToImageFilter< TObjectDocument, TImageType >
PointType & origin ) const
{
SizeType size = image->GetLargestPossibleRegion().GetSize();
PointType point;
PointType maximum;

// Fill origin ( minimum value with large number ).
origin.Fill( 9999999 );
typename ImageType::IndexType index;
index.Fill(0);
image->TransformIndexToPhysicalPoint( index, point );
point = transform->TransformPoint( point );

origin = point;
maximum = point;

// Transform all of the image corners and determine the minimum bounding
// box.
Expand All @@ -150,14 +156,11 @@ ObjectDocumentToImageFilter< TObjectDocument, TImageType >
{
for( unsigned int z = 0; z <= size[2]; z += size[2] )
{
typename ImageType::IndexType index;

index[0] = x;
index[1] = y;
index[2] = z;

PointType point;

image->TransformIndexToPhysicalPoint( index, point );
point = transform->TransformPoint( point );

Expand Down
5 changes: 0 additions & 5 deletions src/Registration/itkBSplineImageToImageRegistrationMethod.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,6 @@ BSplineImageToImageRegistrationMethod<TImage>
fixedPyramid->SetNumberOfLevels( numberOfLevelsUsing );
movingPyramid->SetNumberOfLevels( numberOfLevelsUsing );

typename ImageType::SpacingType fixedSpacing =
this->GetFixedImage()->GetSpacing();
typename ImageType::SpacingType movingSpacing =
this->GetFixedImage()->GetSpacing();

typename PyramidType::ScheduleType fixedSchedule =
fixedPyramid->GetSchedule();
typename PyramidType::ScheduleType movingSchedule =
Expand Down
4 changes: 2 additions & 2 deletions src/Registration/itktubeMergeAdjacentImagesFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ MergeAdjacentImagesFilter< TImage >
pointX = m_InitialTransform->GetInverseTransform()->TransformPoint( pointX );
}

bool isInside = m_Input1->TransformPhysicalPointToIndex( pointX, minX2 );
std::ignore = m_Input1->TransformPhysicalPointToIndex( pointX, minX2 );

typename ImageType::SizeType size2 =
m_Input2->GetLargestPossibleRegion().GetSize();
Expand All @@ -243,7 +243,7 @@ MergeAdjacentImagesFilter< TImage >
{
pointX = m_InitialTransform->GetInverseTransform()->TransformPoint( pointX );
}
isInside = m_Input1->TransformPhysicalPointToIndex( pointX, maxX2 );
std::ignore = m_Input1->TransformPhysicalPointToIndex( pointX, maxX2 );

// compute min-max coord and size of output
for( unsigned int i = 0; i < ImageDimension; i++ )
Expand Down
1 change: 0 additions & 1 deletion src/Segmentation/itktubeRadiusExtractor2.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ RadiusExtractor2<TInputImage>
int tempI;
while( pntIter != m_KernelTube->GetPoints().end() )
{
IndexType kernelPointI;
if( !m_InputImage->TransformPhysicalPointToIndex(
pntIter->GetPositionInObjectSpace(), kernelPointI ) )
{
Expand Down
2 changes: 1 addition & 1 deletion src/Segmentation/itktubeRadiusExtractor3.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ RadiusExtractor3<TInputImage>
while( pntIter != m_KernelTube->GetPoints().end() )
{
p = pntIter->GetPositionInObjectSpace();
bool isInside = m_InputImage->TransformPhysicalPointToIndex( p, kernelPointIndex );
isInside = m_InputImage->TransformPhysicalPointToIndex( p, kernelPointIndex );
if( !isInside )
{
++pntIter;
Expand Down
1 change: 0 additions & 1 deletion test/Filtering/itktubeSubSampleSpatialObjectFilterTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ int itktubeSubSampleSpatialObjectFilterTest( int argc, char * argv[] )
const char * outputTubeNetwork = argv[2];

enum { Dimension = 3 };
typedef itk::TubeSpatialObject< Dimension > TubeSpatialObjectType;
typedef itk::GroupSpatialObject< Dimension > GroupSpatialObjectType;

// Read input tube tree.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ int itktubeSpatialObjectToImageRegistrationTest( int argc, char * argv[] )
enum { ObjectDimension = 3 };
typedef double FloatType;

typedef itk::TubeSpatialObject< ObjectDimension > TubeType;
typedef itk::GroupSpatialObject< ObjectDimension > GroupType;
typedef itk::SpatialObjectReader< ObjectDimension > SOReaderType;
typedef itk::Image< FloatType, ObjectDimension > ImageType;
Expand Down
4 changes: 2 additions & 2 deletions test/Segmentation/itktubeRidgeExtractorTest2.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ int itktubeRidgeExtractorTest2( int argc, char * argv[] )
if( ridgeOp->LocalRidge( xRidgePnt ) != RidgeOpType::SUCCESS )
{
RidgeOpType::ContinuousIndexType xRidgeContI;
bool isInside = im->TransformPhysicalPointToContinuousIndex( xRidgePnt,
std::ignore = im->TransformPhysicalPointToContinuousIndex( xRidgePnt,
xRidgeContI );
std::cout << "*** FAILURE: Local ridge test failed. No ridge found."
<< std::endl;
Expand All @@ -205,7 +205,7 @@ int itktubeRidgeExtractorTest2( int argc, char * argv[] )
continue;
}
RidgeOpType::ContinuousIndexType xRidgeContI;
bool isInside = im->TransformPhysicalPointToContinuousIndex( xRidgePnt,
std::ignore = im->TransformPhysicalPointToContinuousIndex( xRidgePnt,
xRidgeContI );

double diff = 0;
Expand Down

0 comments on commit f7e0820

Please sign in to comment.