DCMPRINT : psvlocsv.cc : Where does it receive the final ps size? eg A4,A3, ...

Questions regarding the DCMPRINT library, a DCMTK add-on that implements a DICOM Print Management SCP and SCU

Moderator: Moderator Team

Post Reply
Message
Author
ruben.cruz
Posts: 43
Joined: Fri, 2019-05-03, 15:06

DCMPRINT : psvlocsv.cc : Where does it receive the final ps size? eg A4,A3, ...

#1 Post by ruben.cruz » Fri, 2021-06-18, 09:42

Where does it receive the final ps size? eg A4,A3, ...
I need to know what funtion it uses cause i need to compare it to some values in my database.

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1297
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: DCMPRINT : psvlocsv.cc : Where does it receive the final ps size? eg A4,A3, ...

#2 Post by Marco Eichelberg » Thu, 2021-07-08, 10:56

The print client selects the page size by sending the attribute (2010,0050) Film Size ID in the Basic Film Box N-CREATE-RQ message (i.e. the message that creates a new page of hardcopy). If the print client does not send the attribute, the print server will select its own default.

In the DCMPRINT SCP, the supported values for "Film Size ID" are defined in the section [[PAGE SIZE]] of the configuration file. For each defined film size, it is possible to add PostScript code that selects a certain paper format or paper tray.

ruben.cruz
Posts: 43
Joined: Fri, 2019-05-03, 15:06

Re: DCMPRINT : psvlocsv.cc : Where does it receive the final ps size? eg A4,A3, ...

#3 Post by ruben.cruz » Mon, 2021-07-12, 16:08

Hi, tank you for your help, but it didnt help much with my specific problem. I need to check get with my code what values is receiving inside "puniverse.universe.anchor.pred.value" when it gets to the BasicFilmBox. I need to get fim size and edit it. I tried overriding "PSVDicomObjectUniverse" but there are to many dependencies who wont accept my override class, and i would need to override them all... How could i manage to do this?

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1297
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: DCMPRINT : psvlocsv.cc : Where does it receive the final ps size? eg A4,A3, ...

#4 Post by Marco Eichelberg » Tue, 2021-07-20, 10:07

I think the most appropriate place to check this would be the method PSVBasicFilmBox::n_create(), implemented in psvbfb.cc. This is the method that examines the incoming N-CREATE-RQ message for a new basic film box (i.e., page) and reads the Film Size attribute that determines the page size:

Code: Select all

      else if (inobject.compareCurrentXTag(DCM_FilmSizeID))
      {
        if (TMPfilmSize.canreadfrom(inobject))
        {
          TMPfilmSize.readfrom(inobject);
          found_filmSize=1;
        } else if (!ignoreEmptyAttributes) status=STATUS_INVALIDATTRIBUTEVALUE;
      }
This method also retrieves the default value from the configuration file in case the client does not explicitly request a specific Film Size:

Code: Select all

    if ((! found_filmSize)||((TMPfilmSize == "") && ignoreEmptyAttributes))
    {
       config.set_section(1,L1_DEFAULTS);
       if (config.section_valid(1)) config.set_section(0, L0_PAGESIZE);
       if (config.section_valid(0))
       TMPfilmSize = PSVConfigHelper::get_key_value(config);
       else
       {
         status=STATUS_PROCESSINGFAILURE;
         passertion("n_create","config file: layout entry " L1_DEFAULTS
         "/" L0_PAGESIZE " missing", (0));
       }
    }
The method PSVBasicFilmBox::n_create() is called from PSVDicomObjectUniverse::dispatchMessage(), which in turn is called by the main message loop PSVPrintServer::messageLoop().

ruben.cruz
Posts: 43
Joined: Fri, 2019-05-03, 15:06

Re: DCMPRINT : psvlocsv.cc : Where does it receive the final ps size? eg A4,A3, ...

#5 Post by ruben.cruz » Tue, 2021-07-20, 10:47

ty for your help, I already had found out that it came from dispatchMessage(), but for you what woud be the best option to get that value and change it if necessary?

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1297
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: DCMPRINT : psvlocsv.cc : Where does it receive the final ps size? eg A4,A3, ...

#6 Post by Marco Eichelberg » Tue, 2021-07-20, 10:57

This is the code in PSVBasicFilmBox::n_create() where the value of Film Size is finally set.
If you simply set filmSize to some other value, that other value will be used:

Code: Select all

      if (config.section_valid(1))
      {
        filmSize = TMPfilmSize; // <--- HERE
        filmSize.writeto(outobject, DCM_FilmSizeID);
      } else {
        status=STATUS_PROCESSINGFAILURE;
        passertion("n_create","film size ID unknown",(0));
      }

ruben.cruz
Posts: 43
Joined: Fri, 2019-05-03, 15:06

Re: DCMPRINT : psvlocsv.cc : Where does it receive the final ps size? eg A4,A3, ...

#7 Post by ruben.cruz » Wed, 2021-07-21, 16:29

ok, i understood that so at the moment im trying to override the "PSVBasicFilmBox::n_create" funtion.
This is my override funtion but i have those errors. How could i solve this problem without overriding "PSVBasicFilmSession::registerFilmBox" to accept my overrided class?
Image
Image

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1297
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: DCMPRINT : psvlocsv.cc : Where does it receive the final ps size? eg A4,A3, ...

#8 Post by Marco Eichelberg » Fri, 2021-07-23, 16:34

If you want your class PSVBasicFilmBox1 to be usable in place of PSVBasicFilmBox, then it must be derived from that

class PSVBasicFilmBox1: public PSVBasicFilmBox
{
...
};

That would allow you to overload the n_create() method, which is virtual and thus permits overloading.
However, that will not be sufficient because the n_create() method accesses member variables in class PSVBasicFilmBox that are private and not accessible to PSVBasicFilmBox1.
In order to change that, you would have to modify the "private:" declaration in psvbfb.h to "protected:". However, once you start modifying the DCMPRSCP code, you could as well add your code directly in PSVBasicFilmBox::n_create(), which would probably be much easier. This would be my recommendations: Make the changes in psvbfb.cc directly (since you have the full source code for the DCMPRSCP module) and mark them clearly for the case that you later want to port that to a future DCMPRSCP release:

Code: Select all

#ifndef DISABLE_MY_MODIFICATIONS
// your modifications here
#endif

ruben.cruz
Posts: 43
Joined: Fri, 2019-05-03, 15:06

Re: DCMPRINT : psvlocsv.cc : Where does it receive the final ps size? eg A4,A3, ...

#9 Post by ruben.cruz » Fri, 2021-07-23, 16:54

i will add all code to my derived class, i dont want de change the original cause it will make my life eazy later when you guys update libs.
Ty for your help, how could i be so blind that i didnt see that i was making that mistake while overring... I already overrided PSVPrintServer in the past like u said and now i make this mistake... ty

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest