simulations for students

All other questions regarding DCMTK

Moderator: Moderator Team

Message
Author
horus
Posts: 20
Joined: Fri, 2006-02-24, 19:33

simulations for students

#1 Post by horus »

Hi,
I'm Orazio, ph.d. at the Department of Computer Science of Palermo. My principal field of research is medical imaging but now I must teach something about DICOM protocol to my students .

My department hasn't a Dicom device, so I installed the applications STORESCU and STORESCP on two computers to show them the basic capabilities of DICOM to transfer files from a Dicom device (computer with storescu) to a common PC (computer with storescp) both connected to a network.

Now I'd like to show them the query/retrieve and move capabilities, but you provide only the scu parts (findscu and movescu). Where are the scp counterparts (findscp and movescp) ?


Thank you.

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

#2 Post by Michael Onken »

Hi,

to use query / retrieve (Q/R) you need some kind of archive or e. g. a DICOM worklist SCP to query. Both are contained in the DCMTK. A simple image archive can be found in the module dcmqrdb and a file-based worklist server can be found in dcmwlm.

Regards,
Michael

horus
Posts: 20
Joined: Fri, 2006-02-24, 19:33

I tried on local

#3 Post by horus »

Dear Mr. Onken,

I created a directory c:\home and I made an index.dat file using the following command:

dcmqridx -v c:\home c:\home\dicom\ACME_STORE\*.*
pause

I executed dcmqrscp with the following configuration file called dcmqrscp.cfg:

NetworkType = "tcp"
NetworkTCPPort = 104
MaxPDUSize = 16384
MaxAssociations = 16
Display = "no"

HostTable BEGIN
acme1 = (ACME1, gundam, 104)
acmeCTcompany = acme1
united1 = (UNITED1, gundam, 104)
unitedMRcompany = united1
HostTable END

VendorTable BEGIN
"Acme CT Company" = acmeCTcompany
"United MR Company" = unitedMRcompany
VendorTable END

AETable BEGIN
COMMON c:\home\dicom\COMMON R (200, 1024mb) ANY
ACME_STORE c:\home\dicom\ACME_STORE RW (9, 1024mb) acmeCTcompany
UNITED_STORE c:\home\dicom\UNITED_STORE RW (9, 1024mb) unitedMRcompany
AETable END

Index.DAT is on the same directory (home) of dcmqrscp. The application is waiting for something........

Using another DOS consolle on the same PC I called findscu in this way:

findscu -P -k 0010,0020="556342B" gundam 104
pause

It answers in this way:

C:\home>findscu -P -k 0010,0020="556342B" gundam 104
$dcmtk: findscu v3.5.4 2005-12-20 $

findscu: DICOM query (C-FIND) SCU
error: bad key format or dictionary name not found in dictionary: 0010,0020=5563
42B

C:\home>pause
Press any key to continue . . .

The key is the PatientID of a file contained in c:\home\dicom\ACME_STORE

The dcmqrti uses the same configurtion file of dcmqrscp:

dcmqrti -c c:\home\ acmeCTcompany
pause

It doesn't find the database.

What's wrong???

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

#4 Post by Michael Onken »

Hallo,

this is not your fault;) There is an error regarding the --key option in findscu / movescu in DCMTK 3.5.4. You'll get an email containing a patch in a few minutes.

Regards,
Michael

horus
Posts: 20
Joined: Fri, 2006-02-24, 19:33

refusing association

#5 Post by horus »

Dear Mr. Onken,

I performed a new "experiment" compiling ALL the DCMTK library, but dcmqrscp and findscu answer with these errors:

_____________________________________________________________
C:\home>dcmqrscp -v 104
Association Received (gundam:FINDSCU -> ANY-SCP) Wed Mar 01 11:57:25 2006
Refusing Association (BadAEService)
_____________________________________________________________

C:\home>findscu -v -P -k 0010,0020="556342B" gundam 104
Requesting Association
findscu: Association Rejected:
Result: Rejected Permanent, Source: Service User
Reason: Called AE Title Not Recognized

C:\home>pause
Press any key to continue . . .

_____________________________________________________________

The configuration of dcmqrscp is the same described in the previous reply, but the command includes the tcp/ip port number.

The experiment is performed on the same computer.

Nothing to do.

What's wrong?

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

#6 Post by Michael Onken »

Hi,

this error means, that the calling AE (your findscu client) is not allowed to access a specified database handled by dcmqrscp. So either the calling AE title is wrong, the called AE title or both. You can change this:

1. At the moment your findscu uses tries to connect to AE "ANY-SCP" (default), but ANY-SCP ist not configured as valid AE in your dcmqrscp configuration. So try findscu with -aec ACME1 e.g

2. The calling AE title findscu is using per default is "FINDSCU". You can alter this value using findscu with option "-aet".

Regards,
Michael

horus
Posts: 20
Joined: Fri, 2006-02-24, 19:33

it doesn' work!

#7 Post by horus »

Dear Mr. Onken,

I tried many configurations of findscu command line in LOCAL environment:

_____________________________________________________________

C:\home>findscu -v -P -k 0010,0020="556342B" -aec acme1 -aet united1 gundam 104

Requesting Association
findscu: Association Rejected:
Result: Rejected Permanent, Source: Service User
Reason: Called AE Title Not Recognized

C:\home>pause
Press any key to continue . . .
_____________________________________________________________


C:\home>findscu -v -P -k 0010,0020="556342B" -aec acme1 -aet acme1 gundam 104
Requesting Association
findscu: Association Rejected:
Result: Rejected Permanent, Source: Service User
Reason: Called AE Title Not Recognized

C:\home>pause
Press any key to continue . . .
_____________________________________________________________

C:\home>findscu -v -P -k 0010,0020="556342B" -aec acme1 -aet united1 gundam 104

Requesting Association
findscu: Association Rejected:
Result: Rejected Permanent, Source: Service User
Reason: Called AE Title Not Recognized

C:\home>pause
Press any key to continue . . .
_____________________________________________________________


C:\home>findscu -v -P -k 0010,0020="556342B" -aec united1 -aet acme1 gundam 104

Requesting Association
findscu: Association Rejected:
Result: Rejected Permanent, Source: Service User
Reason: Called AE Title Not Recognized

C:\home>pause
Press any key to continue . . .
_____________________________________________________________

The answers of dcmqrscp were:


C:\home>dcmqrscp -v 104
Association Received (gundam:united1 -> acme1) Thu Mar 02 12:07:11 2006
Refusing Association (BadAEService)
Association Received (gundam:acme1 -> acme1) Thu Mar 02 12:07:32 2006
Refusing Association (BadAEService)
Association Received (gundam:united1 -> acme1) Thu Mar 02 12:07:53 2006
Refusing Association (BadAEService)
Association Received (gundam:acme1 -> united1) Thu Mar 02 12:08:11 2006
Refusing Association (BadAEService)

_____________________________________________________________


I tried also with capital letters (ACME1 instead of acme1, the same for united1).

The configuration of dcmqrscp is the same of the previous reply. The index.dat file is in the same directory (c:\home) of dcmqrscp. This file is obtained by the following command line:

dcmqridx -v c:\home c:\home\dicom\ACME_STORE\*.*
pause

Nothing to do.

What's wrong?

horus
Posts: 20
Joined: Fri, 2006-02-24, 19:33

new dcmprscp.cfg

#8 Post by horus »

Dear Mr. Onken,

I tried to perform the db interrogation using also this new configuration
dcmqrscp.cfg:


# Global Configuration Parameters
NetworkType = "tcp"
NetworkTCPPort = 104
MaxPDUSize = 8192
MaxAssociations = 20
Display = "yes"
#---------------------------------------
HostTable BEGIN

echoscu = (ECHOSCU, localhost, 104)
findscu = (FINDSCU, localhost, 104)
movescu = (MOVESCU, localhost, 104)
storescu = (STORESCU, localhost, 104)
storescp = (STORESCP, localhost, 104)

ANY = echoscu, findscu, movescu, storescu, storescp

HostTable END
#---------------------------------------
VendorTable BEGIN

"DCMTK AEC"=ANY
"DCMTK AET"=ANY

VendorTable END
#---------------------------------------
AETable BEGIN

COMMON c:\home\dicom\COMMON RW (200, 1024mb) ANY
ACME_STORE c:\home\dicom\ACME_STORE RW (9, 1024mb) ANY
UNITED_STORE c:\home\dicom\UNITED_STORE RW (9, 1024mb) ANY

AETable END

The following command lines has been used:

_____________________________________________________________

First DOS consolle:

dcmqrscp -v 104
_____________________________________________________________

Second DOS consolle:

findscu -v -P -k 0010,0020="556342B" localhost 104
pause
_____________________________________________________________

It shouldn't be necessary the parameters -aec and -aet because
they should be sent by default.

I obtained the same errors seen before.

The index.dat has been obtained with the following command line:

_____________________________________________________________

dcmqridx -v c:\home c:\home\dicom\ACME_STORE\*.*
pause
_____________________________________________________________

The index.dat is in the same directory of dcmqrscp.exe (c:\home).

I think that you should give me a list of actions and configuration files
to obtain a working simulation.

Can you provide me the steps which I must perform to make a database interrogation with 2 PCs on the same network, please?

The hostname of the first PC is : gundam
The hostname of the second PC is: mozart.

Thank you.

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

#9 Post by Michael Onken »

Hi,

I'm not able to help you without setting up this scenario on my own (since I'm not that long at OFFIS and I did not work on and with all parts of DCMTK), but I haven't got the time at the moment. So you might have to wait, that somebody other takes a look at your configuration. I'm sure the application is working, I've tested it some time ago. Please assure, that the correct configuration file is really used (option --config). Try debug and very verbose option for dcmqrscp (-vv -d). Hope you're getting things running! Maybe the rest of the DCMTK team might help you by having a quick look, but we're very busy at the moment, so there's no guarantee...

Regards,
Michael
Last edited by Michael Onken on Mon, 2006-03-06, 18:52, edited 1 time in total.

Markus Sabin
Posts: 99
Joined: Tue, 2005-07-12, 13:50
Location: Erlangen, Germany

#10 Post by Markus Sabin »

I think that the called AET (parameter -aec) must match one of the AETs in the local AETable:
COMMON, ACME_STORE or UNITED_STORE

horus
Posts: 20
Joined: Fri, 2006-02-24, 19:33

findscu with -aec parameter

#11 Post by horus »

Dear Mr. Sabin,

The directories C:\home\dicom\COMMON and C:\home\dicom\UNITED_STORE don't contain .dcm files.

All the .dcm files are contained in C:\home\dicom\ACME_STORE.

The index.dat is placed both in c:\home and C:\home\dicom\ACME_STORE.
All DCMTK applications are located in c:\home.

The dcmqrscp configuration is the same of the Post with subject: new dcmqrscp.cfg (date Sat, 2006-03-04, 14:03 )

I tried the following command line which includes the answer of findscu:

_____________________________________________________________
C:\home>findscu -v -P -k 0010,0020="SMS511104" -aec ACME_STORE localhost 104
Requesting Association
Association Accepted (Max Send PDV: 8180)
Find SCU RQ: MsgID 1
REQUEST:

# Dicom-Data-Set
# Used TransferSyntax: UnknownTransferSyntax
(0010,0020) LO [SMS511104] # 10, 1 PatientID
--------
C-Find RSP: MsgID: 1 [Status=Failed: IdentifierDoesNotMatchSOPClass]
AffectedSOPClassUID: =FINDPatientRootQueryRetrieveInformationModel
Data Set: Not Present
Releasing Association

C:\home>pause
Press any key to continue . . .

_____________________________________________________________


The key of findscu is the PATIENTID in the header of a dicom file which is contained in
C:\home\dicom\ACME_STORE.

This is the answer of dcmqrscp:

_____________________________________________________________

C:\home>dcmqrscp -v 104
Association Received (localhost:FINDSCU -> ACME_STORE) Mon Mar 06 18:44:41 2006
Association Acknowledged (Max Send PDV: 16372)
Received Find SCP: C-Find RQ: MsgID: 1
AffectedSOPClassUID: =FINDPatientRootQueryRetrieveInformationModel
Priority: 2
Data Set: Present
Find SCP Request Identifiers:

# Dicom-Data-Set
# Used TransferSyntax: LittleEndianExplicit
(0010,0020) LO [SMS511104] # 10, 1 PatientID
DB_startFindRequest(): missing Query/Retrieve Level
DcmQueryRetrieve: findSCP: Database: startFindRequest Failed (Failed: Identifier
DoesNotMatchSOPClass):
Find SCP Response 1 [status: Failed: IdentifierDoesNotMatchSOPClass]
Association Release
_____________________________________________________________


New errors can be noted above.

It seems that DCMTK doesn't support the SOP class of my dicom files ... or something like it!

Are my .dcm files corrupted?

What's wrong?

Thank you.

Markus Sabin
Posts: 99
Joined: Tue, 2005-07-12, 13:50
Location: Erlangen, Germany

#12 Post by Markus Sabin »

Your C-Find Request does not contain the mandatory attribute QueryRetrieveLevel (0008,0052). Add -k 0008,0052="PATIENT" to your call to findscu (and set QueryRetrieveLevel to "STUDY"/ "SERIES"/"IMAGE" for subsequent queries).

horus
Posts: 20
Joined: Fri, 2006-02-24, 19:33

new query

#13 Post by horus »

Dear Mr. Sabin,

I performed the following command line as you wrote me and I added -X to obtain a log file:
_____________________________________________________________
C:\home>findscu -X -v -P -k 0010,0020="SMS511104" -k 0008,0052="PATIENT" -aec ACME_STORE localhost 104
Requesting Association
Association Accepted (Max Send PDV: 8180)
Find SCU RQ: MsgID 1
REQUEST:

# Dicom-Data-Set
# Used TransferSyntax: UnknownTransferSyntax
(0008,0052) CS [PATIENT] # 8, 1 QueryRetrieveLevel
(0010,0020) LO [SMS511104] # 10, 1 PatientID
--------
C-Find RSP: MsgID: 1 [Status=Success]
AffectedSOPClassUID: =FINDPatientRootQueryRetrieveInformationModel
Data Set: Not Present
Releasing Association

C:\home>pause
Press any key to continue . . .
_____________________________________________________________

obtaining the following answer of dcmqrscp:
_____________________________________________________________
C:\home>dcmqrscp -v 104
Association Received (localhost:FINDSCU -> ACME_STORE) Tue Mar 07 10:18:46 2006
Association Acknowledged (Max Send PDV: 16372)
Received Find SCP: C-Find RQ: MsgID: 1
AffectedSOPClassUID: =FINDPatientRootQueryRetrieveInformationModel
Priority: 2
Data Set: Present
Find SCP Request Identifiers:

# Dicom-Data-Set
# Used TransferSyntax: LittleEndianExplicit
(0008,0052) CS [PATIENT] # 8, 1 QueryRetrieveLevel
(0010,0020) LO [SMS511104] # 10, 1 PatientID
Find SCP Response 1 [status: Success]
Association Release
_____________________________________________________________


I can't understand if the informations of the corresponding .dcm file has been retrieved!

I wrote a query.dcm file as suggested by help documentation:

________________________________________________________
# query patient names and IDs
(0008,0052) CS [PATIENT] # QueryRetrieveLevel
(0010,0010) PN [] # PatientsName
(0010,0020) LO [] # PatientID
________________________________________________________

using the following command line:
_______________________________________________________

C:\home>findscu -X -v -P -k 0010,0020="SMS511104" -k 0008,0052="PATIENT" -aec ACME_STORE localhost 104 query.dcm
Requesting Association
Association Accepted (Max Send PDV: 8180)
DcmItem: Length of attribute (2023,7571) is odd
DcmElement: Unknown Tag & Data(2023,7571) larger (544830053) that remaining byte
s in file
findscu: Bad DICOM file: query.dcm: Invalid Stream
findscu: SCU Failed:
0001:0004 Invalid Stream
Aborting Association

C:\home>pause
Press any key to continue . . .
_______________________________________________________

This is the answer of dcmqrscp:

___________________________________________________________
C:\home>dcmqrscp -v 104
Association Received (localhost:FINDSCU -> ACME_STORE) Tue Mar 07 11:21:49 2006
Association Acknowledged (Max Send PDV: 16372)
Association Aborted
___________________________________________________________


Findscu should fill the PatientsName query in query.dcm because PatientID and QueryRetrieveLevel are known; but it doesn't work.

I opened the .dcm file with another application and I red which the PatientsName has two sub-fields:

FamilyName: 'XXXXXXX'
GivenName: 'XXXX'

I omit the name and surname.

Thank you so much for your support, Mr. Sabin.

Markus Sabin
Posts: 99
Joined: Tue, 2005-07-12, 13:50
Location: Erlangen, Germany

Re: new query

#14 Post by Markus Sabin »

Dear Horus,
horus wrote: I can't understand if the informations of the corresponding .dcm file has been retrieved!
No, the C-Find was successfully executed but did not provide any results. You can see that from "Dataset: not present". If the request had matched any dataset at the server's site, you would have seen the resulting response dataset(s) in that place.
horus wrote: I wrote a query.dcm file as suggested by help documentation:
[...]
DcmItem: Length of attribute (2023,7571) is odd
DcmElement: Unknown Tag & Data(2023,7571) larger (544830053) that remaining byte s in file
findscu: Bad DICOM file: query.dcm: Invalid Stream
This is the typical behavior when query.dcm
- is not a DICOM file
and/or
- is encoded without a part 10 metaheader

As you can read the file with a different tool, it probably is a missing metaheader. So it would be quite helpful to know how you create the query file exactly (please post the dump and the command line for dump2dcm or something like that).
I have also never tried to mix a query dataset and query keys in the command line. Maybe someone other can tell if this could work in general.
horus wrote: Findscu should fill the PatientsName query in query.dcm because PatientID and QueryRetrieveLevel are known; but it doesn't work.
I do not understand...how can you know the PatientID without the name? Perhaps your query does not match any records because what you refer to as a patient ID is not the same definition as in DICOM?

So, I suggest that you leave all attributes except QueryRetrieveLevel empty, that means you put a "match all" query and get all possible datasets back. Then you can see which values you can use to restrict the matches.
horus wrote: Thank you so much for your support, Mr. Sabin.
You are welcome :D. Just let me say that I have never worked with the OFFIS servers, but only with their source code. So I can not assist in problems that refer to the "database connection" on the SCP's site.

horus
Posts: 20
Joined: Fri, 2006-02-24, 19:33

#15 Post by horus »

Excuse me, Mr. Sabin.

I forgot to convert the query.dcm file into a valid dicom file using dump2dcm.

Sorry.

Using the command line WITHOUT query.dcm I obtain the following logfile called 'resp0001.dcm' produced by findscu which I opened with another application:
_____________________________________________________________
Filename: 'rsp0001.dcm'
FileModDate: '07-Mar-2006 14:43:40'
FileSize: 392
Format: 'DICOM'
FormatVersion: 3
Width: []
Height: []
BitDepth: []
ColorType: ''
SelectedFrames: []
FileStruct: [1x1 struct]
StartOfPixelData: 392
MetaElementGroupLength: 196
FileMetaInformationVersion: [2x1 double]
MediaStorageSOPClassUID: '1.2.276.0.7230010.3.1.0.1'
MediaStorageSOPInstanceUID: [1x51 char]
TransferSyntaxUID: '1.2.840.10008.1.2.1'
ImplementationClassUID: '1.2.276.0.7230010.3.0.3.5.4'
ImplementationVersionName: 'OFFIS_DCMTK_354'
QueryRetrieveLevel: 'PATIENT'
RetrieveAETitle: 'ACME_STORE'
PatientID: 'SMS511104'
_____________________________________________________________
Finally, the system works!

Unfortunely it doesn't contain the patient's name, the filename of the original .dcm file in ACME_STORE......

Now I describe in detail the request in my first post to this forum.

I'd like to perform the following demo:

1) I'd like to use findscu to obtain a patients-list (whose fields could be patientsname,studydate....) from the ACME_STORE directory, which contains all the dicom files.

2) I'd like to use a field of the list (e.g. only a patientsname or only a studydate.....) obtained in 1) to find a .dcm file (...or the filename) in ACME_STORE (Can findscu do this?)

Step 2) could be merged in step 1) if the list contains also the filenames for each patient. It doesn't matter if the list contains repeated rows which are different only for the filename.

E.g.
date patient file
20030202 olga xxxx file1.dcm
20030202 olga xxxx file2.dcm
20040401 vincent xxx file2.dcm

Of course, the physical creation of such an ordered list, like the one showed above, could be an exercise for my students :-) I am just interested to obtain these informations into a file (query.dcm?....logfile of findscu?)


3) I'd like to move the file (or files...more files could have the same patientsname) found in 2) to another PC using movescu.


Can you provide me the steps which I should perform to obtain such a demo?

Thank you so much for your patience again, Mr. Sabin.

Post Reply

Who is online

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