Skip to content

Commit

Permalink
STYLE: MINCIO and TransformMINC Swap snakecase for CamelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
gdevenyi committed Dec 2, 2024
1 parent 5a46692 commit 9ecb71c
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 36 deletions.
8 changes: 4 additions & 4 deletions Modules/IO/MINC/include/itkMINCImageIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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

Expand Down
17 changes: 9 additions & 8 deletions Modules/IO/MINC/src/itkMINCImageIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ MINCImageIO::CloseVolume()

MINCImageIO::MINCImageIO()
: m_MINCPImpl(std::make_unique<MINCImageIOPImpl>())
, 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)
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -695,8 +695,9 @@ MINCImageIO::ReadImageInformation()
std::string classname(GetNameOfClass());
// EncapsulateMetaData<std::string>(thisDic,ITK_InputFilterName,
// classname);
// preserve information if the volume was PositiveCoordinateOrientation RAS to PositiveCoordinateOrientation LPS converted
EncapsulateMetaData<bool>(thisDic, "RAS_to_LPS", m_RAS_to_LPS);
// preserve information if the volume was PositiveCoordinateOrientation RAS to PositiveCoordinateOrientation LPS
// converted
EncapsulateMetaData<bool>(thisDic, "RAStoLPS", m_RAStoLPS);

// store history
size_t minc_history_length = 0;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions Modules/IO/MINC/test/itkMINCImageIOTest4.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<ImageType>;

Expand Down Expand Up @@ -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);

Expand Down
8 changes: 4 additions & 4 deletions Modules/IO/TransformMINC/include/itkMINCTransformIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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 */
Expand Down
18 changes: 9 additions & 9 deletions Modules/IO/TransformMINC/src/itkMINCTransformIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace itk
template <typename TParametersValueType>
MINCTransformIOTemplate<TParametersValueType>::MINCTransformIOTemplate()
: m_XFM_initialized(false)
, m_RAS_to_LPS(ITK_MINC_IO_RAS_TO_LPS)
, m_RAStoLPS(ITK_MINC_IO_RAS_TO_LPS)
{}

template <typename TParametersValueType>
Expand Down Expand Up @@ -120,7 +120,7 @@ MINCTransformIOTemplate<TParametersValueType>::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)
Expand Down Expand Up @@ -172,7 +172,7 @@ MINCTransformIOTemplate<TParametersValueType>::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);
Expand All @@ -181,7 +181,7 @@ MINCTransformIOTemplate<TParametersValueType>::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());
Expand Down Expand Up @@ -211,14 +211,14 @@ MINCTransformIOTemplate<TParametersValueType>::ReadOneTransform(VIO_General_tran
auto * gridTransform = static_cast<DisplacementFieldTransformType *>(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);
Expand Down Expand Up @@ -306,7 +306,7 @@ MINCTransformIOTemplate<TParametersValueType>::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)
Expand Down Expand Up @@ -340,7 +340,7 @@ MINCTransformIOTemplate<TParametersValueType>::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();

Expand All @@ -361,7 +361,7 @@ MINCTransformIOTemplate<TParametersValueType>::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);
Expand Down
14 changes: 7 additions & 7 deletions Modules/IO/TransformMINC/test/itkIOTransformMINCTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);


Expand All @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions Modules/IO/TransformMINC/test/itkMINCTransformAdapterTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9ecb71c

Please sign in to comment.