Page MenuHomePhabricator

DICOM tests
Closed, ResolvedPublic

Description

To verify the updated DICOM loading in the DataNodeFactory (and future changes to the loading mechanism) we need tests for DICOM loading. Since most "strange" files like PET-CT or DTI contain private information or are otherwise restricted from publishing, we have to design some mechanism to provide a "private" test set of images to the dartclients. This is closely related to T210.

Event Timeline

For a different project, I just recently implemented some CMake scripts which

  • download a tar.gz archive and unpack it to some directory structure
  • find all DICOM images from the archive
  • find additional information about the images
  • add calls to small applications as CTest tests

These scripts could be used as a basis for DICOM testing. E.g. if we only

  • describe the most important properties of an image geometry in a text file
    • origin, orientation, extent, spacings, number of time steps
  • write an executable which
    • uses mitk::DicomSeriesReader to load all passed arguments into an mitk::Image
    • write out the loaded image geometry in above text format
  • write an executable which test two of these text files for identical contents (could even be just diff, but cross platform)

we could implement regression tests very easily.

(In reply to comment #1)

  • write an executable which
    • uses mitk::DicomSeriesReader to load all passed arguments into an

mitk::Image

This is exactly the DicomSeriesReaderTest I added a few days ago.

    • write out the loaded image geometry in above text format
  • write an executable which test two of these text files for identical contents (could even be just diff, but cross platform)

we could implement regression tests very easily.

Nice.

I tried to sketch how tests could look like.

TODOs:

  • create applications for implementing test cases (dump and compare)
  • prepare test data
  • implement test cases

Implemented a basic test structure locally.

  • MITK DASHBOARD BLOCKER !!! ****

The DICOM locale tests using the mitkDicomSeriesReader.cpp:DicomSeriesReader class fail on Windows.

In DicomSeriesReader::CreateSeriesIdentifierPart at line 410:

result = IDifyTagValue( tagValueMap[ tag ] );

triggers an assertion failure. tagValueMap returns a zero const char pointer, but IDifyTagValue expects a std::string and calling std::string(0) triggers the assertion failure.

Please fix as soon as possible.

Resetting to feature-request. Sascha accidentally marked this as a blocker

It was intentional because it *blocked* the repository ;-)

(In reply to comment #9)

It was intentional because it *blocked* the repository ;-)

changes of fixing T7210 were causing the block :-)

However, the issue is resolved now. This bug describes a (non-DICOM) series of different tests.

Got back into topic and made dump comparisons for test cases work. A issue still unsolved is that DicomSeriesReader::GetSeries does only accept directories, not file lists as input.

Produced a anonymized, downsampled version of a "CT Abdomen" dataset. Removed or changed all tags that could possibly identify patient or institution or staff.

Added a way to read test cases from the test data directory via CMake and construct appropiate tests.

Finally pushed my changes to

  • MITK-Data
  • bug-7285-ensure-correct-slice-positions
  • bug-3700-dicom-loading-tests

The branches still contain a lot of TODO markers and debug output, but they demonstrate the general direction.

Described test cases that will be implemented and planned what data modifications are needed. Will be the work of an afternoon.

Committed all test cases to the branch (bug-3700-dicom-loading-tests). Tests cover enough cases for now:

  • single slice
  • two slices
  • many slices
  • a gap in between slices
  • multiple gaps
  • different orientations in a series
  • tilted geometry (T1823)
  • spacing different for single images (T4934)
  • single MR slice with negative spacing (T5593)

Tomorrow, I'll check if code works on Windows/MacOS (runs find on Ubuntu Linux), then write documentation and integrate.

Needed to update a few things to make tests compile and execute on Windows. Now they are working and passing.

Wrote a combined change request for this and T7285. These two are so tightly integrated that it would not make sense to accept them separatetly.

Test compiled dependent projects of MBI and Mint. Still work fine. Will integrate when I'm there again to fix issues.

[20e89e]: Merge branch 'bug-3700-dicom-loading-tests'

Merged commits:

2011-05-02 13:33:49 Daniel Maleike [71d3e2]
Forgot my own old documentation from Documentation/Doxygen/DICOMLoadingTests.dox

Merged both texts into Core/Code/Testing/DICOMTesting/DICOMTesting.dox


2011-05-02 13:01:41 Daniel Maleike [141f5a]
clean TODO items from documentation


2011-05-02 12:41:30 Daniel Maleike [f9bb3c]
Generate cross-platform strings for pixel types


2011-05-02 10:45:34 Daniel Maleike [ef0052]
Use differnt add_test syntax (other one would not work with Windows immediately)


2011-05-02 10:35:21 Daniel Maleike [174764]
Point to full name of test executable


2011-05-02 10:34:24 Daniel Maleike [a3102f]
change signature because Visual Studio complained


2011-05-02 10:33:51 Daniel Maleike [1eb4a7]
Initialize m_PreviousCLocale; remove debug output


2011-05-02 10:33:25 Daniel Maleike [7f9a64]
export class symbols


2011-04-29 22:57:10 Daniel Maleike [8a3f6c]
Summarize DICOM loading tests in a Doxygen document


2011-04-29 22:19:29 Daniel Maleike [8a432c]
Update documentation, reformat some code


2011-04-29 22:18:13 Daniel Maleike [dcf8e0]
Make 3D+t sorting more safe by comparing first AND last slice position


2011-04-29 18:42:58 Daniel Maleike [8c1c44]
Merge branch 'bug-7285-ensure-correct-slice-positions' into bug-3700-dicom-loading-tests


2011-04-29 18:40:59 Daniel Maleike [e2f13f]
Make 3D+t sorting an option, which is on by default


2011-04-29 18:40:15 Daniel Maleike [3f0c5c]
Be more generous about tilt detection. mitk::eps would not even work with test images.


2011-04-29 18:05:11 Daniel Maleike [03a686]
Make 3D+t sorting work (still forced, not optional)


2011-04-29 16:27:48 Daniel Maleike [313da6]
Previous commit had an error (3D blocks would still be 3D+t), which is now fixed


2011-04-29 16:10:03 Daniel Maleike [ca7216]
Change code to be able to load 3D+t series at all (by now separated in different mitk::Images)


2011-04-29 16:09:15 Daniel Maleike [d1d7d7]
Sketch solution for 3D+t loading


2011-04-28 18:41:25 Daniel Maleike [de8f0b]
Correctly (as best as MITK can) load tilted gantry geometries


2011-04-28 17:22:15 Daniel Maleike [62924e]
More helpful output in case of errors


2011-04-28 11:09:26 Daniel Maleike [f0d5b8]
Test if input files exist and don't generate too much CMake output


2011-04-28 10:35:34 Daniel Maleike [c32f25]
Actually return the comparison result as test result


2011-04-27 18:23:36 Daniel Maleike [72b8ac]
Generic way to create CTest test cases for DICOM loading from a file structure


2011-04-27 17:30:31 Daniel Maleike [6c6c6d]
Merge branch 'bug-7285-ensure-correct-slice-positions' into bug-3700-dicom-loading-tests


2011-04-27 15:33:17 Daniel Maleike [6d23b7]
Fix broken loading of whole directories


2011-04-27 14:55:11 Daniel Maleike [330cba]
Make sorting into equally spaced groups work


2011-04-27 14:09:03 Daniel Maleike [84b8ae]
Sketch solution for z-spacing consistency


2011-04-26 18:23:00 Daniel Maleike [e445f7]
Use new method for loading files instead of dirs to correctly load commandline arguments


2011-04-26 18:03:53 Daniel Maleike [4c997d]
Merge branch 'bug-7285-ensure-correct-slice-positions' into bug-3700-dicom-loading-tests


2011-04-26 18:03:03 Daniel Maleike [75a9f9]
Provide method to load an explicit list of files (instead of dirs only)


2011-04-26 17:17:10 Daniel Maleike [08d428]
Merge branch 'bug-7285-ensure-correct-slice-positions' into bug-3700-dicom-loading-tests


2011-04-26 17:16:46 Daniel Maleike [9168c6]
Merge branch 'releases/snapshot-201105-preparation' into bug-7285-ensure-correct-slice-positions


2011-04-26 17:16:08 Daniel Maleike [38716e]
Load expected dumps and actually compare against test dumps


2011-04-26 15:56:11 Daniel Maleike [7670c4]
Merge branch 'bug-7700-integrate-bug-7802-planarfigure-shadow' into releases/snapshot-201105-preparation


2011-04-26 13:30:22 Markus Engel [cecb93]
renamed member and using given parameter instead of member for shadow-width


2011-04-21 16:53:49 Markus Engel [408767]
made width of planarfigure shadow configurable


2011-04-21 14:21:30 Daniel Maleike [94abd2]
Merge branch 'bug-7700-integrate-bug-7802-planarfigure-shadow' into releases/snapshot-201105-preparation


2011-04-15 15:06:29 Markus Engel [9c073c]
extended documentation on painting planar figures with a shadow


2011-04-14 14:41:12 Markus Engel [f61d28]
adding possibility to draw shadow around planar figure


2011-04-21 14:19:11 Daniel Maleike [b1dade]
Merge branch 'bug-7700-integrate-bug-7807-planararrow-tip-size' into releases/snapshot-201105-preparation


2011-04-21 13:35:20 Markus Engel [ccf095]
improved checking if Helperpolylines need to be recalculated


2011-04-14 15:16:26 Markus Engel [594288]
always calculating the HelperLines


2011-04-21 14:14:01 Daniel Maleike [e81f34]
Merge remote branch 'remotes/origin/bug-7619-replace-world-to-index-calls' into releases/snapshot-201105-preparation


2011-04-21 14:13:16 Daniel Maleike [1bf9e8]
Merge remote branch 'remotes/origin/bug-7634-unittest-planarpolygon' into releases/snapshot-201105-preparation


2011-04-21 10:19:27 Markus Engel [f1d013]
Merge branch 'bug-7441-planarpolygon-editing-corrected' into releases/snapshot-201105-preparation

  • bug-7441-planarpolygon-editing-corrected: extending documentation on editing of PlanarPolygons

2011-04-14 15:19:21 Markus Engel [d43f49]
Merge branch 'bug-7633-planarfigure-statemachine-add-control-point' into releases/snapshot-201105-preparation

  • bug-7633-planarfigure-statemachine-add-control-point: adding statemachine that has been lost in merging

2011-04-12 17:09:45 Markus Engel [0c8a79]
Merge branch 'bug-7441-planarpolygon-editing-corrected' into releases/snapshot-201105-preparation

  • bug-7441-planarpolygon-editing-corrected: improving determining if inserting new points in ROI is possible

2011-04-12 08:34:32 Markus Engel [326b04]
Merge branch 'bug-7441-planarpolygon-editing-corrected' into releases/snapshot-201105-preparation

  • bug-7441-planarpolygon-editing-corrected: removing unnecessary line that causes recursion

2011-04-11 17:34:35 Markus Engel [50d506]
Merge branch 'bug-7441-planarpolygon-editing-corrected' into releases/snapshot-201105-preparation

  • bug-7441-planarpolygon-editing-corrected: fixing changes from review, removed old, commented or unncessary code

2011-04-11 14:31:23 Markus Engel [1910c6]
Merge branch 'bug-7441-planarpolygon-editing-corrected' into releases/snapshot-201105-preparation

  • bug-7441-planarpolygon-editing-corrected: correcting default property value for planarfigure interaction

2011-04-08 17:40:47 Daniel Maleike [4c5182]
Merge branch 'bug-7285-ensure-correct-slice-positions' into bug-3700-dicom-loading-tests


2011-04-08 17:40:21 Daniel Maleike [5bb20d]
Merge branch 'bug-7210-DICOMlocaleReopened' into bug-7285-ensure-correct-slice-positions


2011-04-08 17:39:56 Daniel Maleike [a04395]
Merge branch 'bug-7210-DICOMlocaleReopened' into releases/snapshot-201105-preparation


2011-04-07 17:16:19 Daniel Maleike [5144d9]
CHANGE THIS COMMENT


2011-04-06 17:02:31 Daniel Maleike [160003]
Initial structure of DICOM loading tests


2011-04-06 17:00:45 Daniel Maleike [a7297e]
Support loading an empty list of files (results in no images).

The function is doing exactly what it is being told to.
A warning is issued because most applications would not
want to implement loading no files.


2011-04-06 16:58:27 Daniel Maleike [6f3d33]
Documentation draft of internal structure

Just integrated into master. Documentation will appear at

http://docs.mitk.org/nightly-qt4/DICOMTesting.html

Test cases can be added as needed/discovered. Now a basic set is implemented and passes on Linux/Windows

Testing bugs are part of their respective modules -> changing component to other, please assign appropriate component.