How to retrieve single images from series

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Arvid
Posts: 4
Joined: Thu, 2022-01-27, 17:58

How to retrieve single images from series

#1 Post by Arvid »

Hi Offis team,

My main question is how to use movescu to download a specific single image from a series. I can download complete studies and separate series, by combining findscu and movescu operations.
It all works well, and the images from a specific series are downloaded to the designated folder.

But somehow, I can't find a way to read/download single images from a series. Say I want to download image (instance number) 134 from a specific CT series.
Is there a method of listing the separate images in a series and download only one image using movescu (or another tool)?
For instance by selecting MediaStorageUID or instance numbers?
Until now, I didn't find a solution for this in the docs and forum topics, neither on google. Any help is greatly appreciated!
Also, I haven't found a way to query the current number of images in a specific stored series yet. Hope you can give me a hint on these?
Thank you in advance!

Arvid

Michael Onken
DCMTK Developer
Posts: 2048
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: How to retrieve single images from series

#2 Post by Michael Onken »

Hi,

since you already know how to use findscu and movescu, I only will give you the keys you need to use (you are probably missing the "SOP Instance UID" tag.

So for querying all images in a series using findscu in Study Root mode (-S):

Code: Select all

findscu <server> <port> -S -k QueryRetrieveLevel=IMAGE -k StudyInstanceUID=<uid> -k SeriesInstanceUID=<uid> -k SOPInstanceUID.
Then download one of the images using one of the returned SOP Instance UIDs:

Code: Select all

movescu <server> <port> -S -k QueryRetrieveLevel=IMAGE -k StudyInstanceUID=<uid> -k SeriesInstanceUID=<uid> -k SOPInstanceUID=<uid> [...followed by the rest of your options]
I didn't find a solution for this in the docs
Well, the docs are the DICOM standard in this case, part 4 the section on Query/Retrieve.

Best regards,
Michael

Arvid
Posts: 4
Joined: Thu, 2022-01-27, 17:58

Re: How to retrieve single images from series

#3 Post by Arvid »

Dear Michael,

Thank you for your fast reply. I totally missed the existence of the "QueryRetrieveLevel=IMAGE" option, I thought I was limited to using STUDY and SERIES. And they ignored the SOP Instance UID, so I was stuck.

Will have a go with this, thanks again!

Best regards,

Alain

Arvid
Posts: 4
Joined: Thu, 2022-01-27, 17:58

Re: How to retrieve single images from series

#4 Post by Arvid »

Dear Michael,

It all works fine now! And by using findscu, I can also count the number of instances, so that works fine too.

I have one more question though: by using the -od option I can choose the output directory.
Is there also a similar option to specify the output filename for an image, like 1453633667.dcm, instead of an automatically generated filename like CR.1.3.51.0.7.367836476.7364.24674.895746.5389.12323.675554?

Best regards, Alain

Michael Onken
DCMTK Developer
Posts: 2048
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: How to retrieve single images from series

#5 Post by Michael Onken »

Hi Arvid,

no, there is no such option.

However, instead of using movscu's +P option to start movescu's builtin storage server, you could run storescp instead (e.g. storescp -v <storage_port>) that will then handle the storage part (the movescu call triggering the retrieve operation will stay the same despite the missing +P option).

storescp has some options (including option -od as movescu) to control the generated file names:

Code: Select all

  filename generation:
    -uf   --default-filenames    generate filename from instance UID (default)
    +uf   --unique-filenames     generate unique filenames
    -tn   --timenames            generate filename from creation time
    -fe   --filename-extension   [e]xtension: string
                                 append e to all filenames

Also there are options to sort files according to their related studies/series:

Code: Select all

  sorting into subdirectories (not with --bit-preserving):
    -ss   --sort-conc-studies    [p]refix: string
                                 sort studies using prefix p and a timestamp
    -su   --sort-on-study-uid    [p]refix: string
                                 sort studies using prefix p and the Study
                                 Instance UID
    -sp   --sort-on-patientname  sort studies using the Patient's Name and
                                 a timestamp
Finally, you can execute your own script (e.g. for renaming) after receiving a file (or study):

Code: Select all

  -xcr    --exec-on-reception    [c]ommand: string
                                 execute command c after having received and
                                 processed one C-STORE-RQ message
  -xcs    --exec-on-eostudy      [c]ommand: string
                                 execute command c after having received and
                                 processed all C-STORE-RQ messages that belong
                                 to one study
  -rns    --rename-on-eostudy    having received and processed all C-STORE-RQ
                                 messages that belong to one study, rename
                                 output files according to certain pattern
  -tos    --eostudy-timeout      [t]imeout: integer
                                 specifies a timeout of t seconds for
                                 end-of-study determination
  -xs     --exec-sync            execute command synchronously in foreground
The storescp documentation has more information on these.

Best regards,
Michael

Post Reply

Who is online

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