Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
39bdfb6ac14e79744d717a80733456dc17b23e7f8917660ded9f23f3cce50800b336f3e303ea024fc9681433c248df91b04a38cc1f9ebbfc1ead98648ed63aca
14 changes: 14 additions & 0 deletions Modules/IO/GDCM/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ itkGDCMImagePositionPatientTest.cxx
itkGDCMImageIOOrthoDirTest.cxx
itkGDCMImageOrientationPatientTest.cxx
itkGDCMLoadImageSpacingTest.cxx
itkGDCMLegacyMultiFrameTest.cxx
)

CreateTestDriver(ITKIOGDCM "${ITKIOGDCM-Test_LIBRARIES}" "${ITKIOGDCMTests}")
Expand Down Expand Up @@ -144,6 +145,19 @@ itk_add_test(NAME itkGDCMLoadImageNoSpacingTest
1.0
)

itk_add_test(NAME itkGDCMLegacyMultiFrameTest
COMMAND ITKIOGDCMTestDriver
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it would be quite helpful to make this more accessible to broader group of users if direct download pointers for the datasets could be added in the comments here. It takes quite a lot of time and space to checkout/configure/download ITK source and data. I also think there should be a link to the original MR series that was converted into the legacy enhanced dataset, since the ultimate test is whether the geometry (and slice order) of the image volume is the same while loading from the original non-enhanced series and the legacy enhanced one.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here's the link to the original non-enhanced MR series: https://www.dropbox.com/s/8m7ugu4cmw83fvd/dicoms-anon.zip?dl=0

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think it would be quite helpful to make this more accessible to broader group of users if direct download pointers for the datasets could be added in the comments here. It takes quite a lot of time and space to checkout/configure/download ITK source and data.

Yes -- after merged and the nightly data upload occurs, the data will be available here.

I also think there should be a link to the original MR series that was converted into the legacy enhanced dataset, since the ultimate test is whether the geometry (and slice order) of the image volume is the same while loading from the original non-enhanced series and the legacy enhanced one.

Here's the link to the original non-enhanced MR series: https://www.dropbox.com/s/8m7ugu4cmw83fvd/dicoms-anon.zip?dl=0

Thanks for the link, I will add a reference to this in a comment.

--compare ${ITK_TEST_OUTPUT_DIR}/itkGDCMLegacyMultiFrameTest.mha
DATA{Baseline/itkGDCMLegacyMultiFrameTest.mha}
itkGDCMLegacyMultiFrameTest
# This dataset was derived from
# https://www.dropbox.com/s/8m7ugu4cmw83fvd/dicoms-anon.zip?dl=0
# per the discussion here
# https://discourse.slicer.org/t/dicom-multiframe-support/4806/9
DATA{Input/LegacyMultiFrame.dcm}
${ITK_TEST_OUTPUT_DIR}/itkGDCMLegacyMultiFrameTest.mha
)

list(FIND ITK_WRAP_IMAGE_DIMS 2 wrap_2_index)
if(ITK_WRAP_float AND wrap_2_index GREATER -1)
itk_python_add_test(NAME PythonReadDicomAndReadTagTest
Expand Down
1 change: 1 addition & 0 deletions Modules/IO/GDCM/test/Input/LegacyMultiFrame.dcm.sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
84d22e7b3e6df2c53eca5444d5dd113dc5d6b0f7589ee9a22667222cec99cde2d33a35eb705fbcb1b9959788eec14d7b2011312ea1270104905612698e772d2b
63 changes: 63 additions & 0 deletions Modules/IO/GDCM/test/itkGDCMLegacyMultiFrameTest.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#include <iostream>
#include "itkGDCMImageIO.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"

// This test verifies that we obtain the correct origin and spacing for a
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am not sure I understand the actual goal of this test. I do not see a comparison being done against the original (legacy) MR Image Storage Series. I guess someine validated it both are the same, but it would be good to mention that in the test.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This test is checking the mf.dcm's origin and spacing are read and interpreted correctly -- they previously were not. The conversion of the original (legacy) MR Image Storage Series is not addressed here. The discussion is provided for reference.

// Legacy MultiFrame DICOM file with IOD
// LegacyConvertedEnhancedMRImageStorage.

int itkGDCMLegacyMultiFrameTest(int argc, char *argv[])
{
if(argc < 3)
{
std::cerr << "Usage: " << argv[0] << " <InputLegacyMultiFrameDICOM> <OutputFile>" << std::endl;
return EXIT_FAILURE;
}

const char * inputFileName = argv[1];
const char * outputFileName = argv[2];

using PixelType = unsigned short;
constexpr unsigned int Dimension = 3;
using ImageType = itk::Image<PixelType, Dimension>;

using ReaderType = itk::ImageFileReader<ImageType>;
ReaderType::Pointer reader = ReaderType::New();
itk::GDCMImageIO::Pointer imageIO = itk::GDCMImageIO::New();
reader->SetImageIO( imageIO );
reader->SetFileName( inputFileName );

using WriterType = itk::ImageFileWriter<ImageType>;
WriterType::Pointer writer = WriterType::New();
writer->SetInput( reader->GetOutput() );
writer->SetFileName( outputFileName );
try
{
writer->Update();
}
catch( itk::ExceptionObject & error )
{
std::cerr << "Error when running pipeline: " << error << std::endl;
return EXIT_FAILURE;
}

return EXIT_SUCCESS;
}