Closed Namng1210 closed 3 years ago
In the above screenshot you export the study. In your script, you try to export only the segmentation, instead of the study, which would be the correct way.
We prefer questions asked in the Slicer discourse forum for better visibility. Here please report bugs. Thank you.
Can you give me an instruction how to export study with DicomRTImportExportPlugin in Python Script. I've tried many ways but still can't make it. :(
As I said you try to export the segmentation: exporter.examineForExport(segmentationShItem)
and instead you need to export the study: exporter.examineForExport(studyShItem)
Yes i've also tried it but here is the result. When i checked source code it seems like dataNode can't read the studyID.. so it return nothing in exportables...
I see. It seems you need to run the examineForExport
function on all the series you want to export (the segmentation and the CT), collect the returned exportables in a list, and and pass that list for the export
function.
At least this is what the GUI does, see https://github.com/Slicer/Slicer/blob/master/Modules/Scripted/DICOMLib/Widgets/qSlicerDICOMExportDialog.cxx#L271
OMG! It was actually worked ! Thanks you so much for helping for me <3
Perfeft, thank you! Closing the issue then.
Hello, I am kinda new with python. Can you explain to me how you manage to solve this issue?
I tried to run the ExamineForExport function on the volume and the segmentations, then past them in a list for the export function, but it did not worked:
exporter = DicomRtImportExportPlugin.DicomRtImportExportPluginClass() exportable1 = exporter.examineForExport(segmentationShItem) exportable2 = exporter.examineForExport(referenceVolumeShItem)
for exp in exportable1: exp.directory=outputFolder for exp in exportable2: exp.directory=outputFolder
exportables = [exportable1,exportable2]
exporter.export(exportables) Traceback (most recent call last): File “”, line 1, in File “C:/Users/tmp/AppData/Roaming/NA-MIC/Extensions-29402/SlicerRT/lib/Slicer-4.11/qt-scripted-modules/DicomRtImportExportPlugin.py”, line 122, in export exportable.copyToVtkExportable(vtkExportable) AttributeError: ‘list’ object has no attribute ‘copyToVtkExportable’
thanks !
Dear authors, Everything seems to be really good when i exported it by hand and I've followed your instructions video of exporting RT-STRUCT file by right click at Study and choose Export to DICOM then click in RT struct and got the result as i want.
But when i was doing it in python script by the following code, after passing the studyID as parameter, i got the result return 'Exportable list contains no exportables'. Then, i have also tried to pass the segmentationID, but got another warning : 'Must export the primary anatomical (CT/MR) image'. How can i fix this problem ?
Hope you reply me soon.