Skip to content

Commit

Permalink
BUG: fix the self-tests, revert back to std::string - now works?..
Browse files Browse the repository at this point in the history
  • Loading branch information
fedorov committed Jan 9, 2014
1 parent f43adb1 commit 360c848
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
1 change: 1 addition & 0 deletions Logic/vtkSlicerReportingModuleLogic.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
#include <time.h>
#include <fstream>
#include <algorithm>
//#include <string>

// DCMTK includes
#include <dcmtk/dcmdata/dcmetinf.h>
Expand Down
7 changes: 4 additions & 3 deletions Logic/vtkSlicerReportingModuleLogic.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

// STD includes
#include <cstdlib>
//#include <string>

#include "vtkSlicerReportingModuleLogicExport.h"

Expand Down Expand Up @@ -143,8 +144,8 @@ class VTK_SLICER_REPORTING_MODULE_LOGIC_EXPORT vtkSlicerReportingModuleLogic :
bool DicomSegRead(vtkCollection*, const std::string fname, vtkMRMLColorNode* colorNode = NULL);

/// set/get the error string
vtkGetMacro(ErrorMessage, vtkStdString);
vtkSetMacro(ErrorMessage, vtkStdString);
vtkGetMacro(ErrorMessage, std::string);
vtkSetMacro(ErrorMessage, std::string);

std::string GetFileNameFromUID(std::string uid);

Expand Down Expand Up @@ -222,7 +223,7 @@ class VTK_SLICER_REPORTING_MODULE_LOGIC_EXPORT vtkSlicerReportingModuleLogic :
std::map<std::string, ColorCategorizationMapType> colorCategorizationMaps;

/// save an error string to pass to the gui, reset when test passes
vtkStdString ErrorMessage;
std::string ErrorMessage;
};

#endif
16 changes: 10 additions & 6 deletions Testing/Python/ReportingSelfTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,19 @@ def test_ReportingAIMRoundTrip(self):
self.delayDisplay('Importing DICOM')
mainWindow = slicer.util.mainWindow()
mainWindow.moduleSelector().selectModule('DICOM')
dicomWidget.dicomApp.suspendModel()
#dicomWidget.dicomApp.suspendModel()
indexer = ctk.ctkDICOMIndexer()
indexer.addDirectory(slicer.dicomDatabase, dicomFilesDirectory, None)
indexer.waitForImportFinished()
dicomWidget.dicomApp.resumeModel()
dicomWidget.detailsPopup.open()
# click on the first row of the tree
index = dicomWidget.tree.indexAt(qt.QPoint(0,0))
dicomWidget.onTreeClicked(index)

patient = slicer.dicomDatabase.patients()[0]
studies = slicer.dicomDatabase.studiesForPatient(patient)
series = [slicer.dicomDatabase.seriesForStudy(study) for study in studies]
seriesUIDs = [uid for uidList in series for uid in uidList]
dicomWidget.detailsPopup.offerLoadables(seriesUIDs, 'SeriesUIDList')
dicomWidget.detailsPopup.examineForLoading()

loadablesByPlugin = dicomWidget.detailsPopup.loadablesByPlugin

self.delayDisplay('Loading Selection')
dicomWidget.detailsPopup.loadCheckedLoadables()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,15 @@ def test_LabelToDICOMSEGConverterRoundTrip(self):

self.importDICOM(slicer.dicomDatabase, dicomFilesDirectory)

dicomWidget.detailsPopup.open()
# click on the first row of the tree
index = dicomWidget.tree.indexAt(qt.QPoint(0,0))
dicomWidget.onTreeClicked(index)

patient = slicer.dicomDatabase.patients()[0]
studies = slicer.dicomDatabase.studiesForPatient(patient)
series = [slicer.dicomDatabase.seriesForStudy(study) for study in studies]
seriesUIDs = [uid for uidList in series for uid in uidList]
dicomWidget.detailsPopup.offerLoadables(seriesUIDs, 'SeriesUIDList')
dicomWidget.detailsPopup.examineForLoading()

loadablesByPlugin = dicomWidget.detailsPopup.loadablesByPlugin

self.delayDisplay('Loading Selection')
dicomWidget.detailsPopup.loadCheckedLoadables()

Expand Down Expand Up @@ -358,10 +362,14 @@ def test_LabelToDICOMSEGConverterRoundTrip(self):

slicer.mrmlScene.Clear(0)

# try to load back the segmentation from DICOM module
dicomWidget.detailsPopup.open()
index = dicomWidget.tree.indexAt(qt.QPoint(0,0))
dicomWidget.onTreeClicked(index)
patient = slicer.dicomDatabase.patients()[0]
studies = slicer.dicomDatabase.studiesForPatient(patient)
series = [slicer.dicomDatabase.seriesForStudy(study) for study in studies]
seriesUIDs = [uid for uidList in series for uid in uidList]
dicomWidget.detailsPopup.offerLoadables(seriesUIDs, 'SeriesUIDList')
dicomWidget.detailsPopup.examineForLoading()

loadablesByPlugin = dicomWidget.detailsPopup.loadablesByPlugin

self.delayDisplay('Wait',10000)

Expand Down Expand Up @@ -408,8 +416,6 @@ def cleanupDir(self, d):

def importDICOM(self, dicomDatabase, dicomFilesDirectory):
dicomWidget = slicer.modules.dicom.widgetRepresentation().self()
dicomWidget.dicomApp.suspendModel()
indexer = ctk.ctkDICOMIndexer()
indexer.addDirectory(dicomDatabase, dicomFilesDirectory, None)
indexer.waitForImportFinished()
dicomWidget.dicomApp.resumeModel()

0 comments on commit 360c848

Please sign in to comment.