DICOM Print SCP

4,098 views
Skip to first unread message

Hesham Desouky

unread,
Sep 5, 2014, 2:19:49 PM9/5/14
to fo-d...@googlegroups.com
I have a good news, I finally finished the DICOM Print SCP implementation for fo-dicom (a pull request already created to rcd/fo-dicom)

The implementation includes changes in DICOM project to include DICOM Print classes, plus tweaks to DicomService class to support Meta classes communication required by the DICOM PRINT SCP.

Also i created an example under Examplers folder (PRINT_SCP). This example will receive print requests from SCUs and create print outs using the Microsoft XPS Document Writer printer (the XPS virtual printer driver should be installed prior to try the example otherwise it will not print)

If you want to give it a try until the pull request is merged to the main stream, you can pull my latest bits from hdesouky/fo-dicom.

Thanks

Chris Horn

unread,
Sep 7, 2014, 9:34:21 PM9/7/14
to fo-d...@googlegroups.com
Nice work Hesham, I can't wait to have a look

Chris Horn

unread,
Sep 21, 2014, 9:14:22 PM9/21/14
to fo-d...@googlegroups.com
Hi Hesham,

I've had a chance to have a quick play with the SCP and have come across an issue, the out put seems to always invert... no matter what I set in the print program.
Also I get the  following non-critical error in the log:
Requested abstract syntax Presentation LUT SOP Class [1.2.840.10008.5.1.1.23] from MINIME_SCU not supported

I have attached some files for you it looks like it's getting there
1.3.6.1.4.1.30071.8.224.4646632055717853.xps
log.txt

Hesham Desouky

unread,
Sep 23, 2014, 12:50:23 AM9/23/14
to fo-d...@googlegroups.com
Hi Chris,

I am so glad you got time to try the new print scp implementation.

You are right regarding the presentation lut implementation, it is not implemented since I didn't find a print scu that support printing image boxes with presentation lut.

This missing implementation explains why you are getting the negative output. The submitted code is tried with e-Filme and many real world modalities in production deployments and it work ok since none of these installations uses prsentation lut.


To be able to help, please share the study images and give me pointer to the print scu application you used to be able to implement the presentation lut support.

Regards,

Hesham

Noster Gerald

unread,
Oct 29, 2014, 6:17:54 AM10/29/14
to fo-d...@googlegroups.com
Hi Hesham,

thank you so much for your great work. I tried it out and it works perfect. Really very good ...

Regards,
Gerald

Hesham Desouky

unread,
Oct 29, 2014, 6:07:36 PM10/29/14
to fo-d...@googlegroups.com
You are welcome :)

Chris Horn

unread,
Oct 29, 2014, 11:15:52 PM10/29/14
to fo-d...@googlegroups.com
Hi Heasham,

Are you any closer to releasing to PrintClient ? or SCU like was available for mdcm?
Also with regard to my last post, the presentation lut example code came from a modified example of Colby's original Dicomprint sample still trying to find where I put it.

Chris Horn

unread,
Oct 29, 2014, 11:28:42 PM10/29/14
to fo-d...@googlegroups.com
if I remember correctly i got the code for the lut bits from here

https://groups.google.com/forum/?fromgroups#!searchin/mdcm/print/mdcm/kS-UGlCibKA/Q2AiAuxR6PEJ

Abdelmjid Elkihel

unread,
Feb 25, 2015, 7:16:52 PM2/25/15
to fo-d...@googlegroups.com
Hi Hesham
are you worked with dcm4che with a modality for example Agfa CR 35 -X whether I want to know how to send the identification of the patient to the cassette.
Thanks in advance

Hesham Desouky

unread,
Feb 26, 2015, 3:19:51 AM2/26/15
to fo-d...@googlegroups.com
I didn't use dcm4che before, but I didn't understand what do you want to do exactly?

Noster Gerald

unread,
Mar 1, 2015, 1:56:13 PM3/1/15
to fo-d...@googlegroups.com
AGFA CR 35 is an Image Reader and if you want to send Patient Information to the modality, you need Worklist MWL function to do that.

Leonardo Amaral

unread,
May 28, 2015, 8:44:17 PM5/28/15
to fo-d...@googlegroups.com
Hi Hesham...
I need you help...I'm test your PrintSCP, but I dont have sucess. I need print a images from Pacs Carestream and I save in folder. I know, this function dont send information the patient, study and series. This information I give from StoreSCP and I marge with the print dicom and I send to Pacs.
The process is very slow, in the finish return an error and the dicom file dont open.
You need I help?
Attached I send printscreen.

Sorry, my english.

Att.

Leonardo
Erro.jpg

Hesham Desouky

unread,
May 30, 2015, 7:01:23 PM5/30/15
to fo-d...@googlegroups.com
Hi Leonardo,

I didn't get exactly what issue you are facing? which part didn't work and what is slow?

To be able to help, please elaborate more :)

Thanks

Leonardo Amaral

unread,
May 30, 2015, 8:13:21 PM5/30/15
to fo-d...@googlegroups.com
Hi, Hesham.
Thank you answer me.
I need print an imagem the Pacs Carestream and save in dcm into folder.
The system PrintSCP is excellent, besause save the xps and dcm, but When I send print command the Pacs, the system pause and show error mensage "socket error while reading PDU." I think this error mensage is time out, but I dont have a ideia. The file xps is OK, the file dcm has a error.
You know what can it be?

Hug
Leonardo

Leonardo Amaral

unread,
Jun 3, 2015, 2:00:01 PM6/3/15
to fo-d...@googlegroups.com
Hi...
I sucess in my print job. This file I000001.dcm dont open???
I dont open in my viewer.

Thanks

Leonardo

Adil Tiadi

unread,
Jun 8, 2015, 6:35:13 AM6/8/15
to fo-d...@googlegroups.com
Hi,

Yes you can't open the dicomfile just because you need to merge dataset of filmsession and filmbox and imagebox (don't forget to get all data of imagesequence in your new dataset).
Try to open (after merging all these datasets) with dicomdump in fo-dicom tools.

It worked for me (I opened images with imagej and all others viewers).

Good luck.

Best regards,

Adil

Leonardo Amaral

unread,
Jun 9, 2015, 3:25:37 PM6/9/15
to fo-d...@googlegroups.com
Thank's.

I did the merging with head dicom, but the file dont opened.
What the program you used the merging head dicom?

Hug

Adil Tiadi

unread,
Jun 9, 2015, 5:03:23 PM6/9/15
to fo-d...@googlegroups.com
Hi,

I think that you add imagesequence as a DICOM sequence.
You need to add to your dataset each content of this sequence.

I didn't use any external application...
I just modified a little the function Save in the class  Film.cs in Dicom\Printing\Filmbox.cs.
Here is my code... It's create a dicom file without extension readable with DICOM Viewer.

public void Save(string filmBoxFolder)
{
    var filmBoxDicomFile = string.Format(@"{0}\FilmBox.dcm", filmBoxFolder);
    var file = new DicomFile(this);
    file.Save(filmBoxDicomFile);
    var imageBoxFolderInfo = new System.IO.DirectoryInfo(string.Format(@"{0}\Images", filmBoxFolder));
    imageBoxFolderInfo.Create();
    for (int i = 0; i < this.BasicImageBoxes.Count; i++)
    {
        var imageBox = this.BasicImageBoxes[i];
        imageBox.Save(string.Format(@"{0}\I{1:000000}", imageBoxFolderInfo.FullName, i + 1));

        // New Dataset to have a readable image with DICOM Viewer (like Weasis, ImageJ...)
        DicomDataset ds = new DicomDataset();
        _filmSession.CopyTo(ds); 
        this.CopyTo(ds);

        if (imageBox.ImageSequence!=null)
            imageBox.ImageSequence.CopyTo(ds);

        // Optionnal informations to add (missing dicomtags?)
        ds.Add(DicomTag.AcquisitionDate, DateTime.Today.ToString("yyyyMMdd"));
        ds.Add(DicomTag.AcquisitionTime, DateTime.Now.ToString("HHmmss"));
        // Modality HC or SC?
        ds.Add(DicomTag.SOPClassUID, DicomUID.SecondaryCaptureImageStorage.UID);
        
        var test = new DicomFile(ds);
        test.Save(string.Format(@"{0}\I{1:000000}", imageBoxFolderInfo.FullName, i + 1));
    }
}

Hope that will help you my code (I did it from scratch because I didn't have the code here with me).
If you need some help, attach a sample file of your dicom file merged and I take a look.

Best regards,

Adil

Leonardo Amaral

unread,
Jun 16, 2015, 3:35:12 PM6/16/15
to fo-d...@googlegroups.com
Hi,
Thank's Adil. 
I used your code as the basis for my build and successfully.
Follows the changed code, I use a file received from dicom StorageSCP to create the new file header.

I do not know if you can help me further, the problem now is that when the print has more than one page, then only leaves current page, the others do not go.


public void Save(string filmBoxFolder)
        {
            var filmBoxDicomFile = string.Format(@"{0}\FilmBox.dcm", filmBoxFolder);
            var filmBoxTextFile = string.Format(@"{0}\FilmBox.txt", filmBoxFolder);
            var file = new DicomFile(this);
            file.Save(filmBoxDicomFile);

            var imageBoxFolderInfo = new System.IO.DirectoryInfo(string.Format(@"{0}\Images", filmBoxFolder));
            imageBoxFolderInfo.Create();
            for (int i = 0; i < this.BasicImageBoxes.Count; i++)
            {
                var imageBox = this.BasicImageBoxes[i];
                imageBox.Save(string.Format(@"{0}\I{1:000000}", imageBoxFolderInfo.FullName, i + 1));

                // Abrir o aquivo DICOM modelo para pegar o cabeçalho
                var fileopen = DicomFile.Open(@"C://Impressao//Stemp//Store");
                
                // Criar o novo dataset
                DicomDataset ds = new DicomDataset();
                _filmSession.CopyTo(ds);
                this.CopyTo(ds);

                if (imageBox.ImageSequence != null)
                    imageBox.ImageSequence.CopyTo(ds);

                // Copiar as informacoes do arquivo aberto
                //ds.Add(DicomTag.StudyDate, DateTime.Today.ToString("yyyyMMdd"));
                //ds.Add(DicomTag.StudyTime, DateTime.Now.ToString("HHmmss"));
                //ds.Add(DicomTag.AcquisitionDate, DateTime.Today.ToString("yyyyMMdd"));
                //ds.Add(DicomTag.AcquisitionTime, DateTime.Now.ToString("HHmmss"));
                var stdate = fileopen.Dataset.Get<string>(DicomTag.StudyDate);
                ds.Add(DicomTag.StudyDate, stdate);
                var sttime = fileopen.Dataset.Get<string>(DicomTag.StudyTime);
                ds.Add(DicomTag.StudyTime, sttime);
                var sedate = fileopen.Dataset.Get<string>(DicomTag.SeriesDate);
                ds.Add(DicomTag.SeriesDate, sedate);
                var setime = fileopen.Dataset.Get<string>(DicomTag.SeriesTime);
                ds.Add(DicomTag.SeriesTime, setime);
                var stacquidate = fileopen.Dataset.Get<string>(DicomTag.AcquisitionDate);
                ds.Add(DicomTag.AcquisitionDate, stacquidate);
                var seacquitime = fileopen.Dataset.Get<string>(DicomTag.AcquisitionTime);
                ds.Add(DicomTag.AcquisitionTime, seacquitime);
                ds.Add(DicomTag.SOPClassUID, DicomUID.SecondaryCaptureImageStorage.UID);
                ds.Add(DicomTag.Modality, "SC");
                var patientid = fileopen.Dataset.Get<string>(DicomTag.PatientID);
                ds.Add(DicomTag.PatientID, patientid);
                var patientname = fileopen.Dataset.Get<string>(DicomTag.PatientName);
                ds.Add(DicomTag.PatientName, patientname);
                var acnumber = fileopen.Dataset.Get<string>(DicomTag.AccessionNumber);
                ds.Add(DicomTag.AccessionNumber, acnumber);
                ds.Add(DicomTag.SeriesDescription, "IMPRESSAO_TESTE");
                var mediastorage = fileopen.Dataset.Get<string>(DicomTag.MediaStorageSOPInstanceUID);
                ds.Add(DicomTag.MediaStorageSOPClassUID, mediastorage);
                var sinstance = fileopen.Dataset.Get<string>(DicomTag.StudyInstanceUID);
                ds.Add(DicomTag.StudyInstanceUID, sinstance);
                var seinstance = fileopen.Dataset.Get<string>(DicomTag.StudyInstanceUID);
                ds.Add(DicomTag.SeriesInstanceUID, seinstance);
                var imgtype = fileopen.Dataset.Get<string>(DicomTag.ImageType);
                ds.Add(DicomTag.ImageType, imgtype);
                ds.Add(DicomTag.SeriesNumber, "2015");
                
                var test = new DicomFile(ds);
                test.Save(string.Format(@"{0}\{1:Impressao}", @"C://Impressao//Ptemp", i + 1));

            }
        } 


Hug's

Leonardo

Adil Tiadi

unread,
Jun 17, 2015, 6:14:54 AM6/17/15
to fo-d...@googlegroups.com
Hi,

Did you change the code elsewhere?
If you comment the part where you add dicom store information, did it work?


Can you put your dicom store file in order to try your code and your file on my computer?
Maybe add a try catch to see if you do not have an exception with your dicom store information.

I will try with some dicom store image on my computer....and I will let you know if it's work for me with your code!

Best regards.

Adil.

Leonardo Amaral

unread,
Jun 17, 2015, 8:51:13 AM6/17/15
to fo-d...@googlegroups.com
I think this part of code 

            for (int i = 0; i < this.BasicImageBoxes.Count; i++)
            {
                var imageBox = this.BasicImageBoxes[i];
                imageBox.Save(string.Format(@"{0}\I{1:000000}", imageBoxFolderInfo.FullName, i + 1));

Should generate one file for each page ... or a file with every page ...

Hugs

Leonardo Amaral

unread,
Jun 18, 2015, 11:25:24 AM6/18/15
to fo-d...@googlegroups.com
Hi,

I did a test using the original format fo-dicom, of plumb and so when I send print even with three pages only comes out in the first dicom file.
I'm out of ideas, anyone know what might be?

Hugs

Adil Tiadi

unread,
Jun 22, 2015, 4:25:17 AM6/22/15
to fo-d...@googlegroups.com
Hi,

Sorry to be late to answer... Maybe the trouble is coming from your dicom print SCU.
Did you try with some free Print SCU like (like jdicom) or some free viewer with PrintSCU (like Weasis)?
I can just tell you that it works for me...

Best regards,

Adil.

Leonardo Amaral

unread,
Jun 23, 2015, 9:30:27 AM6/23/15
to fo-d...@googlegroups.com
Thanks for the reply, I auditioned using Osirix and worked, including the header DIOCOM I added.
Just could not resolve this error PDU.
Someone can tell me if you have how to disable it?

Hugs

Adil Tiadi

unread,
Jun 23, 2015, 9:40:27 AM6/23/15
to fo-d...@googlegroups.com
Hi, 

Do you have this error only with your Carestream Vue PACS or with OSIRIX too?
And if you can put as linked file your output log file.

Best regards,

Adil


Leonardo Amaral

unread,
Jun 23, 2015, 9:54:39 AM6/23/15
to fo-d...@googlegroups.com
Hi,
Only with Carestream Vue PACS ... I used to test the old projet of Colby, printing paper, and it worked without errors. I do not understand why this PrintSCP fo-dicom this with this error. It is as if the connection is not closed.
Where do I get this log?

Thanks again.

Adil Tiadi

unread,
Jun 23, 2015, 10:10:40 AM6/23/15
to fo-d...@googlegroups.com
Hi,

you have just to copy and paste the dos console where you get the pdu error.
Please first of all, increase the content of buffer of your dos console window in order to have all dicom communications.

I use my software with many constructor and I got some client with Mx PACS and Masterpage.
And it work without trouble. Maybe it's only a configuration trouble (in your carestream vue pacs or in your DICOM Print SCP) like timeout,....

See you soon. ;)

Leonardo Amaral

unread,
Jun 23, 2015, 11:36:54 AM6/23/15
to fo-d...@googlegroups.com
Thanks for attention.
Sorry for the inconvenience, it is that here in Brazil don't have much information on this subject. Follow the log screen print.

Hug
Done.jpg

Leonardo Amaral

unread,
Jun 23, 2015, 12:55:33 PM6/23/15
to fo-d...@googlegroups.com
My settings the Pacs.


Conf_print.jpg

Adil Tiadi

unread,
Jun 25, 2015, 7:53:01 AM6/25/15
to fo-d...@googlegroups.com
Hi,

I tried to see if some of my customers own Carestream Vue PACS.
Unfortunately, no! :(
If you want we can try this: 
- I put my computer on DICOM Print SCP (fo-dicom)
- I give you my ip and port and you configure your node with my informations.
- Then you send me one image to print and I will debug your trouble (maybe with our two brains with can fix it).
So the best way is now to leave the forum and try to get in touch with mail or skype and prepare an appointment.


Best regards,

Adil
Message has been deleted

Adil Tiadi

unread,
Jun 25, 2015, 9:28:34 AM6/25/15
to fo-d...@googlegroups.com
hi,

you do not add at between your mail and gmail.com.
I can read your mail.

best regards.


Adil Tiadi

unread,
Jun 25, 2015, 9:28:57 AM6/25/15
to fo-d...@googlegroups.com
forgot i can read it sorry

Leonardo Amaral

unread,
Jun 26, 2015, 2:00:24 PM6/26/15
to fo-d...@googlegroups.com
Hi,
I managed to solve the problem of incompatibility of PrintSCP with the Carestream PACS Vue with help of Adil.
The solution was to comment on the function:

// void OnPrintJobStatusUpdate (object sender, and StatusUpdateEventArgs)
         // {
           // Var PrintJob = PrintJob the sender;
            // If (printJob.SendNEventReport)
            // {
              // Var = new reportRequest DicomNEventReportRequest (printJob.SOPClassUID, printJob.SOPInstanceUID, e.EventTypeId);
                // Var ds = new DicomDataset ();
                // Ds.Add (DicomTag.ExecutionStatusInfo, e.ExecutionStatusInfo);
                // Ds.Add (DicomTag.FilmSessionLabel, e.FilmSessionLabel);
                // Ds.Add (DicomTag.PrinterName, e.PrinterName);

                // ReportRequest.Dataset = ds;
                // This.SendRequest (reportRequest);
            //}
        //}

and lines:

   //printJob.SendNEventReport = _sendEventReports;
   //printJob.StatusUpdate + = OnPrintJobStatusUpdate;

Thank you all.

hugs

prakkash...@gmail.com

unread,
Sep 9, 2016, 12:28:38 AM9/9/16
to Fellow Oak DICOM
Hi Hesham

I tried fo dicom print scp with few modalities. It seems there is one bug. Some time when I send new job to print scp it prints old job.
I also want to know whether 12 and 16 bit greyscale images are printed with the same depth or are reduced to 8 bit in windows printing.

Prakkash 

Oliver Feng

unread,
Aug 4, 2017, 2:20:40 PM8/4/17
to Fellow Oak DICOM
thank you for your great job! 
I'm developing a software. With a function--The DICOM printing images passed to the printer are saved as BMP files . My development tool is VS c#, so I chose fo-dicom implementation as the base,  in other words fo-dicom Printscp.
 I imported the project into my development environment and made a simple test –run the Printscu example -Send the printing task to Printscp .  It doest work well ,not printed. Carefully tracking , there should be normal conversation, but no image is available at  the print job folder .

 I'm a new developer and not familiar with the DICOM protocol. I know  occasionally device incompatibility in communicating , But why fo dicom Print scu is incompatible with fo dicom Print scp.

no one in this group has encountered this problem . So I believe in something wrong with my test environmental . Who can point it out?

无标题1.jpg
无标题2.jpg
无标题3.jpg
Message has been deleted

Anders Gustafsson Cureos AB

unread,
Aug 7, 2017, 3:01:06 AM8/7/17
to Fellow Oak DICOM
Hi Oliver,

you seem to be using an older version of the fo-dicom samples. Version number says 1.1.0. Please download the latest commit from the samples repository and give that a try.

Regards,
Anders @ Cureos

Oliver Feng

unread,
Sep 26, 2017, 3:24:02 AM9/26/17
to Fellow Oak DICOM
Thank you very much, Anders.I take your advice,try the latest version ,and it works well .
Best wish!

Mohamed Abd Elnaby

unread,
Nov 30, 2017, 2:36:47 PM11/30/17
to Fellow Oak DICOM
استاذ هشام اتمني لو في رقم تليفون اقدر اكلم حضرتك عليه ،، لان للأسف انا توهت من كميه الكومنتات اللي مكتوبه ومعرفش الموضوع انتهي علي ايه

ياريت اي طريقه للتواصل

وفعلا انا سعيد اكتر من حضرتك لان في حد مصري قدر يحط اسمه في المجال دا وبقوه لاني بقالي شهور بتابع موضوع الطباعه علي ورق دا بطريقه كويسه وبسيطة وللأسف ماوصلتش لحاجه
اتمني يكون في طريقه للتواصل
شكرا

BRAHAM PRAKASH YADAV

unread,
Jan 23, 2019, 1:33:51 AM1/23/19
to Fellow Oak DICOM
Its really great but its output negative form, I m unable to find the resason plz help me make it inverse.
Thank You
Reply all
Reply to author
Forward
0 new messages