From 9ecb71c8dc694c78cc982309e9c3c74032f7be4b Mon Sep 17 00:00:00 2001 From: "Gabriel A. Devenyi" Date: Mon, 2 Dec 2024 14:08:01 -0500 Subject: [PATCH] STYLE: MINCIO and TransformMINC Swap snakecase for CamelCase --- Modules/IO/MINC/include/itkMINCImageIO.h | 8 ++++---- Modules/IO/MINC/src/itkMINCImageIO.cxx | 17 +++++++++-------- Modules/IO/MINC/test/itkMINCImageIOTest4.cxx | 4 ++-- .../TransformMINC/include/itkMINCTransformIO.h | 8 ++++---- .../TransformMINC/src/itkMINCTransformIO.cxx | 18 +++++++++--------- .../test/itkIOTransformMINCTest.cxx | 14 +++++++------- .../test/itkMINCTransformAdapterTest.cxx | 4 ++-- 7 files changed, 37 insertions(+), 36 deletions(-) diff --git a/Modules/IO/MINC/include/itkMINCImageIO.h b/Modules/IO/MINC/include/itkMINCImageIO.h index 33f365759d49..822b45355675 100644 --- a/Modules/IO/MINC/include/itkMINCImageIO.h +++ b/Modules/IO/MINC/include/itkMINCImageIO.h @@ -124,9 +124,9 @@ class ITKIOMINC_EXPORT MINCImageIO : public ImageIOBase Write(const void * buffer) override; /** Set to automatically convert from PositiveCoordinateOrientation RAS to PositiveCoordinateOrientation LPS*/ - itkSetMacro(RAS_to_LPS, bool); - itkGetConstMacro(RAS_to_LPS, bool); - itkBooleanMacro(RAS_to_LPS); + itkSetMacro(RAStoLPS, bool); + itkGetConstMacro(RAStoLPS, bool); + itkBooleanMacro(RAStoLPS); protected: MINCImageIO(); @@ -158,7 +158,7 @@ class ITKIOMINC_EXPORT MINCImageIO : public ImageIOBase // complex type images, composed of complex numbers // int m_Complex; - bool m_RAS_to_LPS; + bool m_RAStoLPS; }; } // end namespace itk diff --git a/Modules/IO/MINC/src/itkMINCImageIO.cxx b/Modules/IO/MINC/src/itkMINCImageIO.cxx index 72ff39df418b..5a2fccb1223c 100644 --- a/Modules/IO/MINC/src/itkMINCImageIO.cxx +++ b/Modules/IO/MINC/src/itkMINCImageIO.cxx @@ -238,7 +238,7 @@ MINCImageIO::CloseVolume() MINCImageIO::MINCImageIO() : m_MINCPImpl(std::make_unique()) - , m_RAS_to_LPS(ITK_MINC_IO_RAS_TO_LPS) + , m_RAStoLPS(ITK_MINC_IO_RAS_TO_LPS) { for (auto & dimensionIndex : m_MINCPImpl->m_DimensionIndices) { @@ -287,7 +287,7 @@ MINCImageIO::PrintSelf(std::ostream & os, Indent indent) const os << indent << "MINCPImpl: " << m_MINCPImpl.get() << std::endl; os << indent << "DirectionCosines: " << m_DirectionCosines << std::endl; - os << indent << "RAS_to_LPS: " << m_RAS_to_LPS << std::endl; + os << indent << "RAStoLPS: " << m_RAStoLPS << std::endl; } void @@ -519,7 +519,7 @@ MINCImageIO::ReadImageInformation() // Transform MINC PositiveCoordinateOrientation RAS coordinates to // internal ITK PositiveCoordinateOrientation LPS Coordinates - if (this->m_RAS_to_LPS) + if (this->m_RAStoLPS) dir_cos = RAS_tofrom_LPS * dir_cos; // Transform origin coordinates @@ -695,8 +695,9 @@ MINCImageIO::ReadImageInformation() std::string classname(GetNameOfClass()); // EncapsulateMetaData(thisDic,ITK_InputFilterName, // classname); - // preserve information if the volume was PositiveCoordinateOrientation RAS to PositiveCoordinateOrientation LPS converted - EncapsulateMetaData(thisDic, "RAS_to_LPS", m_RAS_to_LPS); + // preserve information if the volume was PositiveCoordinateOrientation RAS to PositiveCoordinateOrientation LPS + // converted + EncapsulateMetaData(thisDic, "RAStoLPS", m_RAStoLPS); // store history size_t minc_history_length = 0; @@ -1008,7 +1009,7 @@ MINCImageIO::WriteImageInformation() // Convert ITK direction cosines from PositiveCoordinateOrientation LPS to PositiveCoordinateOrientation RAS - if (this->m_RAS_to_LPS) + if (this->m_RAStoLPS) dircosmatrix *= RAS_tofrom_LPS; for (unsigned int i = 0; i < nDims; ++i) @@ -1345,8 +1346,8 @@ MINCImageIO::WriteImageInformation() // preserve information of MINC PositiveCoordinateOrientation RAS to ITK PositiveCoordinateOrientation LPS conversion { - int tmp = (int)this->m_RAS_to_LPS; - miset_attr_values(m_MINCPImpl->m_Volume, MI_TYPE_INT, "itk", "RAS_to_LPS", 1, &tmp); + int tmp = (int)this->m_RAStoLPS; + miset_attr_values(m_MINCPImpl->m_Volume, MI_TYPE_INT, "itk", "RAStoLPS", 1, &tmp); } mifree_volume_props(hprops); diff --git a/Modules/IO/MINC/test/itkMINCImageIOTest4.cxx b/Modules/IO/MINC/test/itkMINCImageIOTest4.cxx index 20433076a596..abca2e3ff2ef 100644 --- a/Modules/IO/MINC/test/itkMINCImageIOTest4.cxx +++ b/Modules/IO/MINC/test/itkMINCImageIOTest4.cxx @@ -49,7 +49,7 @@ test_image_moments(const char * input_image, } itk::MINCImageIO::Pointer mincIO1 = itk::MINCImageIO::New(); - mincIO1->SetRAS_to_LPS(ras_to_lps); + mincIO1->SetRAStoLPS(ras_to_lps); using ReaderType = itk::ImageFileReader; @@ -103,7 +103,7 @@ test_image_moments(const char * input_image, auto writer = WriterType::New(); writer->SetFileName(output_image); // writer should use default RAS to LPS flag, to satisfy comparison after - mincIO1->SetRAS_to_LPS(ras_to_lps); + mincIO1->SetRAStoLPS(ras_to_lps); if (itksys::SystemTools::StringEndsWith(output_image, ".mnc")) // HACK to enable use .mhd files writer->SetImageIO(mincIO1); diff --git a/Modules/IO/TransformMINC/include/itkMINCTransformIO.h b/Modules/IO/TransformMINC/include/itkMINCTransformIO.h index 8666e9e239dc..1579d4362960 100644 --- a/Modules/IO/TransformMINC/include/itkMINCTransformIO.h +++ b/Modules/IO/TransformMINC/include/itkMINCTransformIO.h @@ -83,9 +83,9 @@ class ITK_TEMPLATE_EXPORT MINCTransformIOTemplate : public TransformIOBaseTempla Write() override; /** Set to automatically convert from RAS PositiveCoordinateOrientation to LPS PositiveCoordinateOrientation*/ - itkSetMacro(RAS_to_LPS, bool); - itkGetConstMacro(RAS_to_LPS, bool); - itkBooleanMacro(RAS_to_LPS); + itkSetMacro(RAStoLPS, bool); + itkGetConstMacro(RAStoLPS, bool); + itkBooleanMacro(RAStoLPS); protected: MINCTransformIOTemplate(); @@ -106,7 +106,7 @@ class ITK_TEMPLATE_EXPORT MINCTransformIOTemplate : public TransformIOBaseTempla void ReadOneTransform(VIO_General_transform * xfm); - bool m_RAS_to_LPS; + bool m_RAStoLPS; }; /** This helps to meet backward compatibility */ diff --git a/Modules/IO/TransformMINC/src/itkMINCTransformIO.cxx b/Modules/IO/TransformMINC/src/itkMINCTransformIO.cxx index aaeaaa98ff5a..ad39250f6e85 100644 --- a/Modules/IO/TransformMINC/src/itkMINCTransformIO.cxx +++ b/Modules/IO/TransformMINC/src/itkMINCTransformIO.cxx @@ -43,7 +43,7 @@ namespace itk template MINCTransformIOTemplate::MINCTransformIOTemplate() : m_XFM_initialized(false) - , m_RAS_to_LPS(ITK_MINC_IO_RAS_TO_LPS) + , m_RAStoLPS(ITK_MINC_IO_RAS_TO_LPS) {} template @@ -120,7 +120,7 @@ MINCTransformIOTemplate::ReadOneTransform(VIO_General_tran _affine_transform(3, j) = Transform_elem(*lin, j, 3); } - if (this->m_RAS_to_LPS) // flip RAS PositiveCoordinateOrientation to LPS PositiveCoordinateOrientation + if (this->m_RAStoLPS) // flip RAS PositiveCoordinateOrientation to LPS PositiveCoordinateOrientation _affine_transform = RAS_tofrom_LPS * _affine_transform * RAS_tofrom_LPS; for (int j = 0; j < 3; ++j) @@ -172,7 +172,7 @@ MINCTransformIOTemplate::ReadOneTransform(VIO_General_tran const OutputPixelType RAS_tofrom_LPS_vector = { -1, -1, 1 }; auto mincIO = MINCImageIO::New(); - mincIO->SetRAS_to_LPS(this->m_RAS_to_LPS); + mincIO->SetRAStoLPS(this->m_RAStoLPS); auto reader = MincReaderType::New(); reader->SetImageIO(mincIO); @@ -181,7 +181,7 @@ MINCTransformIOTemplate::ReadOneTransform(VIO_General_tran typename GridImageType::Pointer grid = reader->GetOutput(); typename GridImageType::Pointer LPSgrid = GridImageType::New(); - if (this->m_RAS_to_LPS) + if (this->m_RAStoLPS) { LPSgrid->CopyInformation(grid); LPSgrid->SetRegions(grid->GetBufferedRegion()); @@ -211,14 +211,14 @@ MINCTransformIOTemplate::ReadOneTransform(VIO_General_tran auto * gridTransform = static_cast(transform.GetPointer()); if (xfm->inverse_flag) // TODO: invert grid transform? { - if (this->m_RAS_to_LPS) + if (this->m_RAStoLPS) gridTransform->SetInverseDisplacementField(LPSgrid); else gridTransform->SetInverseDisplacementField(grid); } else { - if (this->m_RAS_to_LPS) + if (this->m_RAStoLPS) gridTransform->SetDisplacementField(LPSgrid); else gridTransform->SetDisplacementField(grid); @@ -306,7 +306,7 @@ MINCTransformIOTemplate::WriteOneTransform(const int _affine_transform(3, j) = offset[j]; } - if (this->m_RAS_to_LPS) + if (this->m_RAStoLPS) _affine_transform = RAS_tofrom_LPS * _affine_transform * RAS_tofrom_LPS; for (int j = 0; j < 3; ++j) @@ -340,7 +340,7 @@ MINCTransformIOTemplate::WriteOneTransform(const int auto mincIO = MINCImageIO::New(); // writer should follow the same notation, in case we manually switched the coordinate system - mincIO->SetRAS_to_LPS(this->m_RAS_to_LPS); + mincIO->SetRAStoLPS(this->m_RAStoLPS); auto writer = MincWriterType::New(); @@ -361,7 +361,7 @@ MINCTransformIOTemplate::WriteOneTransform(const int itkExceptionMacro("Trying to write-out displacement transform without displacement field"); } - if (this->m_RAS_to_LPS) + if (this->m_RAStoLPS) { typename GridImageType::Pointer ras_grid = GridImageType::New(); // flipped grid for RAS->LPS conversion ras_grid->CopyInformation(grid); diff --git a/Modules/IO/TransformMINC/test/itkIOTransformMINCTest.cxx b/Modules/IO/TransformMINC/test/itkIOTransformMINCTest.cxx index 466df17e6da9..64c7a946472f 100644 --- a/Modules/IO/TransformMINC/test/itkIOTransformMINCTest.cxx +++ b/Modules/IO/TransformMINC/test/itkIOTransformMINCTest.cxx @@ -94,7 +94,7 @@ check_linear(const char * linear_transform, bool ras_to_lps) TransformFileWriter::Pointer writer; TransformFileReader::Pointer reader; MINCTransformIO::Pointer mincIO = MINCTransformIO::New(); - mincIO->SetRAS_to_LPS(ras_to_lps); + mincIO->SetRAStoLPS(ras_to_lps); reader = TransformFileReader::New(); writer = TransformFileWriter::New(); @@ -212,7 +212,7 @@ check_nonlinear_double(const char * nonlinear_transform, bool ras_to_lps) TransformFileWriter::Pointer nlwriter; TransformFileReader::Pointer nlreader; MINCTransformIO::Pointer mincIO = MINCTransformIO::New(); - mincIO->SetRAS_to_LPS(ras_to_lps); + mincIO->SetRAStoLPS(ras_to_lps); nlreader = TransformFileReader::New(); nlwriter = TransformFileWriter::New(); @@ -352,7 +352,7 @@ check_nonlinear_float(const char * nonlinear_transform, bool ras_to_lps) nlwriter = TransformFileWriterFloat::New(); MINCTransformIOFloat::Pointer mincIO = MINCTransformIOFloat::New(); - mincIO->SetRAS_to_LPS(ras_to_lps); + mincIO->SetRAStoLPS(ras_to_lps); nlreader->SetTransformIO(mincIO); nlwriter->SetTransformIO(mincIO); @@ -441,7 +441,7 @@ secondTest(bool ras_to_lps) TransformFileReader::Pointer reader; reader = TransformFileReader::New(); MINCTransformIO::Pointer mincIO = MINCTransformIO::New(); - mincIO->SetRAS_to_LPS(ras_to_lps); + mincIO->SetRAStoLPS(ras_to_lps); reader->SetTransformIO(mincIO); reader->SetFileName("Rotation.xfm"); reader->Update(); @@ -496,7 +496,7 @@ check_composite(const char * transform_file, bool ras_to_lps) TransformFileReader::Pointer reader; MINCTransformIO::Pointer mincIO = MINCTransformIO::New(); - mincIO->SetRAS_to_LPS(ras_to_lps); + mincIO->SetRAStoLPS(ras_to_lps); reader = TransformFileReader::New(); writer = TransformFileWriter::New(); @@ -622,7 +622,7 @@ check_composite2(const char * transform_file, const char * transform_grid_file, auto writer = MincWriterType::New(); auto mincImageIO = itk::MINCImageIO::New(); - mincImageIO->SetRAS_to_LPS(false); + mincImageIO->SetRAStoLPS(false); writer->SetImageIO(mincImageIO); @@ -640,7 +640,7 @@ check_composite2(const char * transform_file, const char * transform_grid_file, reader = TransformFileReader::New(); MINCTransformIO::Pointer mincIO = MINCTransformIO::New(); - mincIO->SetRAS_to_LPS(ras_to_lps); + mincIO->SetRAStoLPS(ras_to_lps); reader->SetTransformIO(mincIO); reader->SetFileName(transform_file); diff --git a/Modules/IO/TransformMINC/test/itkMINCTransformAdapterTest.cxx b/Modules/IO/TransformMINC/test/itkMINCTransformAdapterTest.cxx index 59319f00a186..493dd8ce04ff 100644 --- a/Modules/IO/TransformMINC/test/itkMINCTransformAdapterTest.cxx +++ b/Modules/IO/TransformMINC/test/itkMINCTransformAdapterTest.cxx @@ -85,7 +85,7 @@ compare_linear(const char * linear_transform) itk::TransformFileWriter::Pointer writer; itk::MINCTransformIO::Pointer mincIO = itk::MINCTransformIO::New(); // MINC standard is always LPS - mincIO->SetRAS_to_LPS(false); + mincIO->SetRAStoLPS(false); writer = itk::TransformFileWriter::New(); writer->SetTransformIO(mincIO); @@ -186,7 +186,7 @@ compare_nonlinear_double(const char * nonlinear_transform) itk::TransformFileWriter::Pointer nlwriter; itk::MINCTransformIO::Pointer mincIO = itk::MINCTransformIO::New(); // MINC standard is always LPS - mincIO->SetRAS_to_LPS(false); + mincIO->SetRAStoLPS(false); nlwriter = itk::TransformFileWriter::New(); nlwriter->SetTransformIO(mincIO);