ENH: Enable writing scl_slope and scl_inter in NIfTI header#47
ENH: Enable writing scl_slope and scl_inter in NIfTI header#47Hakkk2002 wants to merge 1 commit intoInsightSoftwareConsortium:masterfrom
Conversation
|
Can one of the admins verify this patch? |
2 similar comments
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
thewtex
left a comment
There was a problem hiding this comment.
Thanks for the contribution, @Hakkk2002 !
Could the new functionality please be covered in the regression tests?
|
The check seemed to fail somewhere else in the then master branch this one based. I add these functions for the following scenario: |
|
@Hakkk2002 yes, the current CI test failures are unrelated. Please rebase your branch on master -- it should help with the false positives. Yes, processing that modifies the intensity distribution should be thought about carefully. CC: @hjmjohnson |
dd8e1a3 to
4abe9b5
Compare
|
Thanks for the rebase @Hakkk2002 , tests are passing now :-) Could you please add a regression test for this new functionality? This will ensure it is working as expected and that it continuous to work as expected.
Then another test could be added define in the ITK/Modules/IO/NIFTI/test/CMakeLists.txt Lines 77 to 79 in ee4488b |
|
I will work on a test later, but be aware that only the NIfTI writing with slope/intercept is new; the rescaling and shifting have already been implemented in the NIfTI reading process. So just to extract (read) a slice from a NIfTI file may not be relevant. |
|
@Hakkk2002 great. Yes, we will also have to compare the written out file. This is achieved with the |
|
A test has been appended to Test11 of |
6ed38b4 to
e610663
Compare
thewtex
left a comment
There was a problem hiding this comment.
Well done adding the regression tests.
A few missing typename keywords are noted inline.
| // fill out an image and write it as nifti. | ||
| const char *filename = "SlopeIntercept.nii"; | ||
| typedef typename itk::Image<PixelType,3> OutputImageType; | ||
| OutputImageType::RegionType region; |
There was a problem hiding this comment.
Since OuputImageType::RegionType is a dependent type this needs the typename keyword.
| const char *filename = "SlopeIntercept.nii"; | ||
| typedef typename itk::Image<PixelType,3> OutputImageType; | ||
| OutputImageType::RegionType region; | ||
| OutputImageType::IndexType start; |
| start[0] = 0; | ||
| start[1] = 0; | ||
| start[2] = 0; | ||
| OutputImageType::SizeType size; |
| size[2] = 4; | ||
| region.SetSize(size); | ||
| region.SetIndex(start); | ||
| OutputImageType::Pointer outputimage = OutputImageType::New(); |
| itout.Set(static_cast<PixelType>(i)); | ||
| } | ||
| typedef itk::ImageFileWriter< OutputImageType > WriterType; | ||
| WriterType::Pointer writer = WriterType::New(); |
This is useful when the image data are stored in integers. Change-Id: I5d7ca0f93fcabccc6ee2136cf2da3a2a3f08d3bd
|
Merged to |
This is useful when writing image data that are stored in integers.
Change-Id: I72caaf4565a195b2d603b95a01eb1ff5ccfddbda