Storing series in separate subdirectories

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
jsolomon
Posts: 8
Joined: Wed, 2007-01-17, 10:02

Storing series in separate subdirectories

#1 Post by jsolomon » Tue, 2007-01-23, 16:34

Hello All,
I was wondering if it is possible to use storescp to store separate series from the same study in separate subdirectories. I know that with the -ss or -sp options, if one simulataneously sends two series within a study, all images are stored in the same study subdirectory. If one waits until a timeout (as set with the -tos option) before sending the second series, then the series will be saved in two separate study subdirectories. I was hoping to be able to send more than one series at the same time and have them go into separate subdirectories under the study subdirectory.

Thank you for your consideration.

Jeff Solomon

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1292
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#2 Post by Marco Eichelberg » Thu, 2007-01-25, 12:00

Sorry, there is no such option. Implementing this would not be difficult, but everybody and his dog seem to have different opinions about how images should be best sorted into directories.

jsolomon
Posts: 8
Joined: Wed, 2007-01-17, 10:02

#3 Post by jsolomon » Thu, 2007-01-25, 22:27

Thank you for the response. I imagine that those who deal with MR and CT data would find it useful to have separate series stored inside the study directory with a subdirectory labeled by series number.

Thank you,
Jeff

jsalk
DCMTK Tester
Posts: 13
Joined: Thu, 2004-11-25, 15:59

Re: Storing series in separate subdirectories

#4 Post by jsalk » Sat, 2007-01-27, 19:05

jsolomon wrote: I was wondering if it is possible to use storescp to store separate series from the same study in separate subdirectories. [...]
Jeff Solomon
Hi Jeff,

I do something similar by running storescp with
the -xcs option:

Code: Select all

storescp ... -xcs '/path/to/script #p' 
where the script scans the received DICOM files for certain tags and
then sorts them into subdirs according to these tags (and assign
more human friendly filenames).

Bare bone example to sort files according to Patient ID (untested):

Code: Select all

#!/bin/bash

DCMDUMP=/usr/bin/dcmdump
src_dir="$1"

for file in $src_dir/*; do
    if [ -f "$file" ]; then
        # Extract Patient ID from file
        PatientID=`$DCMDUMP +P PatientID "$file" \
                          | sed -e 's/^[^[]*\[//' -e 's/\].*//'`
        # Do something useful with $file
        dest_dir="${src_dir}"/"$PatientID"
        mkdir -p "$dest_dir"
        mv "$file" "$dest_dir" 
    fi
done
Maybe this gives you a point to start with ...

Best regards - Juergen

jsolomon
Posts: 8
Joined: Wed, 2007-01-17, 10:02

#5 Post by jsolomon » Sat, 2007-01-27, 22:21

Hi Juergen,
Thank you for the good suggestion. However, I was able to modify the storescp.cc file to allow storescp to save the images in series subdirectories under the study directory.

Jeff Solomon

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest