Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Move InputSpaceName, OutputSpaceName from Transform to Transform… #4734

Conversation

thewtex
Copy link
Member

@thewtex thewtex commented Jun 19, 2024

…Base

These were added to support features of the OME-Zarr transform proposals. However, they need to be available in itk::TransformBase instead of itk::Transform for access in TransformIO classes.

@github-actions github-actions bot added type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct area:Core Issues affecting the Core module area:IO Issues affecting the IO module type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots labels Jun 19, 2024
@thewtex thewtex force-pushed the transform-base-dimension-name branch from 067b56e to 00456a6 Compare June 19, 2024 20:12
Copy link
Contributor

@PranjalSahu PranjalSahu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@N-Dekker
Copy link
Contributor

N-Dekker commented Jun 20, 2024

Thanks Matt! It looks fine to me, to move those two data members from itk::Transform<TParametersValueType, VInputDimension, VOutputDimension> to itk::TransformBase. Especially because they don't depend on VInputDimension or VOutputDimension anyway. 👍 By the way, I would call it an ENH, rather than a BUG.

Of course I would have liked to see unit tests of the form:

    itk::TransformBase & transformBase = ...; // Arrange
    transformBase.SetInputSpaceName(exampleSpaceName); // Act
    EXPECT_EQ(transformBase.GetInputSpaceName(), exampleSpaceName); // Assert

Following the AAA pattern: Arrange-Act-Assert. Maybe to consider for a follow-up....?


Update: I see now that such unit tests are already there (albeit in the old-style test framework, rather than my favorite GoogleTest), as added by @PranjalSahu:

transform->SetInputSpaceName("test_inputspace");
ITK_TEST_EXPECT_EQUAL(std::string("test_inputspace"), transform->GetInputSpaceName());
transform->SetOutputSpaceName("test_outputspace");
ITK_TEST_EXPECT_EQUAL(std::string("test_outputspace"), transform->GetOutputSpaceName());

    transform->SetInputSpaceName("test_inputspace");
    ITK_TEST_EXPECT_EQUAL(std::string("test_inputspace"), transform->GetInputSpaceName());

    transform->SetOutputSpaceName("test_outputspace");
    ITK_TEST_EXPECT_EQUAL(std::string("test_outputspace"), transform->GetOutputSpaceName());

For this pull request, I think it would be sufficient to add itk::TransformBase:: as follows:

    transform->itk::TransformBase::SetInputSpaceName("test_inputspace");
    ITK_TEST_EXPECT_EQUAL(std::string("test_inputspace"), transform->itk::TransformBase::GetInputSpaceName());

    transform->itk::TransformBase::SetOutputSpaceName("test_outputspace");
    ITK_TEST_EXPECT_EQUAL(std::string("test_outputspace"), transform->itk::TransformBase::GetOutputSpaceName());

Copy link
Contributor

@N-Dekker N-Dekker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One little request! Please declare those two data members private! They were originally private already!

@blowekamp
Copy link
Member

Any consideration for putting these into the meta-data dictionary over member variables? Would we get serialization for free with any transform IO's if we did that?

@N-Dekker
Copy link
Contributor

N-Dekker commented Jun 20, 2024

Any consideration for putting these into the meta-data dictionary over member variables?

I guess, the question could be, are these "space names" fundamental general properties of any transform, or are they very much application specific? (In the latter case, I guess it would be better to have them as meta-data dictionary entries, rather than member variables.)

Having said so, the decision was made already almost two years ago, by adding them to itk::Transform: pull request #3470 commit 0575485. So maybe it's best to just leave them as member variables now 🤷

@blowekamp
Copy link
Member

Having said so, the decision was made already almost two years ago, by adding them to itk::Transform: pull request #3470 commit 0575485. So maybe it's best to just leave them as member variables now 🤷

They could still have setter and getter member functions even if they are in the meta-data dictionary. It is more of a question if having them in the dictionary would make serialization easier.

Yes, this question is incidental to the intent of this PR.

…Base

These were added to support features of the OME-Zarr transform
proposals. However, they need to be available in itk::TransformBase
instead of itk::Transform for access in TransformIO classes.
@thewtex thewtex force-pushed the transform-base-dimension-name branch from 00456a6 to 107e3ad Compare June 20, 2024 19:09
@github-actions github-actions bot removed the type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots label Jun 20, 2024
@thewtex
Copy link
Member Author

thewtex commented Jun 20, 2024

Thanks for the reviews.

@N-Dekker I added the extra coverage requested.

Regarding metadata vs member, I think member is more appropriate in this case: this is an explicit property that we want all tooling / IO to eventually interpret and the explicit interface is helpful. In practice it is easier to work with, including for IO, when the explicit interface is available.

@thewtex thewtex requested a review from N-Dekker June 20, 2024 19:14
Copy link
Contributor

@N-Dekker N-Dekker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing my comments, Matt! Approved 👍

@thewtex thewtex merged commit 0d8a535 into InsightSoftwareConsortium:release-5.4 Jun 21, 2024
13 checks passed
@thewtex thewtex deleted the transform-base-dimension-name branch June 21, 2024 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:Core Issues affecting the Core module area:IO Issues affecting the IO module type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants