Showing posts with label MODALIZER-SDK. Show all posts
Showing posts with label MODALIZER-SDK. Show all posts

Wednesday, June 28, 2023

Modality Performed Procedure Step

Introduction


After the post on Modality Worklist, I felt that it wouldn’t be a complete without explanation on Modality Performed Procedure Step. MWL without MPPS is like a task list without checkboxes, and after all, striking a checkbox on a completed task is great fun. Talking of which, I once red this article about productivity and task lists and since then I’m using a circular checkbox on my paper to do notes because it’s 4 times faster. Instead of 4 lines you only need one. Think of it.

IHE Comes to Rescue


Though the DICOM standard states that it doesn’t go into the details of the implementation and what should be the implications of MPPS on workflow it is very clear from reading the details of the standard that an MPPS is the checkmark of MWL. The gap is closed by IHE radiology technical framework that does a great job and details exactly what should be the workflow and how the implementation should look like. If you are not familiar with IHE, I strongly recommend navigating to their web site and start digging. Getting familiar with the IHE Technical Frameworks can save a lot of expensive software architect hours and more important, save you from implementing things wrong. The IHE TF is high quality software specification document that you can use almost as is for your healthcare IT software projects.


Anyway, if you don’t have time to dig inside the long documents of IHE and DICOM and HL7, here’s a short data and program flow summary:

  1. The modality makes a MWL Query. Each result is a requested procedure object with one or more Scheduled Procedure Steps (SPS).
  2. The user picks one SPS to perform.  
  3. The modality creates a new Modality Performed Procedure Step (MPPS) that references the Study, the requested procedure, and the SPS.  This is done using the N-CREATE command. 
  4. There’s a state machine for MPPS with three states:
    1. In Progress (A dot at the center of the circular checkbox)
    2. Completed (A dash on the checkbox)
    3. Discontinued (Back to the beginning)
  5. After the images acquisition is done the modality sends an updated status for the MPPS using N-SET command. The N-SET must include a performed series sequence with at least one series in it, even if the procedure was aborted (in which case the series will have no images).
  6. At this point the Scheduler should dash the checkbox to mark the task as completed (or discontinued).
  7. Though usually you would have a 1-to-1 relationship between a scheduled procedure and a performed procedure, the DICOM data model has a n-to-m relationship between SPS and MPPS. The connection is made by the MPPS that references the SPS that it was performed for.

The DIMSE-N Protocol


Unlike all the other command that we’ve discussed so far in this tutorial namely C-ECHO, C-STORE, C-FIND and C-MOVE that are DIMSE-C commands, MPPS uses the normalized, DIMSE-N protocol commands N-CREATE and N-SET to create and update the Modality Performed Procedure Step normalized  information entity. We’ve discussed the normalized data model (aka DICOM Model of the Real World) briefly in chapter 4 when discussing DICOM Objects and stating that image objects are composites of modules from different information entities.
Like, in MWL before, here’s where MPPS fits into the DICOM Data Model:

Thursday, April 6, 2023

New releases of MODALIZER+ and MODALIZER-SDK

A quick update on HRZ latest software releases. We've released MODALIZER+ V6.1 with video capture capabilities. Check the post on HRZ web site. And also a new release of MODALIZER-SDK (version 3.2.2.4) that is available on HRZ downloads page.

Monday, January 18, 2021

Move all studies of patients with ID in CSV file from PACS-A to PACS-B

OK, so here's another PowerShell DICOM script that came handy recently. So my friend, lets call him Benny, got a request from his manager to export all the studies of patients in a list provided as excel sheet and deliver them to a research group (after de-identification and everything of course) but when he called me he just needed to get them out quickly from the PACS. The list was long and there was no chance to do this one by one. So we wrote together this little PowerShell script that reads the patient id's from the excel (after saving it as csv) and use MODALIZER-SDK to do the DICOM work. here it is. I think it explains itself pretty well. We've set the destination PACS-B to be our lightweight PACS server with no plugin so the DICOM files were saved on the disk and from there he picked them up.

$my_ae_title="MY-AE-TITLE"


$pacs_a_ae_title="PACS-A"

$pacs_a_ip_address="10.0.0.10"

$pacs_a_dicom_port=104


$pacs_b_ae_title="PACS-B"


function MoveStudyByPatientID

param($pat)

$r = New-Object -ComObject rzdcx.DCXREQ

    

    # Lets echo to be sure

$r.Echo($my_ae_title, $pacs_a_ae_title, $pacs_a_ip_address, $pacs_a_dicom_port)

$o = New-Object -ComObject rzdcx.DCXOBJ

$e = New-Object -ComObject rzdcx.DCXELM

# Query Level - STUDY

$e.Init(0x00080052)

$e.Value = "STUDY"

$o.insertElement($e)

# Patient ID

$e.Init(0x00100020)

$e.Value = $pat

$o.insertElement($e)

# Study Instance UID

$e.Init(0x0020000d)

    $e.Value = ""

$o.insertElement($e)

$i = $r.Query($my_ae_title, $pacs_a_ae_title, $pacs_a_ip_address, $pacs_a_dicom_port, "1.2.840.10008.5.1.4.1.2.1.1", $o)

    if ($i.AtEnd()) {

        "No Studies for patient id: " + $pat

    }

    else

    {

        while ($i.AtEnd() -ne $true)

        {

            $res = $i.Get()

    "LOG: Study Instance UID: " + $res.GetElement(0x0020000d).Value

    $o.insertElement($res.GetElement(0x0020000d))

    $r.Move($my_ae_title, $pacs_a_ae_title, $pacs_a_ip_address, $pacs_a_dicom_port, 104, $pacs_b_ae_title, $o)

            $i.Next();

    } 

    }

}


# A log never hurts

$a = New-Object -ComObject rzdcx.DCXAPP

$a.StartLogging("log.log")

$a.LogLevel = 5


$patients = Import-Csv -Path .\patients.csv

foreach ($pat in $patients.patient_id) 

{

    "LOG: Patient ID: " + $pat

MoveStudyByPatientID $pat

}


$a.StopLogging()


# That's it for now 




Thursday, August 27, 2020

Sending DICOM files indexed in a DICOMDIR on a DICOM CD to PACS using PowerShell and MODALIZER-SDK

 I'm posting this PowerShell script in response to a question I got about sending DICOM files on a CD to PACS. 

This functionality is available in MODALIZER+ from the View menu simply by right clicking the Study item at the top study panel and selecting "Send to". The PACS AE title has to be configured first in the settings.

But, for the automation enthusiasts, here's a PowerShell script that do the same. Recalling on DICOMDIR, a DICOM CD or DVD has a file called DICOMDIR in the root path that references all DICOM files on the media. This script iterates through the DICOMDIR records to collect all referenced files, then it send them using DCXREQ.Send command to the PACS.

Here it is. Enjoy!

 # Send DICOMDIR Patients to PACS


param($rootFolder);

Monday, June 9, 2008

RZDCX Release 1.0.0.3

Update, 24 March 2023, This post, orginally from 9 June 2008, almost 15 years ago, announces the first public release of MOALIZER-SDK (then RZDCX) 


RZDCX Release 1.0.0.3 was released on 26th May 2008. A fully functional evaluation copy with full source code examples and documentation can be downloaded from [Update 24 Match 2024: Check download link: https://downloads.hrzkit.com]
Although this is the first time that the toolkit is available for download from the Internet, RZDCX is not a new product. We have been using RZDCX internally on our projects for more than a year now.