View Issue Details

IDProjectCategoryView StatusLast Update
0003954Slicer4Module DICOMpublic2018-10-03 04:52
Reporterxiaw Assigned Topieper  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product VersionSlicer 4.4.0 
Target VersionFixed in VersionSlicer 4.5.0-1 
Summary0003954: Dicom scene export is working inconsistently
Description

Dicom scene export function isn't working consistently. Sometimes it can export scene successfully but most times it doesn't work. This functionality has been disabled for a while. I think I have a solution to this problem and I will submit the change soon.

TagsNo tags attached.

Activities

pieper

pieper

2015-05-14 15:55

administrator   ~0013060

Did you have any luck working on this?

xiaw

xiaw

2015-05-15 11:43

reporter   ~0013069

I think I have the solution but the hospital network prevents me from uploading the code to the repository and I have been busy with other works. Can I send the modified code to you via email for you to verify?

pieper

pieper

2015-05-15 11:44

administrator   ~0013070

Sure, that would be fine.

xiaw

xiaw

2015-05-15 12:09

reporter   ~0013071

Mailed to pieper@isomics.com. Thanks!

pieper

pieper

2015-05-19 14:23

administrator   ~0013076

r24266

http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=24266

Thanks for the fixes!

I needed to do some other tweaks to get things working, but it seems reliable to
me now. I couldn't get any of the VR options to work for me, but I have a workaround
that seems good enough for now.

xiaw

xiaw

2015-05-21 11:16

reporter   ~0013092

Awesome. I am glad it worked out! Also, I can't take the credit alone. Kevin helped me greatly during this fix.

pieper

pieper

2015-05-21 11:19

administrator   ~0013093

Nice work and thanks to both you and Kevin for fixing it. I'd never figured out why it just wasn't working but it's a fun feature and I hope people find it useful.

pinter

pinter

2015-05-27 06:42

developer   ~0013105

Great! Thanks!

skat

skat

2018-07-19 05:51

reporter   ~0015922

I am having problems with exporting a scene to DICOM (windows and mac, 4.8.1 and 4.9.0, always with the same error "UnicodeDecodeError: 'ascii' codec can't decode byte 0xdc in position"), but it's working on linux. Any hintes? Thanks



slicer_error.txt (544 bytes)
slicer_error.txt (544 bytes)
pieper

pieper

2018-07-19 09:26

administrator   ~0015923

@skat it looks like there's an unexpected character, perhaps something like a non-ascii character in a username or directory path? It would be great if you could provide a way to reproduce the issue using publicly available data (e.g. from the SampleData module or similar).

skat

skat

2018-07-19 11:10

reporter   ~0015924

Hi, I changed the code a little bit
dump = str(dump) + candygram.encode('utf8')
and now get the scene imported in the local dicom database (although it's not assigned to the correct patient). I'll test with the sampledata next week.

skat

skat

2018-07-25 04:01

reporter   ~0015927

Hi, sorry for the delay. I tried again, with test data and my own, and now it works (without my changes). Strange, I only rebooted the system in the meantime. Only thing that still happens is that the scene is added to the last patient in the DICOM list, so if there are more than one patient, it is a bit abritrary where the bundle file ends up with.

skat

skat

2018-07-25 07:07

reporter   ~0015928

Back to "normal", i.e. not working. With only the MR-head from the testdata loaded, I cannot create the DICOM/scene file. Attached are all logs I get.



slicer_dicom_export.txt (2,013 bytes)
slicer_dicom_export.txt (2,013 bytes)
pinter

pinter

2018-07-25 10:10

developer   ~0015929

I can only re-iterate Steve:
"it looks like there's an unexpected character, perhaps something like a non-ascii character in a username or directory path? It would be great if you could provide a way to reproduce the issue using publicly available data (e.g. from the SampleData module or similar)."
Please describe all the steps you take in detail so that we can reproduce it. Thanks!

skat

skat

2018-07-25 10:56

reporter   ~0015930

Well I tried to copy all the info from the logs into the text file. What I did was:

  1. Download MR-head.nrrd from testdata
  2. Load it into an empty scene
  3. Create Subject "Test"
  4. Create Child study "MRI"
  5. Move MR-head into study
  6. Right click study "MRI", choose Export to DICOM
  7. Fill in Birtdate (19700101), PatientID (00123), Patientname (Test), Sex (M)
  8. Choose Export entire scene, and Import exported data
  9. Press Export and wait for Error

I'm not experienced with python, if you could tell me how to print the contents of candygram I am happy to provide the information.

I am using my modification again: dump = str(dump) + candygram.encode('utf8'), then it works more or less.
The dicom database must not be empty (Error "No reference file! DICOM database is empty"). If there is a patient in the database, the scene file will be added to this patient (whatever that is), and the tags taken from the images already in the database. I also get some warnings:
Ignoring destinationDirectoryName parameter, just taking it as indication we should copy!
Found patient in the database as UId: 8
Need to insert new study: "1.2.276.0.7230010.3.1.2.2356831173.8592.1532529982.561"
Study Added
Need to insert new series: "1.2.276.0.7230010.3.1.3.2356831173.8592.1532529982.562"
Series Added

pinter

pinter

2018-07-25 12:22

developer   ~0015931

Thanks for the description! I also get an error, but it's a different one.

Basically for me the first problem seems to be this:
"Saving Image...
0
something is none"
Then there is a python error in logging.

Steve, do you have time to investigate this? You know the exporter the best. Thanks!

pieper

pieper

2018-07-25 17:47

administrator   ~0015933

Thanks for reporting this - I took a look and the underlying problem appears to be the way the mrb data is being encoded in the dicom file. Currently we use dump2dcm to make the dicom binary from a text file and put the mrb in a private tag (this should be good) but the's value representation (VR) is LO (long string) which is a limitation because the mrb could have arbitrary characters in it.

https://github.com/Slicer/Slicer/blob/master/Modules/Scripted/DICOMLib/DICOMExportScene.py#L154-L175

Instead it looks like we should be able to use option 3 of the NOTES: Dump File Description section of the dump2dcm manual where OB (other byte) data is encoded in an external file using a syntax like "=mrbData.dat". This would avoid the whole encoding step.

https://support.dcmtk.org/docs/dump2dcm.html

I don't really have time to fix this right now but I'd be happy to work with someone who wanted to implement the changes and test them (probably best to write a self-test to confirm it's working as expected).

I'm not sure about the part involving which patient it is associated with, is that something you know about @pinter? Is that something managed by the subject hierarchy and the export dialog?

skat

skat

2018-07-26 03:09

reporter   ~0015934

Thanks for verifying this. As I noted before it seems to work on linux (at least when I tested it once), but a clean solution would of course be preferable.
I have little experience with Slicer and python, and I am on holidays in August and quite busy with another project in September. If I can be of any help (for testing) I can try to assist, but probably not in the next couple of weeks.

pieper

pieper

2018-07-26 07:57

administrator   ~0015935

I should really write a selftest for this.

@pinter are there any dicom export tests currently, maybe as part of the subject hierarchy?

pinter

pinter

2018-07-26 10:47

developer   ~0015936

Yes exactly, this test has DICOM import and loading:
https://github.com/Slicer/Slicer/blob/master/Applications/SlicerApp/Testing/Python/SubjectHierarchyGenericSelfTest.py#L164
There are others in SlicerRT, not sure if you're looking for examples or places to put the export test.

skat

skat

2018-10-03 04:52

reporter   ~0016063

Hi everyone, I finished some other project and can offer to help/test things now if needed.

Related Changesets

Import 2017-06-07 23:51:09: master d7ec00d8

2015-05-19 17:55:01

pieper

Details Diff
BUG: 0003954 fixes slicer bundle scene import/export

* zip file size could not be correctly passed, so now
there is an alternate encoding (hack) that works well.

* missing storage nodes prevented correct export

* export widget embedded python code had a missing
import of DICOMLib

Special Thanks to Xia, Wenyao <wenyao.xia@rmp.uhn.ca>
for his bug fixes!

git-svn-id: http://svn.slicer.org/Slicer4/trunk@24266 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Modules/Scripted/DICOMLib/DICOMExportScene.py Diff File
mod - Modules/Scripted/DICOMLib/Widgets/qSlicerDICOMExportDialog.cxx Diff File
mod - Modules/Scripted/DICOMPlugins/DICOMSlicerDataBundlePlugin.py Diff File

Issue History

Date Modified Username Field Change
2015-02-06 08:59 xiaw New Issue
2015-02-06 08:59 xiaw Status new => assigned
2015-02-06 08:59 xiaw Assigned To => pieper
2015-02-06 10:47 xiaw Description Updated
2015-05-14 15:55 pieper Note Added: 0013060
2015-05-14 15:55 pieper Status assigned => feedback
2015-05-15 11:43 xiaw Note Added: 0013069
2015-05-15 11:44 pieper Note Added: 0013070
2015-05-15 12:09 xiaw Note Added: 0013071
2015-05-19 14:23 pieper Note Added: 0013076
2015-05-19 14:23 pieper Status feedback => resolved
2015-05-19 14:23 pieper Resolution open => fixed
2015-05-21 11:16 xiaw Note Added: 0013092
2015-05-21 11:19 pieper Note Added: 0013093
2015-05-21 11:19 pieper Status resolved => closed
2015-05-21 11:19 pieper Fixed in Version => Slicer 4.4.1
2015-05-27 06:42 pinter Note Added: 0013105
2015-09-09 08:29 jcfr Fixed in Version Slicer 4.4.1 => Slicer 4.5.0-1
2017-06-10 08:51 pieper Changeset attached => Slicer master d7ec00d8
2018-07-19 05:51 skat File Added: slicer_error.txt
2018-07-19 05:51 skat Note Added: 0015922
2018-07-19 09:26 pieper Note Added: 0015923
2018-07-19 11:10 skat Note Added: 0015924
2018-07-25 04:01 skat Note Added: 0015927
2018-07-25 07:07 skat File Added: slicer_dicom_export.txt
2018-07-25 07:07 skat Note Added: 0015928
2018-07-25 10:10 pinter Note Added: 0015929
2018-07-25 10:56 skat Note Added: 0015930
2018-07-25 12:22 pinter Note Added: 0015931
2018-07-25 17:47 pieper Note Added: 0015933
2018-07-26 03:09 skat Note Added: 0015934
2018-07-26 07:57 pieper Note Added: 0015935
2018-07-26 10:47 pinter Note Added: 0015936
2018-10-03 04:52 skat Note Added: 0016063