How to populate request MessageId when deriving from DcmScu

All other questions regarding DCMTK

Moderator: Moderator Team

Message
Author
jogerh
Posts: 29
Joined: Mon, 2022-02-28, 08:55

How to populate request MessageId when deriving from DcmScu

#1 Post by jogerh » Mon, 2022-02-28, 21:42

I am implementing a class that inherits from DcmScu. This class is going to send a DIMSE message using DcmScu::sendDIMSEMessage. sendDIMSEMessage requires a T_DIMSE_Message message object which aggregates a MessageID. To ensure that the MessageID does not conflict with any of the message IDs that other DcmScu functions sends, I want to use DcmScu::nextMessageID, but this is a private function.

What is the appropriate way to generate message IDs for DIMSE messages in classes that inherit from DcmScu?

Any help is highly appreciated.

Jøger Hansegård
GE Vingmed Ultrasound
Last edited by jogerh on Thu, 2022-05-05, 20:46, edited 1 time in total.

J. Riesmeier
DCMTK Developer
Posts: 2365
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: How to populate request MessageId when deriving from DcmScu

#2 Post by J. Riesmeier » Tue, 2022-03-01, 09:53

Hi Jøger,

welcome to the DCMTK forum and thank you for your report.

As far as I understand, you want to implement new network functionality in the derived class that does not call any of the existing sendXXXRequest() methods. That means, you want to fill the low-level networking data structures directly and, therefore, need access to the next available Message ID. Is this correct? In this case, it would probably make sense to move the nextMessageID() method from the "private" to the "protected" section of the DcmSCU class.

Regards,
Jörg

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

Re: How to populate request MessageId when deriving from DcmScu

#3 Post by Michael Onken » Wed, 2022-03-02, 09:37

Hi Jøger,

DcmSCU uses nextMessageID() to get the message ID to be used when sending any DIMSE message over the network, i.e. when the user makes use of the sendECHORequest(), sendSTORERequest() and so on. As long as you use those methods the message ID in your derived class is fine.

My feeling is that nextMesssageID() should stay private unless there is a very good reason to make it protected. So my question is why you want to use sendDIMSEMessage() directly and not use the high level methods? If a feature is missing on the high level calls we could maybe extend them.

Another way to fix your use case is to move the call to nextMessageID() into sendDIMSEMessage() instead, which would probably make the most sense to me. Then it would not matter if you call sendDIMSEMessage() for your custom use case or use the high level API send...Request(). I need to check whether this change in DcmSCU is really possible, though.

Best regards,
Michael

jogerh
Posts: 29
Joined: Mon, 2022-02-28, 08:55

Re: How to populate request MessageId when deriving from DcmScu

#4 Post by jogerh » Wed, 2022-03-02, 15:57

Thank you Michael and Jörg,

I am currently implementing support for sending N-CREATE and N-SET requests and receiving the responses. These service elements are not supported through the high level DcmScu API as far as I can tell. So Michael, you have the correct understanding of the problem.

For my purpose it would be perfect to have public high level functions to handle these messages, but this could of course be in conflict with other interests. Still, allowing DcmScu::sendDIMSEMessage to populate the message ID would be a useful feature. With the current API, it does not seem possible to use DcmScu::sendDIMSEMessage correctly in the general sense, even if it is available to derived classes as a protected function. Making nextMesssageID protected would be a workaround that would make sendDIMSEMessage possible to use correctly, but I agree this is maybe not an optimal solution as it unnecessarily exposes an implementation detail.

Do I understand the situation correctly, or are there other ways of approaching the problem that I missed?

Thanks,
Jøger Hansegård
GE Vingmed Ultrasound

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

Re: How to populate request MessageId when deriving from DcmScu

#5 Post by Michael Onken » Wed, 2022-03-02, 16:15

Hi Jøger,

we should then introduce sendNCREATERequest() and sendNSETRequest() as public methods. If you write the code anyway, could you send me a patch as a starting point? I would then make modifications as necessary to make it part of DCMTK.

Also, I will check whether we can safely move nextMessageID() to sendDIMSERequest() which would solve your problem independent from the fact whether you want to provide a patch to DCMTK or not.

Best regards,
Michael

jogerh
Posts: 29
Joined: Mon, 2022-02-28, 08:55

Re: How to populate request MessageId when deriving from DcmScu

#6 Post by jogerh » Fri, 2022-03-04, 12:30

Please see https://github.com/DCMTK/dcmtk/pull/52. Maybe we could discuss a bit there?

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

Re: How to populate request MessageId when deriving from DcmScu

#7 Post by Michael Onken » Fri, 2022-03-04, 14:58

Hi Jøger,

awesome, I'll review that in the next days and let you know.

Best regards,
Michael

jogerh
Posts: 29
Joined: Mon, 2022-02-28, 08:55

Re: How to populate request MessageId when deriving from DcmScu

#8 Post by jogerh » Thu, 2022-03-10, 14:58

Hi Michael,

How is the progress on the review?

Thanks,
Jøger

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

Re: How to populate request MessageId when deriving from DcmScu

#9 Post by Michael Onken » Thu, 2022-03-10, 15:24

Hi Jøger,

I did not find time so far, sorry, I hope it will be done by the end of the week.

Best regards,
Michael

jogerh
Posts: 29
Joined: Mon, 2022-02-28, 08:55

Re: How to populate request MessageId when deriving from DcmScu

#10 Post by jogerh » Sat, 2022-03-19, 08:35

Hi again Michael,

Have you had time to look at the pull request yet?

Thanks,
Jøger

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

Re: How to populate request MessageId when deriving from DcmScu

#11 Post by Michael Onken » Tue, 2022-03-22, 11:21

Hi Jøger,

I got ill last week and start to work this week again. Sorry for the delay.

Best regards,
Michael

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

Re: How to populate request MessageId when deriving from DcmScu

#12 Post by Michael Onken » Tue, 2022-03-22, 14:21

Please see my comments on GitHub.

jogerh
Posts: 29
Joined: Mon, 2022-02-28, 08:55

Re: How to populate request MessageId when deriving from DcmScu

#13 Post by jogerh » Tue, 2022-03-22, 14:47

Thank you Michael!

Then I will go ahead and implement N-SET following a similar pattern.

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

Re: How to populate request MessageId when deriving from DcmScu

#14 Post by Michael Onken » Tue, 2022-03-22, 15:10

Great! :-)

jogerh
Posts: 29
Joined: Mon, 2022-02-28, 08:55

Re: How to populate request MessageId when deriving from DcmScu

#15 Post by jogerh » Tue, 2022-03-22, 17:20

Hi Michael,

I am struggling a bit with GitHub now, but please see https://github.com/DCMTK/dcmtk/pull/57

It contains a draft implementation for the N-SET support in DcmScu. I am a bit unsure if I understood N-SET correctly, so please feel free to comment.

Post Reply

Who is online

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