Skip to content

Commit

Permalink
Rename Given.. to InputCoordinateOrientation
Browse files Browse the repository at this point in the history
The name change reflects that the user can not set this variable and
it is derived from the Input of the filter.
  • Loading branch information
blowekamp committed Mar 16, 2020
1 parent 9a74379 commit 455c241
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions include/itkDICOMOrientImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class ITK_TEMPLATE_EXPORT DICOMOrientImageFilter : public ImageToImageFilter<TIn
/** Get the orientation codes that defines the input coordinate transform.
*
* This value changed during the execution of the Update in the pipeline. */
itkGetEnumMacro(GivenCoordinateOrientation, OrientationEnum);
itkGetEnumMacro(InputCoordinateOrientation, OrientationEnum);

itkGetEnumMacro(DesiredCoordinateOrientation, OrientationEnum);
void
Expand Down Expand Up @@ -257,7 +257,7 @@ class ITK_TEMPLATE_EXPORT DICOMOrientImageFilter : public ImageToImageFilter<TIn


void
SetGivenCoordinateOrientation(OrientationEnum newCode);
SetInputCoordinateOrientation(OrientationEnum newCode);


/** Single-threaded version of GenerateData. This filter delegates
Expand All @@ -279,7 +279,7 @@ class ITK_TEMPLATE_EXPORT DICOMOrientImageFilter : public ImageToImageFilter<TIn
m_StringToCode[str] = code;
}

OrientationEnum m_GivenCoordinateOrientation{ OrientationEnum::LPS };
OrientationEnum m_InputCoordinateOrientation{ OrientationEnum::LPS };
OrientationEnum m_DesiredCoordinateOrientation{ OrientationEnum::LPS };
bool m_UseImageDirection{ true };

Expand Down
14 changes: 7 additions & 7 deletions include/itkDICOMOrientImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,11 @@ DICOMOrientImageFilter<TInputImage>::DeterminePermutationsAndFlips(const Orienta

template <typename TInputImage>
void
DICOMOrientImageFilter<TInputImage>::SetGivenCoordinateOrientation(OrientationEnum newCode)
DICOMOrientImageFilter<TInputImage>::SetInputCoordinateOrientation(OrientationEnum newCode)
{
m_GivenCoordinateOrientation = newCode;
m_InputCoordinateOrientation = newCode;

this->DeterminePermutationsAndFlips(m_DesiredCoordinateOrientation, m_GivenCoordinateOrientation);
this->DeterminePermutationsAndFlips(m_DesiredCoordinateOrientation, m_InputCoordinateOrientation);
}

template <typename TInputImage>
Expand All @@ -254,7 +254,7 @@ DICOMOrientImageFilter<TInputImage>::SetDesiredCoordinateOrientation(Orientation
if (m_DesiredCoordinateOrientation != newCode)
{
m_DesiredCoordinateOrientation = newCode;
this->DeterminePermutationsAndFlips(m_DesiredCoordinateOrientation, m_GivenCoordinateOrientation);
this->DeterminePermutationsAndFlips(m_DesiredCoordinateOrientation, m_InputCoordinateOrientation);
this->Modified();
}
}
Expand Down Expand Up @@ -394,7 +394,7 @@ DICOMOrientImageFilter<TInputImage>::GenerateOutputInformation()
if (m_UseImageDirection)
{
// Compute the GivenOrientation from the image's direction cosines
this->SetGivenCoordinateOrientation(Self::DirectionCosinesToOrientation(inputPtr->GetDirection()));
this->SetInputCoordinateOrientation(Self::DirectionCosinesToOrientation(inputPtr->GetDirection()));
}

using PermuteFilterType = PermuteAxesImageFilter<ImageType>;
Expand Down Expand Up @@ -424,8 +424,8 @@ DICOMOrientImageFilter<TInputImage>::PrintSelf(std::ostream & os, Indent indent)
auto axes = m_CodeToString.find(m_DesiredCoordinateOrientation);
os << indent << "Desired Coordinate Orientation: " << static_cast<long>(this->GetDesiredCoordinateOrientation())
<< " (" << (*axes).second << ")" << std::endl;
axes = m_CodeToString.find(m_GivenCoordinateOrientation);
os << indent << "Given Coordinate Orientation: " << static_cast<long>(this->GetGivenCoordinateOrientation()) << " ("
axes = m_CodeToString.find(m_InputCoordinateOrientation);
os << indent << "Given Coordinate Orientation: " << static_cast<long>(this->GetInputCoordinateOrientation()) << " ("
<< (*axes).second << ")" << std::endl;
os << indent << "Use Image Direction: " << m_UseImageDirection << std::endl;
os << indent << "Permute Axes: " << m_PermuteOrder << std::endl;
Expand Down
36 changes: 18 additions & 18 deletions test/itkDICOMOrientImageFilterGTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ TEST(DICOMOrientImageFilter, Streaming)

CheckImage(sourceFilter->GetOutput(), filter->GetOutput());
EXPECT_EQ(filter->GetOutput()->GetBufferedRegion().GetSize(), itk::Size<3>({ { 1, 2, 3 } }));
EXPECT_EQ(filter->GetGivenCoordinateOrientation(), OrientFilterType::OrientationEnum::RAS);
EXPECT_EQ(filter->GetInputCoordinateOrientation(), OrientFilterType::OrientationEnum::RAS);
EXPECT_EQ(filter->GetPermuteOrder(), PermuiteArrayType({ { 0, 1, 2 } }));
EXPECT_EQ(filter->GetFlipAxes(), FlipArrayType({ { 1, 1, 0 } }));
{
Expand Down Expand Up @@ -124,7 +124,7 @@ TEST(DICOMOrientImageFilter, Values)
CheckImage(sourceFilter->GetOutput(), filter->GetOutput());

EXPECT_EQ(filter->GetDesiredCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetGivenCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetInputCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetPermuteOrder(), PermuiteArrayType({ { 0, 1, 2 } }));
EXPECT_EQ(filter->GetFlipAxes(), FlipArrayType({ { 0, 0, 0 } }));
{
Expand All @@ -139,7 +139,7 @@ TEST(DICOMOrientImageFilter, Values)
CheckImage(sourceFilter->GetOutput(), filter->GetOutput());

EXPECT_EQ(filter->GetDesiredCoordinateOrientation(), OrientFilterType::OrientationEnum::RAS);
EXPECT_EQ(filter->GetGivenCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetInputCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetPermuteOrder(), PermuiteArrayType({ { 0, 1, 2 } }));
EXPECT_EQ(filter->GetFlipAxes(), FlipArrayType({ { 1, 1, 0 } }));
{
Expand All @@ -155,13 +155,13 @@ TEST(DICOMOrientImageFilter, Values)
filter->UpdateLargestPossibleRegion();
CheckImage(sourceFilter->GetOutput(), filter->GetOutput());
EXPECT_EQ(filter->GetDesiredCoordinateOrientation(), OrientFilterType::OrientationEnum::RIP);
EXPECT_EQ(filter->GetGivenCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetInputCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);

filter->SetDesiredCoordinateOrientation(OrientFilterType::OrientationEnum::LIA);
filter->UpdateLargestPossibleRegion();
CheckImage(sourceFilter->GetOutput(), filter->GetOutput());
EXPECT_EQ(filter->GetDesiredCoordinateOrientation(), OrientFilterType::OrientationEnum::LIA);
EXPECT_EQ(filter->GetGivenCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetInputCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetPermuteOrder(), PermuiteArrayType({ { 0, 2, 1 } }));
EXPECT_EQ(filter->GetFlipAxes(), FlipArrayType({ { 0, 1, 1 } }));
{
Expand All @@ -177,76 +177,76 @@ TEST(DICOMOrientImageFilter, Values)
filter->UpdateLargestPossibleRegion();
CheckImage(sourceFilter->GetOutput(), filter->GetOutput());
EXPECT_EQ(filter->GetDesiredCoordinateOrientation(), OrientFilterType::OrientationEnum::IRP);
EXPECT_EQ(filter->GetGivenCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetInputCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetPermuteOrder(), PermuiteArrayType({ { 2, 0, 1 } }));
EXPECT_EQ(filter->GetFlipAxes(), FlipArrayType({ { 1, 1, 0 } }));

filter->SetDesiredCoordinateOrientation(OrientFilterType::OrientationEnum::SLA);
filter->UpdateLargestPossibleRegion();
CheckImage(sourceFilter->GetOutput(), filter->GetOutput());
EXPECT_EQ(filter->GetDesiredCoordinateOrientation(), OrientFilterType::OrientationEnum::SLA);
EXPECT_EQ(filter->GetGivenCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetInputCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetPermuteOrder(), PermuiteArrayType({ { 2, 0, 1 } }));
EXPECT_EQ(filter->GetFlipAxes(), FlipArrayType({ { 0, 0, 1 } }));

filter->SetDesiredCoordinateOrientation(OrientFilterType::OrientationEnum::RPI);
filter->UpdateLargestPossibleRegion();
CheckImage(sourceFilter->GetOutput(), filter->GetOutput());
EXPECT_EQ(filter->GetGivenCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetInputCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetPermuteOrder(), PermuiteArrayType({ { 0, 1, 2 } }));
EXPECT_EQ(filter->GetFlipAxes(), FlipArrayType({ { 1, 0, 1 } }));

filter->SetDesiredCoordinateOrientation(OrientFilterType::OrientationEnum::LAI);
filter->UpdateLargestPossibleRegion();
CheckImage(sourceFilter->GetOutput(), filter->GetOutput());
EXPECT_EQ(filter->GetGivenCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetInputCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetPermuteOrder(), PermuiteArrayType({ { 0, 1, 2 } }));
EXPECT_EQ(filter->GetFlipAxes(), FlipArrayType({ { 0, 1, 1 } }));

filter->SetDesiredCoordinateOrientation(OrientFilterType::OrientationEnum::LAS);
filter->UpdateLargestPossibleRegion();
CheckImage(sourceFilter->GetOutput(), filter->GetOutput());
EXPECT_EQ(filter->GetGivenCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetInputCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);

filter->SetDesiredCoordinateOrientation(OrientFilterType::OrientationEnum::PRI);
filter->UpdateLargestPossibleRegion();
CheckImage(sourceFilter->GetOutput(), filter->GetOutput());
EXPECT_EQ(filter->GetGivenCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetInputCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);

filter->SetDesiredCoordinateOrientation(OrientFilterType::OrientationEnum::PLS);
filter->UpdateLargestPossibleRegion();
CheckImage(sourceFilter->GetOutput(), filter->GetOutput());
EXPECT_EQ(filter->GetGivenCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetInputCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);

filter->SetDesiredCoordinateOrientation(OrientFilterType::OrientationEnum::ALS);
filter->UpdateLargestPossibleRegion();
CheckImage(sourceFilter->GetOutput(), filter->GetOutput());
EXPECT_EQ(filter->GetGivenCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetInputCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);

filter->SetDesiredCoordinateOrientation(OrientFilterType::OrientationEnum::IPR);
filter->UpdateLargestPossibleRegion();
CheckImage(sourceFilter->GetOutput(), filter->GetOutput());
EXPECT_EQ(filter->GetGivenCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetInputCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);

filter->SetDesiredCoordinateOrientation(OrientFilterType::OrientationEnum::SAL);
filter->UpdateLargestPossibleRegion();
CheckImage(sourceFilter->GetOutput(), filter->GetOutput());
EXPECT_EQ(filter->GetGivenCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetInputCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);

filter->SetDesiredCoordinateOrientation(OrientFilterType::OrientationEnum::PIR);
filter->UpdateLargestPossibleRegion();
CheckImage(sourceFilter->GetOutput(), filter->GetOutput());
EXPECT_EQ(filter->GetGivenCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetInputCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);

filter->SetDesiredCoordinateOrientation(OrientFilterType::OrientationEnum::ASR);
filter->UpdateLargestPossibleRegion();
CheckImage(sourceFilter->GetOutput(), filter->GetOutput());
EXPECT_EQ(filter->GetGivenCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetInputCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);

filter->SetDesiredCoordinateOrientation(OrientFilterType::OrientationEnum::ASL);
filter->UpdateLargestPossibleRegion();
CheckImage(sourceFilter->GetOutput(), filter->GetOutput());
EXPECT_EQ(filter->GetGivenCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
EXPECT_EQ(filter->GetInputCoordinateOrientation(), OrientFilterType::OrientationEnum::LPS);
}


Expand Down

0 comments on commit 455c241

Please sign in to comment.