Download the MR image from a PACS server and save it in jpeg format.

All other questions regarding DCMTK

Moderator: Moderator Team

Message
Author
omeryildiz
Posts: 15
Joined: Fri, 2023-04-28, 11:41

Download the MR image from a PACS server and save it in jpeg format.

#1 Post by omeryildiz »

Hello,

I tried the code in the link below.
https://support.dcmtk.org/redmine/proje ... wto_DcmSCU

sendFINDRequest and sendECHORequest work just fine. But sendMOVERequest is not working and status data "(0000.0902) LO [A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond xxx.xx.xxx.xx:104] # 200 returns 1 ErrorComment.

My purpose: for example, I want to save MRI pixels from the relevant server as jpeg to the disk where this application is running.

Can you help me please?
Last edited by omeryildiz on Tue, 2023-05-02, 09:38, edited 2 times in total.

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

Re: Download the MR image from a PACS server and save it in jpeg format.

#2 Post by Michael Onken »

Hi,

I guess your client is the one with IP 213.74.187?

Did you start a storage server as pointed out above the code?
and downloads them (Retrieve). For this last step, a separate Storage SCP like storescp is needed which actually receives the study images.
If not, try to start it using

Code: Select all

storescp -v 104
. If you are not on Windows, this probably requires root/superuser privileges, or, change your request and storescp port 11112 instead.

Best regards,
Michael

P.S: I will move this later into the forum for general topics (not 3rd party topics).

omeryildiz
Posts: 15
Joined: Fri, 2023-04-28, 11:41

Re: Download the MR image from a PACS server and save it in jpeg format.

#3 Post by omeryildiz »

Thanks,

Yes. I worked.

storescp -v 11112

But it didn't. "IP xxx.xx.xxx?" do you mean it won't be localhost?
Last edited by omeryildiz on Tue, 2023-05-02, 09:38, edited 1 time in total.

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

Re: Download the MR image from a PACS server and save it in jpeg format.

#4 Post by Michael Onken »

The PACS tries to send images to 213.74.187.34:104, see the error message it returns in your first posting.

omeryildiz
Posts: 15
Joined: Fri, 2023-04-28, 11:41

Re: Download the MR image from a PACS server and save it in jpeg format.

#5 Post by omeryildiz »

firewall is blocking it. I fixed it.

now storescp responded with:

I: Association Received
I: Association Acknowledged (Max Send PDV: 65524)
I: Received Store Request (MsgID 26812, VVm)
RECV: E: Store SCP Failed: 0006:0317 Peer aborted Association (or never connected)

Thank you for your interest. I'm new to Dicom.
Last edited by omeryildiz on Tue, 2023-05-02, 09:57, edited 2 times in total.

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

Re: Download the MR image from a PACS server and save it in jpeg format.

#6 Post by Michael Onken »

Hi,

use --debug option on storescp which might show more details on what goes wrong.

BR,
Michael

omeryildiz
Posts: 15
Joined: Fri, 2023-04-28, 11:41

Re: Download the MR image from a PACS server and save it in jpeg format.

#7 Post by omeryildiz »

sendMOVERequest's responsed with: (0000,0902) LO [Pixel data too long to be represented in uncompressed form] # 58, 1 ErrorComment

storescp -v 11112 -aet TEST-SCU --debug
D: $dcmtk: storescp v3.6.7+ DEV $
D:
D: Association Received: 41
D: setting network send timeout to 60 seconds
D: setting network receive timeout to 60 seconds
D: PDU Type: Associate Request, PDU Length: 972 + 6 bytes PDU header
D: Only dumping 512 bytes.
D: 01 00 00 00 03 cc 00 01 00 00 54 45 53 54 2d 53
D: 43 55 20 20 20 20 20 20 20 20 44 49 43 4f 4d 5f
D: 53 45 52 56 45 52 20 20 20 20 00 00 00 00 00 00
D: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
D: 00 00 00 00 00 00 00 00 00 00 10 00 00 15 31 2e
D: 32 2e 38 34 30 2e 31 30 30 30 38 2e 33 2e 31 2e
D: 31 2e 31 20 00 01 09 01 00 00 00 30 00 00 1e 31
D: 2e 32 2e 38 34 30 2e 31 30 30 30 38 2e 35 2e 31
D: 2e 34 2e 31 2e 31 2e 37 37 2e 31 2e 32 40 00 00
D: 13 31 2e 32 2e 38 34 30 2e 31 30 30 30 38 2e 31
D: 2e 32 2e 31 40 00 00 11 31 2e 32 2e 38 34 30 2e
D: 31 30 30 30 38 2e 31 2e 32 40 00 00 16 31 2e 32
D: 2e 38 34 30 2e 31 30 30 30 38 2e 31 2e 32 2e 34
D: 2e 35 37 40 00 00 16 31 2e 32 2e 38 34 30 2e 31
D: 30 30 30 38 2e 31 2e 32 2e 34 2e 37 30 40 00 00
D: 13 31 2e 32 2e 38 34 30 2e 31 30 30 30 38 2e 31
D: 2e 32 2e 35 40 00 00 17 31 2e 32 2e 38 34 30 2e
D: 31 30 30 30 38 2e 31 2e 32 2e 34 2e 31 30 30 40
D: 00 00 17 31 2e 32 2e 38 34 30 2e 31 30 30 30 38
D: 2e 31 2e 32 2e 34 2e 31 30 31 40 00 00 17 31 2e
D: 32 2e 38 34 30 2e 31 30 30 30 38 2e 31 2e 32 2e
D: 34 2e 31 30 32 40 00 00 17 31 2e 32 2e 38 34 30
D: 2e 31 30 30 30 38 2e 31 2e 32 2e 34 2e 31 30 33
D: 20 00 01 0b 03 00 00 00 30 00 00 20 31 2e 32 2e
D: 38 34 30 2e 31 30 30 30 38 2e 35 2e 31 2e 34 2e
D: 31 2e 31 2e 37 37 2e 31 2e 32 2e 31 40 00 00 13
D: 31 2e 32 2e 38 34 30 2e 31 30 30 30 38 2e 31 2e
D: 32 2e 31 40 00 00 11 31 2e 32 2e 38 34 30 2e 31
D: 30 30 30 38 2e 31 2e 32 40 00 00 16 31 2e 32 2e
D: 38 34 30 2e 31 30 30 30 38 2e 31 2e 32 2e 34 2e
D: 35 37 40 00 00 16 31 2e 32 2e 38 34 30 2e 31 30
D: 30 30 38 2e 31 2e 32 2e 34 2e 37 30 40 00 00 13
D:
D: Parsing an A-ASSOCIATE PDU
I: Association Received
D: Parameters:
D: ====================== BEGIN A-ASSOCIATE-RQ =====================
D: Our Implementation Class UID: 1.2.276.0.7230010.3.0.3.6.7
D: Our Implementation Version Name: OFFIS_DCMTK_367
D: Their Implementation Class UID: 1.2.826.0.1.3680043.1.2.100.8.40.1206.0
D: Their Implementation Version Name: DicomObjects.NET
D: Application Context Name: 1.2.840.10008.3.1.1.1
D: Calling Application Name: DICOM_SERVER
D: Called Application Name: TEST-SCU
D: Responding Application Name:
D: Our Max PDU Receive Size: 16384
D: Their Max PDU Receive Size: 65536
D: Presentation Contexts:
D: Context ID: 1 (Proposed)
D: Abstract Syntax: =VLMicroscopicImageStorage
D: Proposed SCP/SCU Role: Default
D: Proposed Transfer Syntax(es):
D: =LittleEndianExplicit
D: =LittleEndianImplicit
D: =JPEGLossless:Non-hierarchical:Process14
D: =JPEGLossless:Non-hierarchical-1stOrderPrediction
D: =RLELossless
D: =MPEG2MainProfile@MainLevel
D: =MPEG2MainProfile@HighLevel
D: =MPEG4HighProfile/Level4.1
D: =MPEG4BDcompatibleHighProfile/Level4.1
D: Context ID: 3 (Proposed)
D: Abstract Syntax: =VideoMicroscopicImageStorage
D: Proposed SCP/SCU Role: Default
D: Proposed Transfer Syntax(es):
D: =LittleEndianExplicit
D: =LittleEndianImplicit
D: =JPEGLossless:Non-hierarchical:Process14
D: =JPEGLossless:Non-hierarchical-1stOrderPrediction
D: =RLELossless
D: =MPEG2MainProfile@MainLevel
D: =MPEG2MainProfile@HighLevel
D: =MPEG4HighProfile/Level4.1
D: =MPEG4BDcompatibleHighProfile/Level4.1
D: Context ID: 5 (Proposed)
D: Abstract Syntax: =SecondaryCaptureImageStorage
D: Proposed SCP/SCU Role: Default
D: Proposed Transfer Syntax(es):
D: =LittleEndianExplicit
D: =LittleEndianImplicit
D: =JPEGLossless:Non-hierarchical:Process14
D: =JPEGLossless:Non-hierarchical-1stOrderPrediction
D: =RLELossless
D: =MPEG2MainProfile@MainLevel
D: =MPEG2MainProfile@HighLevel
D: =MPEG4HighProfile/Level4.1
D: =MPEG4BDcompatibleHighProfile/Level4.1
D: Requested Extended Negotiation: none
D: Accepted Extended Negotiation: none
D: Requested User Identity Negotiation: none
D: User Identity Negotiation Response: none
D: ======================= END A-ASSOCIATE-RQ ======================
D: Constructing Associate AC PDU
I: Association Acknowledged (Max Send PDV: 65524)
D: ====================== BEGIN A-ASSOCIATE-AC =====================
D: Our Implementation Class UID: 1.2.276.0.7230010.3.0.3.6.7
D: Our Implementation Version Name: OFFIS_DCMTK_367
D: Their Implementation Class UID: 1.2.826.0.1.3680043.1.2.100.8.40.1206.0
D: Their Implementation Version Name: DicomObjects.NET
D: Application Context Name: 1.2.840.10008.3.1.1.1
D: Calling Application Name: DICOM_SERVER
D: Called Application Name: TEST-SCU
D: Responding Application Name: TEST-SCU
D: Our Max PDU Receive Size: 16384
D: Their Max PDU Receive Size: 65536
D: Presentation Contexts:
D: Context ID: 1 (Accepted)
D: Abstract Syntax: =VLMicroscopicImageStorage
D: Proposed SCP/SCU Role: Default
D: Accepted SCP/SCU Role: Default
D: Accepted Transfer Syntax: =LittleEndianExplicit
D: Context ID: 3 (Accepted)
D: Abstract Syntax: =VideoMicroscopicImageStorage
D: Proposed SCP/SCU Role: Default
D: Accepted SCP/SCU Role: Default
D: Accepted Transfer Syntax: =LittleEndianExplicit
D: Context ID: 5 (Accepted)
D: Abstract Syntax: =SecondaryCaptureImageStorage
D: Proposed SCP/SCU Role: Default
D: Accepted SCP/SCU Role: Default
D: Accepted Transfer Syntax: =LittleEndianExplicit
D: Requested Extended Negotiation: none
D: Accepted Extended Negotiation: none
D: Requested User Identity Negotiation: none
D: User Identity Negotiation Response: none
D: ======================= END A-ASSOCIATE-AC ======================
D: DcmDataset::read() TransferSyntax="Little Endian Implicit"
I: Received Store Request
D: ===================== INCOMING DIMSE MESSAGE ====================
D: Message Type : C-STORE RQ
D: Presentation Context ID : 3
D: Message ID : 26817
D: Affected SOP Class UID : VideoMicroscopicImageStorage
D: Affected SOP Instance UID : 1.2.826.0.1.3680043.9.6384.2.603.20230501130146.488.64
D: Data Set : present
D: Priority : medium
D: Move Originator AE Title : TEST-SCU
D: Move Originator ID : 8
D: ======================= END DIMSE MESSAGE =======================
E: Store SCP Failed: 0006:0317 Peer aborted Association (or never connected)
I: Association Aborted

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

Re: Download the MR image from a PACS server and save it in jpeg format.

#8 Post by Michael Onken »

Hi,

storescp per default only accepts uncompressed images. However, all images > 4 GB cannot be sent uncompressed.
Try the following to also allow the sender to send in JPEG Lossless:

Code: Select all

--prefer-lossless
If this does not work, try (not together, just one after another):
  • --prefer-rle
  • --prefer-mpeg2
  • --prefer-mpeg2-high
  • --prefer-mpeg4
  • --prefer-mpeg4-bd
BR Michael

omeryildiz
Posts: 15
Joined: Fri, 2023-04-28, 11:41

Re: Download the MR image from a PACS server and save it in jpeg format.

#9 Post by omeryildiz »

It's worked for uncompressed. Thank you for your interest

why sendMOVERequest can respond like this:

Peer aborted Association (or never connected)

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

Re: Download the MR image from a PACS server and save it in jpeg format.

#10 Post by Michael Onken »

That means that movescu has never been connected to the PACS or (in your case if you could retrieve the images) that the server hung up the connection to movescu. Maybe you can see the reason using --debug on movescu but probably its an error in the server.

omeryildiz
Posts: 15
Joined: Fri, 2023-04-28, 11:41

Re: Download the MR image from a PACS server and save it in jpeg format.

#11 Post by omeryildiz »

Thanks,

Can it also save with sendCGETRequest from PACS server?

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

Re: Download the MR image from a PACS server and save it in jpeg format.

#12 Post by Michael Onken »

Yes, look into dcmnet/apps/getscu.cc how to do that.

BR, Michael

omeryildiz
Posts: 15
Joined: Fri, 2023-04-28, 11:41

Re: Download the MR image from a PACS server and save it in jpeg format.

#13 Post by omeryildiz »

Thank you for your interest

omeryildiz
Posts: 15
Joined: Fri, 2023-04-28, 11:41

Re: Download the MR image from a PACS server and save it in jpeg format.

#14 Post by omeryildiz »

Hi,

The www.dicomserver.co.uk server was good. But, why it can fail with error from other server?

Code: Select all

movescu -v -S -k 0008,0052=STUDY -aet TEST -aec TEST xx.xxx.xxx.x 104 -k 0020,000D=1.2.392.200070.696771.22.689779044903.891492548 --debug

Code: Select all

D: $dcmtk: movescu v3.6.7+ DEV $
D:
D: Request Parameters:
D: ====================== BEGIN A-ASSOCIATE-RQ =====================
D: Our Implementation Class UID:      1.2.276.0.7230010.3.0.3.6.7
D: Our Implementation Version Name:   OFFIS_DCMTK_367
D: Their Implementation Class UID:
D: Their Implementation Version Name:
D: Application Context Name:    1.2.840.10008.3.1.1.1
D: Calling Application Name:    TEST 
D: Called Application Name:     TEST 
D: Responding Application Name:
D: Our Max PDU Receive Size:    16384
D: Their Max PDU Receive Size:  0
D: Presentation Contexts:
D:   Context ID:        1 (Proposed)
D:     Abstract Syntax: =FINDStudyRootQueryRetrieveInformationModel
D:     Proposed SCP/SCU Role: Default
D:     Proposed Transfer Syntax(es):
D:       =LittleEndianExplicit
D:       =BigEndianExplicit
D:       =LittleEndianImplicit
D:   Context ID:        3 (Proposed)
D:     Abstract Syntax: =MOVEStudyRootQueryRetrieveInformationModel
D:     Proposed SCP/SCU Role: Default
D:     Proposed Transfer Syntax(es):
D:       =LittleEndianExplicit
D:       =BigEndianExplicit
D:       =LittleEndianImplicit
D: Requested Extended Negotiation: none
D: Accepted Extended Negotiation:  none
D: Requested User Identity Negotiation: none
D: User Identity Negotiation Response:  none
D: ======================= END A-ASSOCIATE-RQ ======================
I: Requesting Association
D: setting network send timeout to 60 seconds
D: setting network receive timeout to 60 seconds
D: Constructing Associate RQ PDU
D: PDU Type: Associate Accept, PDU Length: 208 + 6 bytes PDU header
D:   02  00  00  00  00  d0  00  01  00  00  56  45  4e  54  20  20
D:   20  20  20  20  20  20  20  20  20  20  56  45  4e  54  20  20
D:   20  20  20  20  20  20  20  20  20  20  00  00  00  00  00  00
D:   00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
D:   00  00  00  00  00  00  00  00  00  00  10  00  00  15  31  2e
D:   32  2e  38  34  30  2e  31  30  30  30  38  2e  33  2e  31  2e
D:   31  2e  31  21  00  00  1b  01  00  00  00  40  00  00  13  31
D:   2e  32  2e  38  34  30  2e  31  30  30  30  38  2e  31  2e  32
D:   2e  31  21  00  00  1b  03  00  00  00  40  00  00  13  31  2e
D:   32  2e  38  34  30  2e  31  30  30  30  38  2e  31  2e  32  2e
D:   31  50  00  00  31  51  00  00  04  00  04  00  00  52  00  00
D:   13  31  2e  33  2e  36  2e  31  2e  34  2e  31  2e  33  30  30
D:   37  31  2e  38  55  00  00  0e  66  6f  2d  64  69  63  6f  6d
D:   20  34  2e  30  2e  38
D: Parsing an A-ASSOCIATE PDU
D: Association Parameters Negotiated:
D: ====================== BEGIN A-ASSOCIATE-AC =====================
D: Our Implementation Class UID:      1.2.276.0.7230010.3.0.3.6.7
D: Our Implementation Version Name:   OFFIS_DCMTK_367
D: Their Implementation Class UID:    1.3.6.1.4.1.30071.8
D: Their Implementation Version Name: fo-dicom 4.0.8
D: Application Context Name:    1.2.840.10008.3.1.1.1
D: Calling Application Name:    TEST 
D: Called Application Name:     TEST 
D: Responding Application Name: TEST 
D: Our Max PDU Receive Size:    16384
D: Their Max PDU Receive Size:  262144
D: Presentation Contexts:
D:   Context ID:        1 (Accepted)
D:     Abstract Syntax: =FINDStudyRootQueryRetrieveInformationModel
D:     Proposed SCP/SCU Role: Default
D:     Accepted SCP/SCU Role: Default
D:     Accepted Transfer Syntax: =LittleEndianExplicit
D:   Context ID:        3 (Accepted)
D:     Abstract Syntax: =MOVEStudyRootQueryRetrieveInformationModel
D:     Proposed SCP/SCU Role: Default
D:     Accepted SCP/SCU Role: Default
D:     Accepted Transfer Syntax: =LittleEndianExplicit
D: Requested Extended Negotiation: none
D: Accepted Extended Negotiation:  none
D: Requested User Identity Negotiation: none
D: User Identity Negotiation Response:  none
D: ======================= END A-ASSOCIATE-AC ======================
I: Association Accepted (Max Send PDV: 131060)
I: Sending Move Request
D: ===================== OUTGOING DIMSE MESSAGE ====================
D: Message Type                  : C-MOVE RQ
D: Presentation Context ID       : 3
D: Message ID                    : 1
D: Affected SOP Class UID        : MOVEStudyRootQueryRetrieveInformationModel
D: Data Set                      : present
D: Priority                      : medium
D: Move Destination              : TEST 
D: ======================= END DIMSE MESSAGE =======================
I: Request Identifiers:
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0052) CS [STUDY]                                  #   6, 1 QueryRetrieveLevel
I: (0020,000d) UI [1.2.392.200070.696771.22.689779044903.891492548] #  48, 1 StudyInstanceUID
I:
D: DcmDataset::read() TransferSyntax="Little Endian Implicit"
I: Received Move Response 1
D: ===================== INCOMING DIMSE MESSAGE ====================
D: Message Type                  : C-MOVE RSP
D: Message ID Being Responded To : 1
D: Affected SOP Class UID        : MOVEStudyRootQueryRetrieveInformationModel
D: Remaining Suboperations       : 0
D: Completed Suboperations       : 1
D: Failed Suboperations          : none
D: Warning Suboperations         : none
D: Data Set                      : none
D: DIMSE Status                  : 0xff00: Pending: Sub-operations are continuing
D: ======================= END DIMSE MESSAGE =======================
E: Move Request Failed: 0006:0317 Peer aborted Association (or never connected)
I: Peer Aborted Association

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

Re: Download the MR image from a PACS server and save it in jpeg format.

#15 Post by Michael Onken »

Hi,

Mh, hard to say, looks like a network problem or problem with dicomserver.co.uk. Probably you should check the server logs here: https://dicomserver.co.uk/logs/ when doing this request.

BR,
Michael

Post Reply

Who is online

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