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

Support for fixed-length vectors in SetInput functions of two-steps spectral filters #688

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

cyrilmory
Copy link
Contributor

Support for fixed-length vectors in SetInputMeasuredProjections and SetInputDecomposedProjections functions of Simplex and Forward spectral filters, with a limited number of materials and bins
Adds a test case in rtkDecomposeSpectralProjectionsTest to test this feature

One-step and two-steps spectral filters currently use different
image types internally. To increase their interoperability, they
should also accept in input the type of image they don't use internally.
This commit modifies SetInputDecomposedProjections and
SetInputMeasuredProjections in rtkSpectralForwardModelImageFilter
so that they accept itk::Image<itk::Vector> images (with a limited
number of possible vector lengths).
It also adds a test case in rtkdecomposespectralprojectionstest to test
the modified SetInput functions
Modified the SetInput functions in
rtkSimplexSpectralProjectionsDecompositionImageFilter,
as was done in commit fc16320
for rtkSpectralForwardModelImageFilter.
Updated test case 3 in rtkDecomposeSpectralProjectionsTest
to test those new functions
Copy link
Collaborator

@SimonRit SimonRit left a comment

Choose a reason for hiding this comment

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

It's probably working (I'll check the wrappings by rebasing on master) but I have some questions I'd like to discuss before mergin.

@@ -83,16 +85,29 @@ class ITK_TEMPLATE_EXPORT SimplexSpectralProjectionsDecompositionImageFilter

/** Set/Get the input material-decomposed stack of projections (only used for initialization) */
void
SetInputDecomposedProjections(const DecomposedProjectionsType * DecomposedProjections);
SetInputDecomposedProjections(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't it work if you keep the original

void  SetInputDecomposedProjections(const DecomposedProjectionsType * DecomposedProjections);

separate for clarity?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should. I'll change it.

void
SetInputFixedVectorLengthDecomposedProjections(
const itk::Image<itk::Vector<DecomposedProjectionsDataType, VNumberOfMaterials>,
DecomposedProjectionsType::ImageDimension> * DecomposedProjections);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it accessible from the wrapping? I'll check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does not have to be: SetInputFixedVectorLengthDecomposedProjections is supposed to be accessed only by SetInputDecomposedProjections, once it has determined which vector length to use. The wrappings should only expose SetInputDecomposedProjections

{
this->SetInputFixedVectorLengthDecomposedProjections<5>(ptr5);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe a warning if we don't do anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@SimonRit SimonRit force-pushed the FixedVectorLengthSpectralInputsOverload branch from ef525c4 to 8a759ea Compare February 22, 2025 07:34
cyrilmory added a commit to cyrilmory/CyrilsRTK that referenced this pull request Feb 27, 2025
Separate SetInputDecomposedProjections and SetInputMeasuredProjections
into two parts, based on their input type (either itk::VectorImage, the
default input type, or itk::Image<itk::Vector<>>, the newly supported type)
as requested in RTKConsortium#688 (comment)
Add a warning when SetInputDecomposedProjections or SetInputMeasuredProjections
fails to cast the input to one of the supported types, as requested in
RTKConsortium#688 (comment)
Separate SetInputDecomposedProjections and SetInputMeasuredProjections
into two parts, based on their input type (either itk::VectorImage, the
default input type, or itk::Image<itk::Vector<>>, the newly supported type)
as requested in RTKConsortium#688 (comment)
Add a warning when SetInputDecomposedProjections or SetInputMeasuredProjections
fails to cast the input to one of the supported types, as requested in
RTKConsortium#688 (comment)
@cyrilmory cyrilmory force-pushed the FixedVectorLengthSpectralInputsOverload branch from 8af69d8 to 47d6551 Compare February 27, 2025 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants