Enable import of *. dcm

Issue #9 resolved
Ed McDonagh created an issue

Enhancement request from David Platten - would be nice to be able to write openrem_rdsr *.dcm to import a folder full of files at once

Comments (20)

  1. Jonathan Cole

    I've made a quick patch to fix this in the short term. I've put it in my fork. It allows a directory as an argument and processes all DCM files in that. A more elegant solution would be to allow a choice of file extension as an argument and optional processing of subdirectories, but this mitigates the issue for now.

  2. Ed McDonagh reporter

    Can you put in a pull request so I can see how that works. I'm hoping that the system will facilitate me taking that change without merging all your other changes.

  3. Ed McDonagh reporter

    A little googling suggests that this could actually work as David requested by simply assuming an array of strings will be passed. If used conventionally, the array will be one string long. If wildcards are used in the shell, then they will be expanded before openrem_rdsr.py sees it.

  4. Ed McDonagh reporter

    Modified the script portion of rdsr import to allow for mulitple arguments (files), or wildcard shell expansion such as *.dcm. Will need to be duplicated to the other import scripts. Refs #9.

    → <<cset 4b069c1f85fd>>

  5. Ed McDonagh reporter

    Modified JA Cole patch to incorporate both techniques to solve this issue. Possibly overcomplicated things. Needs testing. Refs #9.

    → <<cset d9ff551e9754>>

  6. Ed McDonagh reporter

    Should fail if less than two args, not 2 or less. Tested. Refs #9. If keeping this solution, needs implementing for other scripts.

    → <<cset a21e3be53dd4>>

  7. Ed McDonagh reporter

    Fixes #9. Can now pass a list of dicom files to each of the rdsr, mg and ctphilips scripts. Typical syntax would be 'openrem_rdsr.py myfiles/*.dcm'. Will abandon other branch as it was too complicated for what was needed.

    → <<cset ea314ec35474>>

  8. Ed McDonagh reporter
    • changed status to open

    Reopening as the Windows cmd.exe shell doesn't do wildcard expansion, instead relying on the application to do it.

    Therefore passing *.dcm to openrem_rdsr.py will try and process the file *.dcm

  9. Ed McDonagh reporter

    Changed Windows path advise to match my install, added information about wildcard expansion for linux and that it doesn't currently work for the standard Windows shell (refs #9), changed styling of commands to be sourcecode.

    → <<cset 3fbb8a415746>>

  10. Ed McDonagh reporter

    Changing milestone from 0.4.0 to future for this re-opened issue due to Windows shells not expanding variables like linux and Windows powershells do.

  11. Ed McDonagh reporter
    • changed status to open

    Fix in beta release three actually broke all imports from any platform, as it was feeding a list to glob which requires a string.

  12. Ed McDonagh reporter

    Modified scripts to glob the filenames so that in Windows * wildcards will be expanded. Modified rdsr.py and ct_philips.py as they had a sys.exit if the study existed in the database, which then made the glob versions of the scripts stop. Should fix #9 again.

    → <<cset 57c06b5f7530>>

  13. Log in to comment