fo-dicom - How can I download dcm images from PACS and save them?

Viewed 4217

I'm trying to download dcm image from PACS server, but this is generating an empty dcm file.

Following is the code:

public void VisoresPacsController(string ipAddress, string aeTitle, string accessId, int port)
{
    /*
    this.ipAddress = ipAddress;
    this.aeTitle = aeTitle;
    this.accessId = accessId;
    this.port = port;
    visores.Add(new VisorCommandLine("Radiant", ""));
    ///new DicomCStoreRequest.
    */
    DicomClient client = new DicomClient();
    var query = DicomCFindRequest.CreateImageQuery("1.2.250.1.31.2.723.19980722.113224.11597", "1.2.250.1.31.3.723.19980722.113224.11597");
    client.AddRequest(query);
    query.OnResponseReceived = onResponse;
    client.Send("70.38.12.40", 4242, false, "THS", "ORTHANC");
}

public void onResponse(DicomCFindRequest req, DicomCFindResponse res)
{
    DicomDataset dataset = res.Dataset;
    dataset.Add(DicomTag.SOPClassUID, "1.2.250.1.31.4.723.19980722.113224.11597");
    //dataset.Add(DicomTag.StudyInstanceUID, GenerateUid());
    //dataset.Add(DicomTag.SeriesInstanceUID, GenerateUid());
    //dataset.Add(DicomTag.SOPInstanceUID, GenerateUid());
    DicomFile dicomFile = new DicomFile(dataset);
    dicomFile.Save(@"C:\Users\Developer 13\Desktop\dicomfile.dcm");
}

My code

2 Answers
Related