PantelisGeorgiadis / dcmjs-dimse

DICOM DIMSE implementation for Node.js using the dcmjs library
MIT License
74 stars 14 forks source link

modality worklist & alpha state #21

Closed cultulhul closed 2 years ago

cultulhul commented 2 years ago

Hi

Do you plan to implement a modality worklist server and when do you think the library will be ready for production

PantelisGeorgiadis commented 2 years ago

Hello @cultulhul, Thank you for your comments!

Actually, the library already implements all the parts needed to create a modality worklist server! Follow the SCP example (https://github.com/PantelisGeorgiadis/dcmjs-dimse/wiki/Examples#scp) and only accept presentation contexts with SopClass equal to ModalityWorklistInformationModelFind. Implement only the cFindRequest handler. Read the request dataset properties and match them with your data source entries (e.g. your database). Create datasets out of your data source matches and pass them to the handler callback, as an array of responses (see the example code). There you are… you have your first modality worklist server!

Unfortunately, there is no production-ready timeline :-(.

cultulhul commented 2 years ago

thanks will try to implement one

PantelisGeorgiadis commented 2 years ago

Thank you @cultulhul!

tchekoto commented 2 years ago

For whoever needs an example, here is one:

  cFindRequest(request, callback) {
    var responses = new Array();
    var scheduledExamProcessed = 0;
    scheduledExamList.forEach(element => {
      const pendingResponse = CFindResponse.fromRequest(request);
      pendingResponse.setDataset(element);
      pendingResponse.setStatus(Status.Pending);
      responses.push(pendingResponse);
      ++scheduledExamProcessed;
      if(scheduledExamProcessed === scheduledExamList.length){
        const finalResponse = CFindResponse.fromRequest(request);
        finalResponse.setStatus(Status.Success);
        responses.push(finalResponse);
        callback(responses);
      }
    });
  }

The list scheduledExamList contains Dataset objects loaded from regular dcm files with the method fromFile to load them. Hope this helps.