`
qimo601
  • 浏览: 3416173 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

DCMTK:Receiving Images from PACS using DCMSCU

阅读更多

 

通过DCMTK的DCMSCU,从PACS获取图像,看看人家咋回答的。


Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Receiving Images from PACS using DCMSCU
PostPosted: Fri, 2011-07-22, 09:35 
Offline

Joined: Wed, 2011-07-20, 11:48
Posts: 2
Hi beginner in DICOM here. I'm making a QT app to retrieve images from a PACS and view them. I've set up DCM4Chee on a virtual machine and loaded 1 sample dicom set (BRAINIX) on it. 

I used http://support.dcmtk.org/wiki/dcmtk/how ... cu-example to query and find the set. But am not sure how to retrieve the dataset. 

I subclassed DCMSCU's handleMOVEResponse and tried 

Code:
OFCondition MyDCMSCU::handleMOVEResponse(const T_ASC_PresentationContextID presContextID,MOVEResponse *response, OFBool &waitForNextResponse)
   {

      if(response->m_dataset){
   
         response->m_dataset->saveFile("test1.dcm") ;
       
      }
   
   returnDcmSCU::handleMOVEResponse(presContextID,response,waitForNextResponse);

   }

The test1.dcm only contains the text listing of the 22 images in the dataset without any data. 

The debug output is 

DEBUG - Configured a total of 3 presentation contexts for SCU 
DEBUG - Request Parameters: 
====================== BEGIN A-ASSOCIATE-RQ ===================== 
Our Implementation Class UID: 1.2.276.0.7230010.3.0.3.6.1 
Our Implementation Version Name: OFFIS_DCMTK_361 
Their Implementation Class UID: 
Their Implementation Version Name: 
Application Context Name: 1.2.840.10008.3.1.1.1 
Calling Application Name: TEST-PACS 
Called Application Name: DCM4CHEE 
Responding Application Name: resp. AP Title 
Our Max PDU Receive Size: 16384 
Their Max PDU Receive Size: 0 
Presentation Contexts: 
Context ID: 1 (Proposed) 
Abstract Syntax: =FINDStudyRootQueryRetrieveInformationModel 
Proposed SCP/SCU Role: Default 
Proposed Transfer Syntax(es): 
=LittleEndianImplicit 
Context ID: 3 (Proposed) 
Abstract Syntax: =MOVEStudyRootQueryRetrieveInformationModel 
Proposed SCP/SCU Role: Default 
Proposed Transfer Syntax(es): 
=LittleEndianImplicit 
Context ID: 5 (Proposed) 
Abstract Syntax: =VerificationSOPClass 
Proposed SCP/SCU Role: Default 
Proposed Transfer Syntax(es): 
=LittleEndianImplicit 
Requested Extended Negotiation: none 
Accepted Extended Negotiation: none 
Requested User Identity Negotiation: none 
User Identity Negotiation Response: none 
======================= END A-ASSOCIATE-RQ ====================== 
INFO - Requesting Association 
DEBUG - Constructing Associate RQ PDU 
DEBUG - PDU Type: Associate Accept, PDU Length: 231 + 6 bytes PDU header 
02 00 00 00 00 e7 00 01 00 00 44 43 4d 34 43 48 
45 45 20 20 20 20 20 20 20 20 54 45 53 54 2d 50 
41 43 53 20 20 20 20 20 20 20 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 10 00 00 15 31 2e 
32 2e 38 34 30 2e 31 30 30 30 38 2e 33 2e 31 2e 
31 2e 31 21 00 00 19 01 00 00 00 40 00 00 11 31 
2e 32 2e 38 34 30 2e 31 30 30 30 38 2e 31 2e 32 
21 00 00 19 03 00 00 00 40 00 00 11 31 2e 32 2e 
38 34 30 2e 31 30 30 30 38 2e 31 2e 32 21 00 00 
19 05 00 00 00 40 00 00 11 31 2e 32 2e 38 34 30 
2e 31 30 30 30 38 2e 31 2e 32 50 00 00 2f 51 00 
00 04 00 00 3f e0 52 00 00 11 31 2e 32 2e 34 30 
2e 30 2e 31 33 2e 31 2e 31 2e 31 55 00 00 0e 64 
63 6d 34 63 68 65 2d 31 2e 34 2e 33 30 
DEBUG - Parsing an A-ASSOCIATE PDU 
DEBUG - Association Parameters Negotiated: 
====================== BEGIN A-ASSOCIATE-AC ===================== 
Our Implementation Class UID: 1.2.276.0.7230010.3.0.3.6.1 
Our Implementation Version Name: OFFIS_DCMTK_361 
Their Implementation Class UID: 1.2.40.0.13.1.1.1 
Their Implementation Version Name: dcm4che-1.4.30 
Application Context Name: 1.2.840.10008.3.1.1.1 
Calling Application Name: TEST-PACS 
Called Application Name: DCM4CHEE 
Responding Application Name: DCM4CHEE 
Our Max PDU Receive Size: 16384 
Their Max PDU Receive Size: 16352 
Presentation Contexts: 
Context ID: 1 (Accepted) 
Abstract Syntax: =FINDStudyRootQueryRetrieveInformationModel 
Proposed SCP/SCU Role: Default 
Accepted SCP/SCU Role: Default 
Accepted Transfer Syntax: =LittleEndianImplicit 
Context ID: 3 (Accepted) 
Abstract Syntax: =MOVEStudyRootQueryRetrieveInformationModel 
Proposed SCP/SCU Role: Default 
Accepted SCP/SCU Role: Default 
Accepted Transfer Syntax: =LittleEndianImplicit 
Context ID: 5 (Accepted) 
Abstract Syntax: =VerificationSOPClass 
Proposed SCP/SCU Role: Default 
Accepted SCP/SCU Role: Default 
Accepted Transfer Syntax: =LittleEndianImplicit 
Requested Extended Negotiation: none 
Accepted Extended Negotiation: none 
Requested User Identity Negotiation: none 
User Identity Negotiation Response: none 
======================= END A-ASSOCIATE-AC ====================== 
INFO - Association Accepted (Max Send PDV: 16340) 
INFO - Send C-ECHO Request 
DEBUG - ===================== OUTGOING DIMSE MESSAGE ==================== 
Message Type : C-ECHO RQ 
Presentation Context ID : 5 
Message ID : 1 
Data Set : none 
======================= END DIMSE MESSAGE ======================= 
INFO - Received C-ECHO Response 
DEBUG - ===================== INCOMING DIMSE MESSAGE ====================
Message Type : C-ECHO RSP 
Presentation Context ID : 5 
Message ID Being Responded To : 1 
Affected SOP Class UID : VerificationSOPClass 
Data Set : none 
DIMSE Status : 0x0000: Success 
======================= END DIMSE MESSAGE ======================= 
INFO - Send C-FIND Request 
DEBUG - ===================== OUTGOING DIMSE MESSAGE ==================== 
Message Type : C-FIND RQ 
Presentation Context ID : 1 
Message ID : 2 
Affected SOP Class UID : FINDStudyRootQueryRetrieveInformationModel 
Data Set : present 
Priority : low 
======================= END DIMSE MESSAGE ======================= 
INFO - Received C-FIND Response 
DEBUG - ===================== INCOMING DIMSE MESSAGE ====================
Message Type : C-FIND RSP 
Presentation Context ID : 1 
Message ID Being Responded To : 2 
Affected SOP Class UID : FINDStudyRootQueryRetrieveInformationModel 
Data Set : present 
DIMSE Status : 0xff00: Pending 
======================= END DIMSE MESSAGE ======================= 
DEBUG - C-FIND response has status 0xff00 
DEBUG - Received dataset on presentation context 1 
DEBUG - Handling C-FIND Response 
DEBUG - One or more outstanding C-FIND responses 
INFO - Received C-FIND Response 
DEBUG - ===================== INCOMING DIMSE MESSAGE ====================
Message Type : C-FIND RSP 
Presentation Context ID : 1 
Message ID Being Responded To : 2 
Affected SOP Class UID : FINDStudyRootQueryRetrieveInformationModel 
Data Set : none 
DIMSE Status : 0x0000: Success 
======================= END DIMSE MESSAGE ======================= 
DEBUG - C-FIND response has status 0x0000 
DEBUG - Handling C-FIND Response 
DEBUG - Received final C-FIND response, no more C-FIND responses expected 
INFO - There are 2 studies available 
INFO - Send C-MOVE Request 
DEBUG - ===================== OUTGOING DIMSE MESSAGE ==================== 
Message Type : C-MOVE RQ 
Presentation Context ID : 3 
Message ID : 3 
Affected SOP Class UID : MOVEStudyRootQueryRetrieveInformationModel 
Data Set : present 
Priority : low 
Move Destination : TEST-PACS 
======================= END DIMSE MESSAGE ======================= 
INFO - Received C-MOVE Response 
DEBUG - ===================== INCOMING DIMSE MESSAGE ====================
Message Type : C-MOVE RSP 
Presentation Context ID : 3 
Message ID Being Responded To : 3 
Affected SOP Class UID : MOVEStudyRootQueryRetrieveInformationModel 
Remaining Suboperations : 22 
Completed Suboperations : 0 
Failed Suboperations : 0 
Warning Suboperations : 0 
Data Set : none 
DIMSE Status : 0xff00: Pending 
======================= END DIMSE MESSAGE ======================= 
DEBUG - C-MOVE response has status 0xff00 
DEBUG - Handling C-MOVE Response 
DEBUG - One or more outstanding C-CMOVE responses 
INFO - Received C-MOVE Response 
DEBUG - ===================== INCOMING DIMSE MESSAGE ====================
Message Type : C-MOVE RSP 
Presentation Context ID : 3 
Message ID Being Responded To : 3 
Affected SOP Class UID : MOVEStudyRootQueryRetrieveInformationModel 
Remaining Suboperations : 22 
Completed Suboperations : 0 
Failed Suboperations : 0 
Warning Suboperations : 0 
Data Set : none 
DIMSE Status : 0xff00: Pending 
======================= END DIMSE MESSAGE ======================= 
DEBUG - C-MOVE response has status 0xff00 
DEBUG - Handling C-MOVE Response 
DEBUG - One or more outstanding C-CMOVE responses 
INFO - Received C-MOVE Response 
DEBUG - ===================== INCOMING DIMSE MESSAGE ====================
Message Type : C-MOVE RSP 
Presentation Context ID : 3 
Message ID Being Responded To : 3 
Affected SOP Class UID : MOVEStudyRootQueryRetrieveInformationModel 
Remaining Suboperations : 22 
Completed Suboperations : 0 
Failed Suboperations : 0 
Warning Suboperations : 0 
Data Set : none 
DIMSE Status : 0xff00: Pending 
======================= END DIMSE MESSAGE ======================= 
DEBUG - C-MOVE response has status 0xff00 
DEBUG - Handling C-MOVE Response 
DEBUG - One or more outstanding C-CMOVE responses 
INFO - Received C-MOVE Response 
DEBUG - ===================== INCOMING DIMSE MESSAGE ====================
Message Type : C-MOVE RSP 
Presentation Context ID : 3 
Message ID Being Responded To : 3 
Affected SOP Class UID : MOVEStudyRootQueryRetrieveInformationModel 
Remaining Suboperations : 22 
Completed Suboperations : 0 
Failed Suboperations : 0 
Warning Suboperations : 0 
Data Set : none 
DIMSE Status : 0xff00: Pending 
======================= END DIMSE MESSAGE ======================= 
DEBUG - C-MOVE response has status 0xff00 
DEBUG - Handling C-MOVE Response 
DEBUG - One or more outstanding C-CMOVE responses 
INFO - Received C-MOVE Response 
DEBUG - ===================== INCOMING DIMSE MESSAGE ====================
Message Type : C-MOVE RSP 
Presentation Context ID : 3 
Message ID Being Responded To : 3 
Affected SOP Class UID : MOVEStudyRootQueryRetrieveInformationModel 
Remaining Suboperations : 22 
Completed Suboperations : 0 
Failed Suboperations : 0 
Warning Suboperations : 0 
Data Set : none 
DIMSE Status : 0xff00: Pending 
======================= END DIMSE MESSAGE ======================= 
DEBUG - C-MOVE response has status 0xff00 
DEBUG - Handling C-MOVE Response 
DEBUG - One or more outstanding C-CMOVE responses 
INFO - Received C-MOVE Response 
DEBUG - ===================== INCOMING DIMSE MESSAGE ====================
Message Type : C-MOVE RSP 
Presentation Context ID : 3 
Message ID Being Responded To : 3 
Affected SOP Class UID : MOVEStudyRootQueryRetrieveInformationModel 
Remaining Suboperations : none 
Completed Suboperations : 0 
Failed Suboperations : 22 
Warning Suboperations : 0 
Data Set : present 
DIMSE Status : 0xa702: Error: Refused - Out of resources - Suboperations 
======================= END DIMSE MESSAGE ======================= 
DEBUG - C-MOVE response has status 0xa702 
DEBUG - Received dataset on presentation context 3 
DEBUG - Handling C-MOVE Response 
WARN - Status is 0xa702 (unknown) 
WARN - Will not wait for further C-MOVE responses 
INFO - Received study # 1: 2.16.840.1.113669.632.20.1211.10000357775 
INFO - Releasing Association 
DEBUG - Cleaning up internal association and network structures 


Is the "0xa702: Error: Refused - Out of resources - Suboperations" due to the virtual machine being out of memory ? 
And if the error wasnt there would I be able to save the dataset in this way ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri, 2011-07-22, 10:06 
Offline
OFFIS DICOM Team
OFFIS DICOM Team

Joined: Fri, 2004-11-05, 14:47
Posts: 1153
Location: Oldenburg, Germany
Hi, 

your code is OK, however it does not do what you expect it should do ;-) 

With C-MOVE you can only tell the PACS to send the data somewhere, to a place you tell the PACS by giving an AE title. This AE Title does not have to be a system that you control yourself, it can be any system on the network! In sendMOVERequest, this is the moveDestinationAETitle you specify. 

When a PACS receives this move request, it internally looks up (in the configuration) the ip adress and port of the system with the AE title you specified (thus, every receiver has to be configured on the PACS) and then opens up a _new_ association to that adress and port. On that second connection, the images are sent with C-STORE then. 

The suboperation error is the PACS reporting to you, that there is a problem on the second connection, i.e. it cannot successfully deliver the images on the second connection. 

This is I guess because you plan to receive the images yourself. As described above, the C-MOVE-Response does not contain the images itself but only short acknowledges that the PACS understood your request and is working (or not;)) on the second connection. These Acknowledgements are stored to a file in your overwritten handleMoveResponse() method. 

What you might want to do is starting your own receiver, for example storescp. Be sure to configure the host and port storescp is running with a specific AE title at the PACS so that the PACS knows where to send the images. 

Michael 

Edit: If you want to receive the images on the same connection, there is another message in DICOM called C-GET that you could use. However, this is (not yet!) implemented in DcmSCU. MOVE is also the more common protocol.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri, 2011-07-22, 16:41 
Offline

Joined: Wed, 2011-07-20, 11:48
Posts: 2
Ah ok thanks :), that worked. 

Just had to use a QProcess in the app to launch the storescp.exe before the call to scu.sendMOVERequest and the images got downloaded..


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Hi reno
PostPosted: Fri, 2011-08-12, 20:11 
Offline

Joined: Tue, 2011-06-28, 14:36
Posts: 28
Location: Chennai
Can you post the code here, which worked for you in downloading the images from PACS server.

_________________
with regards 
Manoj Kumar D
 

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon, 2011-08-15, 09:16 
Offline
OFFIS DICOM Team
OFFIS DICOM Team

Joined: Fri, 2004-11-05, 14:47
Posts: 1153
Location: Oldenburg, Germany
Hi, 

the code is completely in the DcmSCU example. The code tells the PACS to send (all) images to a storage server named by the MOVEAPPLICATIONTITLE constant. 

For receiving the images, you must start an additional storage server and have that configured at the PACS. As a storage server, you might use storescp. 

Michael


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat, 2012-03-31, 08:57 
Offline

Joined: Wed, 2012-01-04, 11:18
Posts: 38
If I fill MoveAETitle as the calling AETitle, then the images get download on the same client which is querying. Is it right? 
Also, how it gets downloaded?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon, 2012-04-02, 17:08 
Offline
OFFIS DICOM Team
OFFIS DICOM Team

Joined: Fri, 2004-11-05, 14:47
Posts: 1153
Location: Oldenburg, Germany
Hi, 

the AE title given as a Move destination must always be configured at the PACS with IP adress and port. From the calling AE title alone the PACS cannot know which port it should address. 

Best, 
Michael


Report this post
Top
 Profile  
Reply with quote  



分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics