Desperately need a Dicom SR example

3,786 views
Skip to first unread message

Rogerio Ribeiro

unread,
Aug 31, 2016, 12:19:07 PM8/31/16
to Fellow Oak DICOM
I'm trying to implement in a tool I'm developing the ability to export radiological reports in DICOM SR format, using fo-dicom (C#). The problem is I can't find any example on how to accomplish that... There are no Dicom SR samples in the samples folder. Can anyone give me any directions? Thank you in advance

Adil Tiadi

unread,
Sep 1, 2016, 4:17:05 AM9/1/16
to Fellow Oak DICOM
Hi,

Here you will find some DICOM SR samples (Basic Text, Enhanced, Comprehensive) : Samples DICOM SR (dcmtk)
You can use DicomScope to read this SR files and you see the output result.

Here a link for the "bible" of Dicom SR : Dicom SR book

Hope that will help you in your work.

Just one more thing maybe you can try to use DICOM Encapsulation of PDF Documents for your radiological reports.
It's more easy to do and use and you will have a formated document (bold font, underlined text, ...).

Best regards.

Adil TIADI

Queo Sistemas

unread,
Sep 6, 2016, 8:37:43 AM9/6/16
to Fellow Oak DICOM
Thank you very much for your suggestions, Adil!

Rogerio Ribeiro

unread,
Sep 6, 2016, 8:41:28 AM9/6/16
to Fellow Oak DICOM
Thank you very much!

Adil Tiadi

unread,
Sep 7, 2016, 2:18:46 AM9/7/16
to Fellow Oak DICOM
Hi 

You are welcome!
If you need more support, ask and i will try to answer asap.

Adil.



Dr. Cuauhtémoc Rossell

unread,
Sep 7, 2016, 10:28:16 AM9/7/16
to Fellow Oak DICOM
Hello Rogerio Ribeiro :
I have been working with Fo-Dicom to create DICOM-SR for several years and it Works!!. If you are interested I can send you some working code

Dr. Cuauhtémoc Rossell


Rogerio Ribeiro

unread,
Sep 8, 2016, 10:16:51 AM9/8/16
to Fellow Oak DICOM
Thank you very much for your kindness. 
I eventually managed to make it work too, al least "in concept" ;) I based myself partially in your shared code, and also in some of your messages about foreign character encoding issues, and I was able to generate reports in Dicom SR with properly rendered portuguese characters.
Thank you!

Xiang He

unread,
Jun 29, 2017, 4:31:41 AM6/29/17
to Fellow Oak DICOM
Hi Dr. Cuauhtémoc Rossell,
would you please share me your code?

Thanks
xiang

Chris Horn

unread,
Jul 20, 2017, 7:46:10 PM7/20/17
to Fellow Oak DICOM
I know this is an older post now but I would very much be interested in seeing some working code on building an SR, as this this is og great need to me right now as I'm working on an radiology and cardiology reporting system or sorts

Xiang He

unread,
Aug 9, 2017, 11:40:53 PM8/9/17
to Fellow Oak DICOM
Hi Dr. Cuauhtémoc Rossell, 
Could you please send me some sample code which create SR from template

thanks
Xiang

tommu...@gmail.com

unread,
Jan 10, 2018, 5:52:47 PM1/10/18
to Fellow Oak DICOM
Dear Dr. Roswell,

could You (or any other reader) help me out with working code on DICOM-SR creation please.
I want to forward findings to our PACS.

Kind regards

Tom

Dr. med. Schlomo V. Aschkenasy

unread,
Apr 29, 2018, 12:21:40 PM4/29/18
to Fellow Oak DICOM
Hi Dr. Cuauhtémoc Rossell

 

I am just starting to develop my own SR tool for my Office and would very much appreciate some Code. If you offer still stands, please let me know.


-Schlomo Aschkenasy MD

Sancho Panza

unread,
May 3, 2018, 11:13:54 PM5/3/18
to Fellow Oak DICOM
Hi there,

I'm working on a project for echocardiograms and Im in need of some DICOM SR samples. Any chance there's a resource like the one posted above for echo DICOM SR?

Thanks in advance.

Dr. Cuauhtémoc Rossell

unread,
Jun 4, 2018, 12:17:58 PM6/4/18
to Fellow Oak DICOM
Hello everyone.
An apology for the delay in answering.
You can see the code previously shared here.
However, in my experience, SR-DICOM is complex and difficult to maintain, I am now using the PDF format to put the report on the server. If you can generate the report in PDF format, it is not difficult to encapsulate it in DICOM, this is the code that I am using.
To generate the PDF file, you can use Word (r) or a spatialized library like PDFWriter.
Once you have the PDF file with the report, you can use something like this:



    public static string uploadReport(Study estudio, string cPathPDF)
    {
      string sRes = "";
      DicomDataset dataset = fillDataset(estudio);
      byte[] fileData = readBytesFromFile(cPathPDF);
      dataset.Add(DicomTag.EncapsulatedDocument, fileData);
      DicomFile dcmFile = new DicomFile(dataset);
      try
      {
        DicomClient client = new DicomClient();
        client.AddRequest(new DicomCStoreRequest(dcmFile));
        //client.SendAsync(Funcs.opt.dicomAddress, Funcs.opt.dicomPort, false, Funcs.opt.callingAET, Funcs.opt.calledAET);
        client.Send(Funcs.opt.dicomAddress, Funcs.opt.dicomPort, false, Funcs.opt.callingAET, Funcs.opt.calledAET);
      }
      catch (Exception ex)
      {
        sRes = ex.Message;
      }
      return sRes;
    }

    public static DicomDataset fillDataset(Study estudio)
    {
      DicomDataset dataset = new DicomDataset();
      // type 1 attributes
      dataset.Add(DicomTag.SOPClassUID, DicomUID.EncapsulatedPDFStorage);
      dataset.Add(DicomTag.StudyInstanceUID, estudio.StudyInstanceUID);
      dataset.Add(DicomTag.SeriesInstanceUID, generateUID());
      dataset.Add(DicomTag.SOPInstanceUID, generateUID());
      dataset.Add(DicomTag.SpecificCharacterSet, "ISO_IR 100");      // nuevo
      // type 2 attributes
      dataset.Add(DicomTag.PatientID, estudio.PatientID);
      dataset.Add(DicomTag.PatientName, estudio.PatientName);
      dataset.Add(DicomTag.PatientBirthDate, estudio.PatientBirthDate);
      dataset.Add(DicomTag.PatientSex, estudio.PatientSex);
      dataset.Add(DicomTag.StudyDate, estudio.StudyDate);
      dataset.Add(DicomTag.StudyTime, estudio.StudyTime);
      DateTime hoy = DateTime.Now;
      dataset.Add(DicomTag.InstanceCreationDate, Funcs.dateToDICOM(hoy));
      dataset.Add(DicomTag.InstanceCreationTime, Funcs.timeToDICOM(hoy));
      dataset.Add(DicomTag.ContentDate, Funcs.dateToDICOM(hoy));
      dataset.Add(DicomTag.ContentTime, Funcs.timeToDICOM(hoy));
      dataset.Add(DicomTag.AccessionNumber, estudio.AccessionNumber);
      dataset.Add(DicomTag.ReferringPhysicianName, estudio.MedRef);
      dataset.Add(DicomTag.StudyID, estudio.StudyID);
      dataset.Add(DicomTag.SeriesNumber, "9");
      dataset.Add(DicomTag.SeriesDescription, estudio.StudyDescription);
      dataset.Add(DicomTag.ModalitiesInStudy, "SR");
      dataset.Add(DicomTag.Modality, "SR");
      dataset.Add(DicomTag.Manufacturer, "ServicesinIT");
      dataset.Add(DicomTag.ManufacturerModelName, "WordPACSClient");
      dataset.Add(DicomTag.SoftwareVersions, "1.0");
      return dataset;
    }

    private static DicomUID generateUID()
    {
      StringBuilder uid = new StringBuilder("1.08.1982.10121984.2.0.07.");
      uid.Append(DateTime.UtcNow.Ticks);
      return new DicomUID(uid.ToString(), "SOP Instance UID", DicomUidType.SOPInstance);
    }

    private static byte[] readBytesFromFile(string fileName)
    {
      FileStream fs = File.OpenRead(fileName);
      try
      {
        byte[] bytes = new byte[fs.Length];
        fs.Read(bytes, 0, Convert.ToInt32(fs.Length));
        fs.Close();
        return bytes;
      }
      finally
      {
        fs.Close();
      }
    }

An this is the class Study:
  public class Study
  {
    public string StudyDateTime { get; set; }
    public string StudyDate { get; set; }
    public string StudyTime { get; set; }
    public string PatientID { get; set; }
    public string PatientName { get; set; }
    public string PatientSex { get; set; }
    public string PatientBirthDate { get; set; }
    public string StudyInstanceUID { get; set; }
    public string StudyID { get; set; }
    public string ModalitiesInStudy { get; set; }
    public string AccessionNumber { get; set; }
    public string StudyDescription { get; set; }
    public string Images { get; set; }
    public string MedRef { get; set; }
    public string Reporte { get; set; }
  }
Greetings to all and thanks for the excellent component.

Arianne Mendez

unread,
Nov 10, 2022, 11:27:06 AM11/10/22
to Fellow Oak DICOM
Hello adil, I was trying to access to samples DICOM SR address but I can't be abble to download it, If you (or anyone who read this message and have access to the zip file) could send it to my gmail address or share it with google drive to my user. thank you very much.
Reply all
Reply to author
Forward
0 new messages