Skip to content

Commit

Permalink
ENH: Update to support ITK >= 5.4 and MetaIO versioning
Browse files Browse the repository at this point in the history
Updated to ITKv5.4 include:
* ITK_NULLPTR -> nullptr
* ITK_OVERRIDE -> override

MetaIO updates include
* use of itksys instead of std for ifstream/ofstream
* use of metaio version 1 features with spatial objects
  • Loading branch information
aylward committed Jun 25, 2024
1 parent 5b9b4d8 commit 2b2135f
Show file tree
Hide file tree
Showing 25 changed files with 192 additions and 527 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ int DoIt( int argc, char * argv[] )
itk::Point<double, VDimension> pnt;
itk::Index< VDimension > indx;
tube->Update();

for( unsigned int i=0; i<tube->GetNumberOfPoints(); i++ )
{
// Get point
Expand All @@ -102,8 +102,13 @@ int DoIt( int argc, char * argv[] )
pnt = tubePoint.GetPositionInWorldSpace();

// Get closest voxel
meanImage->TransformPhysicalPointToIndex( pnt, indx );

bool success = meanImage->TransformPhysicalPointToIndex( pnt, indx );
if( !success )
{
::tube::WarningMessage("Point is outside of image bounds.");
continue;
}

// Write value of ATLAS EMD file at voxel
writeStream << meanImage->GetPixel( indx ) << std::endl;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Append ITK libs
sys.path.append(os.path.join(os.environ['ITK_BUILD_DIR'],
'Wrapping/Generators/Python'))
sys.path.append(os.path.join(os.environ['ITK_BUILD_DIR'], 'lib')
sys.path.append(os.path.join(os.environ['ITK_BUILD_DIR'], 'lib'))

# Append TubeTK libs :
sys.path.append(os.environ['TUBETK_BUILD_DIR'], 'TubeTK-build/lib/TubeTK')
Expand Down
4 changes: 2 additions & 2 deletions include/tubeShrinkImageWithBlending.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ ShrinkImageWithBlending< TInputImage, TOutputImage >
os << indent << "UseLog:"
<< m_Filter->GetUseLog() << std::endl;

if( m_Filter->GetInputMipPointImage() != ITK_NULLPTR )
if( m_Filter->GetInputMipPointImage() != nullptr )
{
os << indent << "Input MIP Point Image: "
<< m_Filter->GetInputMipPointImage() << std::endl;
Expand All @@ -97,7 +97,7 @@ ShrinkImageWithBlending< TInputImage, TOutputImage >
os << indent << "Input MIP Point Image: NULL" << std::endl;
}

if( m_Filter->GetOutputMipPointImage() != ITK_NULLPTR )
if( m_Filter->GetOutputMipPointImage() != nullptr )
{
os << indent << "Output MIP Point Image: "
<< m_Filter->GetOutputMipPointImage() << std::endl;
Expand Down
2 changes: 2 additions & 0 deletions src/Filtering.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

set( TubeTK_Filtering_H_Files
Filtering/itkGeneralizedDistanceTransformImageFilter.h
Filtering/itkImageRegionSplitter.h
Filtering/itktubeAnisotropicCoherenceEnhancingDiffusionImageFilter.h
Filtering/itktubeAnisotropicDiffusionTensorFunction.h
Filtering/itktubeAnisotropicDiffusionTensorImageFilter.h
Expand Down Expand Up @@ -65,6 +66,7 @@ set( TubeTK_Filtering_H_Files

set( TubeTK_Filtering_HXX_Files
Filtering/itkGeneralizedDistanceTransformImageFilter.txx
Filtering/itkImageRegionSplitter.hxx
Filtering/itktubeAnisotropicCoherenceEnhancingDiffusionImageFilter.hxx
Filtering/itktubeAnisotropicDiffusionTensorFunction.hxx
Filtering/itktubeAnisotropicDiffusionTensorImageFilter.hxx
Expand Down
4 changes: 2 additions & 2 deletions src/Filtering/itkImageRegionSplitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class ImageRegionSplitter:public ImageRegionSplitterBase

virtual unsigned int GetNumberOfSplitsInternal( unsigned int,
const IndexValueType regionIndex[], const SizeValueType regionSize[],
unsigned int requestedNumber ) const ITK_OVERRIDE
unsigned int requestedNumber ) const override
{
// this function adapts the legecy method, defined in this class
// be used by the ImageRegionSplitterBase.
Expand All @@ -137,7 +137,7 @@ class ImageRegionSplitter:public ImageRegionSplitterBase
unsigned int i,
unsigned int numberOfPieces,
IndexValueType regionIndex[],
SizeValueType regionSize[] ) const ITK_OVERRIDE
SizeValueType regionSize[] ) const override
{
// this function adapts the legecy method, defined in this class
// be used by the ImageRegionSplitterBase.
Expand Down
6 changes: 3 additions & 3 deletions src/Filtering/itktubeShrinkWithBlendingImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ template< class TInputImage, class TOutputImage >
ShrinkWithBlendingImageFilter< TInputImage, TOutputImage >
::ShrinkWithBlendingImageFilter( void )
{
m_InputMipPointImage = ITK_NULLPTR;
m_OutputMipPointImage = ITK_NULLPTR;
m_InputMipPointImage = nullptr;
m_OutputMipPointImage = nullptr;

m_Overlap.Fill( 0 );

Expand Down Expand Up @@ -357,7 +357,7 @@ ShrinkWithBlendingImageFilter< TInputImage, TOutputImage >
progress.CompletedPixel();
}

if( inputMipPointItPtr != ITK_NULLPTR )
if( inputMipPointItPtr != nullptr )
{
delete inputMipPointItPtr;
}
Expand Down
5 changes: 3 additions & 2 deletions src/IO/itktubePDFSegmenterParzenIO.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ Read( const char * _headerName )
std::cout << "MetaClassPDF: M_SetupReadFields" << std::endl;
}

MetaClassPDF classPDFReader;

std::vector< MET_FieldRecordType * > metaFields;

MET_FieldRecordType * mF;
Expand Down Expand Up @@ -485,6 +483,9 @@ Read( const char * _headerName )
0.005 * spacing[j] )
{
std::cout << "ERROR: Spacing mismatch" << std::endl;
std::cout << " Spacing[" << j << "] = " << spacing[j] << std::endl;
std::cout << " PDFSpacing[" << j << "] = "
<< m_PDFSegmenter->GetBinSize()[j] << std::endl;
for( unsigned int f=0; f<metaFields.size(); ++f )
{
delete metaFields[f];
Expand Down
Loading

0 comments on commit 2b2135f

Please sign in to comment.