SlicerRT icon indicating copy to clipboard operation
SlicerRT copied to clipboard

py_DicomRtImportTest failing

Open Sunderlandkyl opened this issue 5 years ago • 16 comments

Automated test for importing DICOM-RT data is currently failing.

test_DicomRtImportTest_FullTest1 (DicomRtImportTest.DicomRtImportTest) ... Database folder does not contain ctkDICOM.sql file: /Volumes/Dashboards/Preview/S-0-E-b/SlicerRT-build/inner-build/DicomRtImportExport/Testing/Python
Finished with download test data
Import study
W: DcmItem: Length of element (6854,2065) is odd
E: DcmElement: Unknown Tag & Data (6854,2065) larger (1953724787) than remaining bytes in file
Could not load  "/var/folders/6y/zp9dkw5d5wg35y8qvn29hpww0000gn/T/Slicer-tmp-kitware/DicomRtImportTest/EclipseProstatePhantomRtData/RD.1.2.246.352.71.7.2088656855.452083.20110920153746.dcm" 
DCMTK says:  I/O suspension or premature end of stream
Could not read DICOM file:/var/folders/6y/zp9dkw5d5wg35y8qvn29hpww0000gn/T/Slicer-tmp-kitware/DicomRtImportTest/EclipseProstatePhantomRtData/RD.1.2.246.352.71.7.2088656855.452083.20110920153746.dcm
W: DcmItem: Length of element (6854,2065) is odd
E: DcmElement: Unknown Tag & Data (6854,2065) larger (1953724787) than remaining bytes in file
Could not load  "/var/folders/6y/zp9dkw5d5wg35y8qvn29hpww0000gn/T/Slicer-tmp-kitware/DicomRtImportTest/EclipseProstatePhantomRtData/RI.1.2.246.352.71.3.2088656855.2381134.20110921150951.dcm" 
DCMTK says:  I/O suspension or premature end of stream
Could not read DICOM file:/var/folders/6y/zp9dkw5d5wg35y8qvn29hpww0000gn/T/Slicer-tmp-kitware/DicomRtImportTest/EclipseProstatePhantomRtData/RI.1.2.246.352.71.3.2088656855.2381134.20110921150951.dcm
W: DcmItem: Length of element (6854,2065) is odd
E: DcmElement: Unknown Tag & Data (6854,2065) larger (1953724787) than remaining bytes in file
Could not load  "/var/folders/6y/zp9dkw5d5wg35y8qvn29hpww0000gn/T/Slicer-tmp-kitware/DicomRtImportTest/EclipseProstatePhantomRtData/RP.1.2.246.352.71.5.2088656855.377401.20110920153647.dcm" 
DCMTK says:  I/O suspension or premature end of stream
Could not read DICOM file:/var/folders/6y/zp9dkw5d5wg35y8qvn29hpww0000gn/T/Slicer-tmp-kitware/DicomRtImportTest/EclipseProstatePhantomRtData/RP.1.2.246.352.71.5.2088656855.377401.20110920153647.dcm
W: DcmItem: Length of element (6854,2065) is odd
E: DcmElement: Unknown Tag & Data (6854,2065) larger (1953724787) than remaining bytes in file
Could not load  "/var/folders/6y/zp9dkw5d5wg35y8qvn29hpww0000gn/T/Slicer-tmp-kitware/DicomRtImportTest/EclipseProstatePhantomRtData/RS.1.2.246.352.71.4.2088656855.2404649.20110920153449.dcm" 
DCMTK says:  I/O suspension or premature end of stream
Could not read DICOM file:/var/folders/6y/zp9dkw5d5wg35y8qvn29hpww0000gn/T/Slicer-tmp-kitware/DicomRtImportTest/EclipseProstatePhantomRtData/RS.1.2.246.352.71.4.2088656855.2404649.20110920153449.dcm
"DICOM indexer has successfully processed 4 files [0.01s]"
"DICOM indexer has updated display fields for 0 files [0.00s]"
FAIL
runTest (slicer.ScriptedLoadableModule.ScriptedLoadableModuleTest) ... No test is defined in ScriptedLoadableModuleTest
ok

======================================================================
FAIL: test_DicomRtImportTest_FullTest1 (DicomRtImportTest.DicomRtImportTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Volumes/Dashboards/Preview/S-0-E-b/SlicerRT/DicomRtImportExport/Testing/Python/DicomRtImportTest.py", line 38, in test_DicomRtImportTest_FullTest1
    self.TestSection_ImportStudy()
  File "/Volumes/Dashboards/Preview/S-0-E-b/SlicerRT/DicomRtImportExport/Testing/Python/DicomRtImportTest.py", line 105, in TestSection_ImportStudy
    self.assertEqual( len(slicer.dicomDatabase.patients()), 1 )
AssertionError: 0 != 1

http://slicer.cdash.org/testDetails.php?test=9875840&build=1797453

Sunderlandkyl avatar Jan 13 '20 14:01 Sunderlandkyl

Slicer 4.11.0-2020-01-12 r8ea6945

SlicerRT master branch. All tests have passed on linux.

MichaelColonel avatar Jan 13 '20 17:01 MichaelColonel

Unfortunately for me the test crashes after the suggested changes. It needs to be investigated.

cpinter avatar Jan 15 '20 08:01 cpinter

Here is my test log output. No DCMTK errors, only warnings.

LastTest.log

MichaelColonel avatar Jan 21 '20 06:01 MichaelColonel

Thanks, very interesting. I have a consistent crash while importing. The crash is in the QSql calls, see call stack:

 Qt5Cored.dll!qt_message_fatal(QtMsgType __formal, const QMessageLogContext & context, const QString & message) Line 1710	C++
 Qt5Cored.dll!QMessageLogger::fatal(const char * msg, ...) Line 822	C++
 Qt5Cored.dll!qt_assert(const char * assertion, const char * file, int line) Line 3126	C++
 qsqlited.dll!QList<int>::first() Line 345	C++
qsqlited.dll!QSQLiteResult::exec() Line 491	C++
 Qt5Sqld.dll!QSqlQuery::exec() Line 1002	C++
 CTKDICOMCore.dll!ctkDICOMDatabase::fileForInstance(const QString sopInstanceUID) Line 2028	C++
 vtkSlicerDicomRtImportExportModuleLogic.dll!vtkSlicerDicomRtImportExportModuleLogic::vtkInternal::ExamineRtDoseDataset(DcmDataset * dataset, OFString & name, std::vector<OFString,std::allocator<OFString>> & referencedSOPInstanceUIDs) Line 267	C++
 vtkSlicerDicomRtImportExportModuleLogic.dll!vtkSlicerDicomRtImportExportModuleLogic::ExamineForLoad(vtkStringArray * fileList, vtkCollection * loadables) Line 1971	C++
 vtkSlicerDicomRtImportExportModuleLogicPythonD.dll!PyvtkSlicerDicomRtImportExportModuleLogic_ExamineForLoad(_object * self, _object * args) Line 152	C++

I'll try deleting the downloaded file, maybe it's corrupted. We are at the Slicer project week, so I cannot work on this this week.

cpinter avatar Jan 21 '20 10:01 cpinter

I fixed the DicomRtImportTest by updating some baseline numbers. I have not checked if they are correct, but looking at the viewers during the test it seems that all the data is loaded.

IGRTWorkflow_SelfTest still fails, however, and quite badly. It starts with an endless stream of errors like this Input port 0 of algorithm vtkCleanPolyData(0000025DFBB94D80) has 0 connections but is not optional. then there are errors about wrong number of nodes etc. @MichaelColonel since mainly you made changes in the near past that could cause these errors, and also that changes the number of loaded nodes etc, can you please take a look at this test and fix it after your current beam changes with sequences are done? Thank you!

cpinter avatar May 28 '20 13:05 cpinter

All python tests are failed with such message:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/test/devel/git/Slicer/Slicer-SuperBuild-Release/python-install/lib/python3.6/imp.py", line 170, in load_source
    module = _exec(spec, sys.modules[name])
  File "<frozen importlib._bootstrap>", line 618, in _exec
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/test/devel/git/SlicerRT/SlicerRT-test/inner-build/lib/Slicer-4.11/qt-scripted-modules/PlmRegister.py", line 4, in <module>
    import RegistrationLib
ModuleNotFoundError: No module named 'RegistrationLib'
loadSourceAsModule - Failed to load file "/home/test/devel/git/SlicerRT/SlicerRT-test/inner-build/lib/Slicer-4.11/qt-scripted-modules/PlmRegister.py"  as module "PlmRegister" !
Fail to instantiate module  "PlmRegister"
The following modules failed to be instantiated:
   PlmRegister

MichaelColonel avatar May 29 '20 15:05 MichaelColonel

Landmark registration was previously disabled in Slicer, which caused the Python tests to fail. This should be fixed now (See https://github.com/SlicerRt/SlicerRT/issues/140).

You'll probably need to update and rebuild the Slicer SuperBuild.

Sunderlandkyl avatar May 29 '20 15:05 Sunderlandkyl

Yes. This has been recently fixed. That's how I was able to run them now. As @Sunderlandkyl suggests, please update your Slicer.

cpinter avatar May 29 '20 15:05 cpinter

The #147 is ready for checking and testing.

MichaelColonel avatar May 29 '20 18:05 MichaelColonel

All the tests pass in the branch referred above. After integration this issue can be closed. Thank you!

cpinter avatar Jun 02 '20 12:06 cpinter

One comment: although IGRTSelfTest passes, it actually does not finish successfully. Here are the errors it outputs:

First

Number of loaded vtkMRMLScalarVolumeNode nodes was 3, but 2 was expected
Number of loaded vtkMRMLModelHierarchyNode nodes was 0, but 7 was expected
Traceback (most recent call last):
  File "E:/e/_Extensions/SlicerRT_R/inner-build/lib/Slicer-4.11/qt-scripted-modules/IGRTWorkflow_SelfTest.py", line 141, in TestSection_01_LoadDicomData
    self.assertTrue(success)
  File "E:\e\ScR\python-install\Lib\unittest\case.py", line 682, in assertTrue
    raise self.failureException(msg)
AssertionError: False is not true
Test caused exception!

then

Setting display options for loaded data
Traceback (most recent call last):
  File "E:/e/_Extensions/SlicerRT_R/inner-build/lib/Slicer-4.11/qt-scripted-modules/IGRTWorkflow_SelfTest.py", line 242, in TestSection_02C_SetDisplayOptions
    day1Dose = slicer.util.getNode(self.day1DoseName)
  File "E:\e\ScR\Slicer-build\bin\Python\slicer\util.py", line 996, in getNode
    raise MRMLNodeNotFoundException("could not find nodes in the scene by name or id '%s'" % (pattern if (isinstance(pattern, str)) else ""))
slicer.util.MRMLNodeNotFoundException: could not find nodes in the scene by name or id '5: RTDOSE: BRAI1'
Test caused exception!
could not find nodes in the scene by name or id '5: RTDOSE: BRAI1'

Not sure how it passes with such an error.

cpinter avatar Jun 02 '20 12:06 cpinter

Same thing happens with py_BatchStructureSetConversion

62: Number of loaded vtkMRMLScalarVolumeNode nodes was 3, but 2 was expected
62: Traceback (most recent call last):
62:   File "E:/e/_Extensions/SlicerRT_R/inner-build/lib/Slicer-4.11/qt-scripted-modules/BatchStructureSetConversion.py", line 237, in TestSection_1_LoadDicomData
62:     self.assertTrue(success)
62:   File "E:\e\ScR\python-install\Lib\unittest\case.py", line 682, in assertTrue
62:     raise self.failureException(msg)
62: AssertionError: False is not true
62: Test caused exception!
62: False is not true

cpinter avatar Jun 02 '20 12:06 cpinter

Number of loaded vtkMRMLModelHierarchyNode nodes was 0, but 7 was expected

I can fix this, since there are no vtkMRMLModelHierarchyNode only vtkMRMLRTBeamNode, but about everything else i can't say anything particular, since other nodes are vtkMRMLScalarVolumeNode and node named '5: RTDOSE: BRAI1'.

MichaelColonel avatar Jun 02 '20 13:06 MichaelColonel

I have fixed IGRTSelfTest. Dose volume name must be '5: RTDOSE', not '5: RTDOSE: BRAI1', since it's a name from the plan.

MichaelColonel avatar Jun 02 '20 13:06 MichaelColonel

I have made a commit to #147 with tests fixes. Can you check this commit as well?

MichaelColonel avatar Jun 02 '20 14:06 MichaelColonel

The tests indeed work, thanks a lot for the quick fixes!

cpinter avatar Jun 02 '20 15:06 cpinter

Test passes, closing.

cpinter avatar Oct 14 '22 10:10 cpinter