ENH: Support for VariableLengthVector in CastImageFilter#2094
ENH: Support for VariableLengthVector in CastImageFilter#2094thewtex merged 1 commit intoInsightSoftwareConsortium:masterfrom Leengit:variablelengthvector_constructor
Conversation
dzenanz
left a comment
There was a problem hiding this comment.
Code looks good, but style requires slightly different whitespace. Please run clang-format on the changed source files.
|
@dzenanz, clang-format is trying to change, for example, struct PixelFactory< itk::VariableLengthVector< TSubPixel > >to struct PixelFactory<itk::VariableLengthVector<TSubPixel>>Is the latter the desired style? (Has the style guide been updated recently?) |
|
The style is what clang-format 8.0.2 produces. We agreed not to fight it. Major style update was done maybe a year ago. |
|
Can you please add a test case for the conversion you are adding to the filter? The filter works for variable length -> variable length. Based you the commit/PR message its not clear what conversion you are trying to add but I think it's something like fix array -> variable length. |
|
|
||
| inputIt.GoToBegin(); | ||
| outputIt.GoToBegin(); | ||
| OutputPixelType value{ Self::PixelFactory<OutputPixelType>::New(componentsPerPixel) }; |
There was a problem hiding this comment.
The pixel factory is not needed. Just do the following:
OutputPixelType value = outputIt.Get();
I believe the above should be a "deep copy" but please test the output in the test.
Will do.
A comment by @blowekamp in Issue #1579 suggests that casting to a Yes, the Edit: oops just realized that the person I am responding to and the supplier of the original comment are one and the same, @blowekamp. Apologies if the above reads kind of crazy due to my overlooking that! |
|
The simplicity of this solution was missed when I looked at this. Thank you for changing to the simpler solution and adding tests. With this conversion: |
I believe that the desired behavior is to do something reasonable even when the dimensions of the input and and output images are not equal. For example, the comment at the top of of the definition of // do not call the superclass' implementation of this method since
// this filter allows the input the output to be of different dimensions |
There are two "dimensions":
If the length of the input pixel vector and the output vector differ we need to ensure we have "well defined" behavior and don't over run any buffers. My expectation would be an exception would be thrown some where under the |
Ah, yes, of course, thank you. Will do. |
This pull request resolves the issue that the use of the
OutputPixelTypeconstructor initkCastImageFilter::DynamicThreadedGenerateDataDispatcheddoes not work when the pixel type is aVariableLengthVector.PR Checklist