tag:blogger.com,1999:blog-40865108720904946762024-03-10T21:05:27.145-07:00DICOM is EasySoftware Programming for Medical Applicationsronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.comBlogger89125tag:blogger.com,1999:blog-4086510872090494676.post-51783116332896860282023-07-04T23:49:00.000-07:002023-07-04T23:49:53.367-07:00Indexing DICOM files in a directory into a CSV file using PowerShell and MODALIZER-SDK<div style="color: darkgreen; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: black; font-stretch: normal; line-height: normal;">This post is continues my series on <a href="https://dicomiseasy.blogspot.com/2019/01/powershell-dicom-scripting.html">PowerShell DICOM scripting</a>. It covers a very common task that repeats itself in all kind of forms where I have a directory full of DICOM files that piled up somewhere and needs to be indexed and processed. <a href="https://docs.microsoft.com/en-us/powershell/scripting/overview">PowerShell scripting</a> comes handy in these cases where there's a need to do something fast and probably change it on the fly. Of course, you will need our <a href="http://modalizer-sdk.roniza.com/">MODALIZER-SDK</a> for this one.</span><br />
<br />
#!PowerShell ... jeje ... this doesn't work on widows ;-) </div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal; min-height: 11px;">
<br /></div>
<div style="color: darkgreen; font-family: Helvetica; font-stretch: normal; line-height: normal;">
# Well, this is something very useful (I think) for anyone managing a PACS.</div>
<div style="color: darkgreen; font-family: Helvetica; font-stretch: normal; line-height: normal;">
# Lets say you have a directory full with DICOM files you have no idea what's in them (you do, right?) and you want to scan through them.</div>
<div style="color: darkgreen; font-family: Helvetica; font-stretch: normal; line-height: normal;">
# So, here's a little powershell script for this:</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal; min-height: 11px;">
<br /></div>
<div style="color: darkgreen; font-family: Helvetica; font-stretch: normal; line-height: normal;">
# Ok, so first we get the directory to scan as a command line parameter</div>
<div style="color: #a82d00; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: darkblue;">param</span><span style="color: black;"> (</span>$ScanPath<span style="color: black;">)</span></div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal; min-height: 11px;">
<br /></div>
<div style="color: darkgreen; font-family: Helvetica; font-stretch: normal; line-height: normal;">
# This is a function. It extract one element from a DICOM object and return an empty string if the element doesn't exist or doesn't have a value. We use it later on.</div>
<div style="color: blueviolet; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: darkblue;">function</span><span style="color: black;"> </span>Get-Value<span style="color: black;">(</span><span style="color: #a82d00;">$obj</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: #a82d00;">$tag</span><span style="color: black;">) </span></div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
{</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$e</span> <span style="color: dimgrey;">=</span> <span style="color: #a82d00;">$obj</span><span style="color: dimgrey;">.</span>GetElement(<span style="color: #a82d00;">$tag</span>)</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: darkblue;">if</span> (<span style="color: #a82d00;">$e</span> <span style="color: dimgrey;">-ne</span> <span style="color: #a82d00;">$null</span>)</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
{</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: darkblue;">if</span> (<span style="color: #a82d00;">$e</span><span style="color: dimgrey;">.</span>Value <span style="color: dimgrey;">-ne</span> <span style="color: #a82d00;">$null</span>)</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
{ </div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: darkblue;">return</span> <span style="color: #a82d00;">$e</span><span style="color: dimgrey;">.</span>Value</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
}</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: darkblue;">else</span></div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
{</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: darkblue;">return</span> <span style="color: darkred;">""</span></div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
}</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
}</div>
<div style="color: darkblue; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span>else</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
{</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: darkblue;">return</span> <span style="color: darkred;">""</span>;</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
}</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
}</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal; min-height: 11px;">
<br /></div>
<div style="color: darkgreen; font-family: Helvetica; font-stretch: normal; line-height: normal;">
# Modify this array to add more tags. The pair items are used for headers (and readabity).</div>
<div style="color: #a82d00; font-family: Helvetica; font-stretch: normal; line-height: normal;">
$tags<span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> @(</span></div>
<div style="color: darkred; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span><span style="color: purple;">0x00080016</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span>"sop class uid"<span style="color: dimgrey;">,</span></div>
<div style="color: darkred; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span><span style="color: purple;">0x00080018</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span>"sop instance uid"<span style="color: dimgrey;">,</span></div>
<div style="color: darkred; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span><span style="color: purple;">0x00080020</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span>"study date"<span style="color: dimgrey;">,</span></div>
<div style="color: darkred; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span><span style="color: purple;">0x00080030</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span>"study time"<span style="color: dimgrey;">,</span></div>
<div style="color: darkred; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span><span style="color: purple;">0x00080050</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span>"accession number"<span style="color: dimgrey;">,</span></div>
<div style="color: darkred; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span><span style="color: purple;">0x00100010</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span>"patient name"<span style="color: dimgrey;">,</span></div>
<div style="color: darkred; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span><span style="color: purple;">0x00100020</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span>"patient id"<span style="color: dimgrey;">,</span></div>
<div style="color: darkred; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span><span style="color: purple;">0x00100030</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span>"patient birth date"<span style="color: dimgrey;">,</span></div>
<div style="color: darkred; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span><span style="color: purple;">0x00100040</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span>"patient sex"<span style="color: dimgrey;">,</span></div>
<div style="color: darkred; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span><span style="color: purple;">0x0020000d</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span>"study Instance UID"<span style="color: dimgrey;">,</span></div>
<div style="color: darkred; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span><span style="color: purple;">0x0020000e</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span>"<span style="color: #a82d00;">$series</span> Instance UID"<span style="color: black;">)</span></div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal; min-height: 11px;">
<br /></div>
<div style="color: darkgreen; font-family: Helvetica; font-stretch: normal; line-height: normal;">
# This prints a nice CSV header line. </div>
<div style="color: darkgreen; font-family: Helvetica; font-stretch: normal; line-height: normal;">
# Note all the '","' to enclose values in double quotes and separate them with commas. </div>
<div style="color: blueviolet; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: darkblue;">function</span><span style="color: black;"> </span>Print-Header</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
{</div>
<div style="color: darkred; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span><span style="color: #a82d00;">$line</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span>'"Filename","Status'</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: darkblue;">for</span> ((<span style="color: #a82d00;">$i</span><span style="color: dimgrey;">=</span><span style="color: purple;">1</span>); (<span style="color: #a82d00;">$i</span> <span style="color: dimgrey;">-lt</span> <span style="color: #a82d00;">$tags</span><span style="color: dimgrey;">.</span>Count); (<span style="color: #a82d00;">$i</span><span style="color: dimgrey;">+=</span><span style="color: purple;">2</span>))</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
{</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$line</span> <span style="color: dimgrey;">+=</span> <span style="color: darkred;">'","'</span></div>
<div style="color: #a82d00; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span>$line<span style="color: black;"> </span><span style="color: dimgrey;">+=</span><span style="color: black;"> </span>$tags<span style="color: dimgrey;">[</span>$i<span style="color: dimgrey;">]</span></div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
}</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$line</span> <span style="color: dimgrey;">+=</span> <span style="color: darkred;">'"'</span></div>
<div style="color: #a82d00; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span>$line</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
}</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal; min-height: 11px;">
<br /></div>
<div style="color: darkgreen; font-family: Helvetica; font-stretch: normal; line-height: normal;">
# This is where the element values are extracted and one line is returned. </div>
<div style="color: darkgreen; font-family: Helvetica; font-stretch: normal; line-height: normal;">
# The filename is in the first column and a status is in the second. Then the values from the tags array follow.</div>
<div style="color: darkgreen; font-family: Helvetica; font-stretch: normal; line-height: normal;">
# The status can be "OK" or "ERROR". You will also see errors in stderr.</div>
<div style="color: blueviolet; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: darkblue;">function</span><span style="color: black;"> </span>Parse-DicomFile<span style="color: black;">(</span><span style="color: #a82d00;">$filename</span><span style="color: black;">)</span></div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
{</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$line</span> <span style="color: dimgrey;">=</span> <span style="color: darkred;">'"'</span></div>
<div style="color: #a82d00; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span>$line<span style="color: black;"> </span><span style="color: dimgrey;">+=</span><span style="color: black;"> </span>$filename</div>
<div style="color: darkred; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span><span style="color: #a82d00;">$line</span><span style="color: black;"> </span><span style="color: dimgrey;">+=</span><span style="color: black;"> </span>'","OK'</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: darkblue;">try</span> {</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$obj</span> <span style="color: dimgrey;">=</span> <span style="color: blue;">New-Object</span> <span style="color: navy;">-ComObject</span> <span style="color: blueviolet;">rzdcx.DCXOBJ</span></div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$obj</span><span style="color: dimgrey;">.</span>openFile(<span style="color: #a82d00;">$filename</span>)</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: darkblue;">for</span> ((<span style="color: #a82d00;">$i</span><span style="color: dimgrey;">=</span><span style="color: purple;">0</span>); (<span style="color: #a82d00;">$i</span> <span style="color: dimgrey;">-lt</span> <span style="color: #a82d00;">$tags</span><span style="color: dimgrey;">.</span>Count); (<span style="color: #a82d00;">$i</span><span style="color: dimgrey;">+=</span><span style="color: purple;">2</span>))</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
{</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$line</span> <span style="color: dimgrey;">+=</span> <span style="color: darkred;">'","'</span></div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$line</span> <span style="color: dimgrey;">+=</span> <span style="color: blue;">Get-Value</span> <span style="color: #a82d00;">$obj</span> <span style="color: #a82d00;">$tags</span><span style="color: dimgrey;">[</span><span style="color: #a82d00;">$i</span><span style="color: dimgrey;">]</span></div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
}</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$line</span><span style="color: dimgrey;">+=</span><span style="color: darkred;">'"'</span></div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
} <span style="color: darkblue;">catch</span> { <span style="color: #a82d00;">$line</span> <span style="color: dimgrey;">=</span> <span style="color: darkred;">'"'</span> <span style="color: dimgrey;">+</span> <span style="color: #a82d00;">$filename</span><span style="color: dimgrey;">+</span> <span style="color: darkred;">'","ERROR"'</span> }</div>
<div style="color: darkblue; font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span>return<span style="color: black;"> </span><span style="color: #a82d00;">$line</span></div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
}</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal; min-height: 11px;">
<br /></div>
<div style="color: darkgreen; font-family: Helvetica; font-stretch: normal; line-height: normal;">
# Here it starts. We first print the header and then scan through the folder and extract the data from every DICOM file. </div>
<div style="color: darkgreen; font-family: Helvetica; font-stretch: normal; line-height: normal;">
# Note ignoring directories</div>
<div style="color: blue; font-family: Helvetica; font-stretch: normal; line-height: normal;">
Print-Header</div>
<div style="color: blue; font-family: Helvetica; font-stretch: normal; line-height: normal;">
Get-ChildItem<span style="color: black;"> </span><span style="color: navy;">-Recurse</span><span style="color: black;"> </span><span style="color: navy;">-Path</span><span style="color: black;"> </span><span style="color: #a82d00;">$ScanPath</span><span style="color: black;"> </span><span style="color: dimgrey;">|</span><span style="color: black;"> </span>Foreach-Object<span style="color: black;"> { </span></div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: darkblue;">if</span> (<span style="color: #a82d00;">$_</span><span style="color: dimgrey;">.</span>Attributes <span style="color: dimgrey;">-ne</span> <span style="color: darkred;">"Directory"</span>) {</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
<span style="color: blue;">Parse-DicomFile</span> <span style="color: #a82d00;">$_</span><span style="color: dimgrey;">.</span>FullName</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
}</div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal;">
} </div>
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal; min-height: 11px;">
<br /></div>
<div style="color: darkgreen; font-family: Helvetica; font-stretch: normal; line-height: normal;">
# Enjoy!!!</div>
<br />
<div style="font-family: Helvetica; font-stretch: normal; line-height: normal; min-height: 11px;">
<br /></div>
<div>
<br /></div>
Ronihttp://www.blogger.com/profile/11833431782003065520noreply@blogger.com0tag:blogger.com,1999:blog-4086510872090494676.post-91525682770979408612023-06-28T00:47:00.000-07:002023-06-28T00:47:28.445-07:00Introduction to DICOM - Chapter 5 – Solving a DICOM Communication ProblemToday we are going to diagnose a communication problem between two DICOM applications and hopefully find the reason for the problem and solve it. I know, we didn’t even start talking about the DICOM network protocol, but hey, we’re not going to read all this 3,000 pages standard together before getting our hands dirty, right?<br>
In this post we'll discuss:<br>
<div>
<ol>
<li>Application Entities (AE’s) – the nodes in the DICOM network and their name – AE Title</li>
<li>Association – a network peer-to-peer session between two DICOM applications</li>
<li><a href="https://www.blogger.com/blogger.g?blogID=4086510872090494676" name="Association_Negotiation">Association Negotiation</a> – The first part of the association in which the two AE’s agree on what can and can’t be done during the Association</li>
<li>The Verification Service using the C-ECHO command – a DICOM Service Class that is used to verify a connection, sort of application level ‘ping’.</li>
<li>The Storage Service using the C-STORE command – a DICOM Service that allows one AE to send a DICOM object to another AE</li>
</ol>
<div>
The C in C-ECHO and C-STORE commands stands for Composite. If you remember, in chapter 4 when discussing the <a href="https://dicomiseasy.blogspot.com/2011/12/chapter-4-dicom-objects-in-chapter-3.html#DicomDataModel">DICOM Data Model</a>, we said that DICOM applications exchange composite objects (the DICOM images that we already know) that are composites of modules from different IE's where IE's are the information entities of the Normalized DICOM data model.</div>
<div>
<br></div>
<div>
Here's the story:</div>
<blockquote class="tr_bq">
<i>Complaint 20123<br><br>Burt Simpson from Springfield Memorial Hospital reports that he can’t send the screen capture to the PACS. He kept clicking the green “Send” button but he always gets the same error: “Operation Failed!”. The log file Burt copied from the system is attached.</i></blockquote>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
You may ask yourself, what’s the point in analyzing a log of an application that we are never going to use? Well, the truth is that <b>all DICOM logs look alike</b>. Actually, most DICOM applications are quite similar because DICOM software implementations have common ancient ancestors. If it’s a C library it may be the DICOM test node, CTN. If it’s Java than it might be dcm4che. Even if it's PHP or other newer languages, the libraries were transcribed and ported from the old C implementations so all DICOM logs are similar.<br>
<br>
</div></div><a href="https://dicomiseasy.blogspot.com/2011/12/introduction-to-dicom-chapter-5-solving.html#more">Read more »</a>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com36tag:blogger.com,1999:blog-4086510872090494676.post-3022825323437377822023-06-28T00:22:00.000-07:002023-06-28T00:22:45.090-07:00Query/Retrieve part II - C-MOVE<br>
<div style="text-align: justify;">
In <a href="https://dicomiseasy.blogspot.com/2012/01/dicom-queryretrieve-part-i.html">part I</a> of this post, I was in a meeting with a customer reviewing their workstation code and while sitting there I was thinking to myself, why should my customers have to deal with so many details of the DICOM Q/R Service when all they really want is to retrieve a study just like they would have downloaded a zip file from a web site. And thus, later, back in my office I decided to extended the DICOM Toolkit API to include a C-MOVE method that will take care of everything including the incoming association. In today’s post I’m going to use the new MoveAndStore method to talk about the DICOM Query/Retrieve service. We’ll start at the end and then work our way backwards.<br>
<br>
<blockquote class="tr_bq" style="text-align: -webkit-auto;">
<b>C-MOVE is a DICOM command that means this: The calling AE (we) ask the called AE (the PACS) to send all the DICOM Instances that match the identifier to the target AE. </b></blockquote>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Here’s how you ask a PACS to send you the DICOM images with RZDCX (version 2.0.1.9).</div>
</div>
<br>
<div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;"> <span style="color: blue;">public</span> <span style="color: blue;">void</span> MoveAndStore()<o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;"> {<o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;"> <span style="color: green;">// Create an object with the query
matching criteria (Identifier)<o:p></o:p></span></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;"> <span style="color: #2b91af;">DCXOBJ</span> query = <span style="color: blue;">new</span> <span style="color: #2b91af;">DCXOBJ</span>();<o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;"> <span style="color: #2b91af;">DCXELM</span> e = <span style="color: blue;">new</span> <span style="color: #2b91af;">DCXELM</span>();<o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;"> e.Init((<span style="color: blue;">int</span>)<span style="color: #2b91af;">DICOM_TAGS_ENUM</span>.patientName);<o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;"> e.Value = <span style="color: #a31515;">DOE^JOHN";</span><o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;">
query.insertElement(e);<o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;"> e.Init((<span style="color: blue;">int</span>)<span style="color: #2b91af;">DICOM_TAGS_ENUM</span>.patientID);<o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;"> e.Value = <span style="color: #a31515;">@"123456789";<o:p></o:p></span></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; margin-left: 36pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0.0001pt 36pt; text-indent: 36pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;">query.insertElement(e);<o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;"> <span style="color: green;">// Create an accepter to handle the
incomming association</span><o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; margin-left: 36pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0.0001pt 36pt; text-indent: 36pt;">
<span style="color: #2b91af; font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;">DCXACC</span></span><span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;"> accepter = <span style="color: blue;">new</span>
<span style="color: #2b91af;">DCXACC</span>();<o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;">
accepter.StoreDirectory = <span style="color: #a31515;">@".\MoveAndStore";<o:p></o:p></span></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; margin-left: 36pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0.0001pt 36pt; text-indent: 36pt;">
<span style="color: #2b91af; font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;">Directory</span></span><span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;">.CreateDirectory(accepter.StoreDirectory);<o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;"> <span style="color: green;">// Create a requester and run the query</span>
<o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; margin-left: 36pt; margin-right: 0cm; margin-top: 0cm; margin: 0cm 0cm 0.0001pt 36pt; text-indent: 36pt;">
<span style="color: #2b91af; font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;">DCXREQ</span></span><span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;"> requester = <span style="color: blue;">new</span>
<span style="color: #2b91af;">DCXREQ</span>();<o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;">
requester.MoveAndStore(<o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;">
MyAETitle, <span style="color: green;">// The AE title
that issue the C-MOVE<o:p></o:p></span></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;">
IS_AE, <span style="color: green;">// The PACS AE title<o:p></o:p></span></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;">
IS_Host, <span style="color: green;">// The PACS IP address<o:p></o:p></span></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;">
IS_port, <span style="color: green;">// The PACS listener port<o:p></o:p></span></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;">
MyAETitle, <span style="color: green;">// The AE title
to send the<o:p></o:p></span></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;">
query, <span style="color: green;">// The matching criteria<o:p></o:p></span></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;">
104, <span style="color: green;">// The port to receive the results<o:p></o:p></span></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;">
accepter); <span style="color: green;">// The accepter
to handle the results<o:p></o:p></span></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;"> }<o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "courier new"; font-size: x-small;"><span style="font-size: 10pt;"><br></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
</div>
<div style="text-align: justify;">
Behind this rather short function hides a lot of DICOM networking and when it returns we should have all the matching objects stored in the directory “.\MoveAndStore”. Readers with some practical DICOM experience probably expect me to say that it can also fail. In that case MoveAndStore throws an exception with the error code and description. Sometimes you would have to set the detailed logging on and start reading logs like we did in<a href="https://dicomiseasy.blogspot.com/2011/12/introduction-to-dicom-chapter-5-solving.html"> chapter 5</a> of this tutorial on <a href="https://dicomiseasy.blogspot.com/2011/12/introduction-to-dicom-chapter-5-solving.html">DICOM networking</a> and in some later post we will look together at a DICOM log of a Q/R transaction.</div>
<br>
<div style="text-align: justify;">
The following diagram, taken from part 2 of the DICOM standard, is commonly seen in DICOM Conformance Statements as the Data Flow diagram of the Q/R Service. These diagrams and their notation are defined by the standard in part 2 that specify the DICOM Conformance Statement – a standard document that every application vendor should provide and that describes how they implemented the standard in their product. At some point we will get to how to read and write these documents.</div>
<br>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEht55P6d9TU8uwLEmSmPkBWuOfLXYhxBrmGtRESCD7tZPDzgdcnkAnSbTP8ASBRch5eVWXMUdf9wkYUftxhTA6ry4Y7ep-0NARwi1VDUbokx-it-E6RWvWS6aWDG6AViSs1sFIJpL3_cPen/s1600/c-move-data-flow.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEht55P6d9TU8uwLEmSmPkBWuOfLXYhxBrmGtRESCD7tZPDzgdcnkAnSbTP8ASBRch5eVWXMUdf9wkYUftxhTA6ry4Y7ep-0NARwi1VDUbokx-it-E6RWvWS6aWDG6AViSs1sFIJpL3_cPen/s1600/c-move-data-flow.png"></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br></div>
<div class="separator" style="clear: both; text-align: center;">
<br></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: justify;">
The vertical dashed line represents the DICOM Protocol Interface between the two applications (it is usually a single dashed line but in this example it got a bit messed up). The arrows accros the interface represents DICOM associations. The arrow points from the application that initiates the association (the requester) to the application that responds to it (the responder or accepter). The upper part of the diagram shows the control chanel where the C-MOVE request is sent and statuses are reported back by the PACS. The lower part of the diagram shows the data chanel where the DICOM instances are sent to the client.<br>
<br>
</div></div><a href="https://dicomiseasy.blogspot.com/2012/02/c-move.html#more">Read more »</a>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com21tag:blogger.com,1999:blog-4086510872090494676.post-58620487929275127452023-06-28T00:21:00.000-07:002023-06-28T00:21:30.915-07:00DICOM Modality WorklistModality worklist (MWL) is one of DICOM’s workflow services that really make a difference. It’s the difference between grocery store workflow with notes on little pieces of paper and a true modern accountable workflow.<br>
<div>
<br>
Technically speaking, <a href="https://www.hrzkit.com/solutions/modality-worklist-manager/">DICOM Modality Worklist</a> is a task manager just like a piece of paper with short text and a check box or the tasks application on your iPhone (or Android). But for the imaging center or RAD department the advantages are enormous. The most obvious benefit is that there’s no need to reconcile all kind of misspelled names in the PACS because the patient name is no longer keyed in on the modality workstation but received electronically via the MWL query. The fact that the requested procedure is also received electronically reduces the chance for doing the wrong procedure to the wrong patient. Combined with Modality Performed Procedure step (MPPS), that allows the modality to report the task status, take ownership over the task and checkmark it as done when completed, the up side is obvious. No wonder then, that many HMO’s require Modality Worklist as a mandatory feature for every imaging device they purchase.<span face=""calibri" , sans-serif" style="font-size: 11pt;"> </span><br>
<div>
<br></div>
<div>
The most basic abstraction of a task is a short description of what should be done and a checkbox. That’s all it takes. The MWL data model is a bit more complicated and has two levels. </div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6OAz-Ms-0OxQAUgxHTk_edc78pLCD-_s3Rtd6WcFyhrFBe2bBmZsG0qWisqn0BA8oH9c8UtEeUsgSCUV3VkRxHebKIym9P_IzzDjYBmmefVev9OMbpkpetmJnv-AcVMANKOgx7jl8NtNz/s1600/MWL+Data+Model.PNG" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6OAz-Ms-0OxQAUgxHTk_edc78pLCD-_s3Rtd6WcFyhrFBe2bBmZsG0qWisqn0BA8oH9c8UtEeUsgSCUV3VkRxHebKIym9P_IzzDjYBmmefVev9OMbpkpetmJnv-AcVMANKOgx7jl8NtNz/s1600/MWL+Data+Model.PNG"></a></div>
<div>
<div>
The top, parent, level is called “Requested Procedure” (RP) and holds the information about the patient (name, id), the study (accession number, study instance UID) and the procedure. The procedure can be described as text using attribute (0032,1060) – “Requested Procedure Description” or in a more sophisticated manner using the (0032,1064) – “Requested Procedure Code Sequence” where static tables of codes and meanings can be used to configure and maintain procedures in the RIS or HIS.</div>
<div>
The child level is called “Scheduled Procedure Step” (SPS) and holds attributes relevant to the modality and the actual procedure to be made. A single requested procedure may hold more than one SPS if the request is for a multi-modality study, for example a chest X-Ray and a CT or whatever combination, or if for example two protocols should be applied (e.g. Chest and Abdomen). As a modality, we will use the data in the RP to identify the patient and eliminate re-typing of the name and ID and the SPS to determine what exactly to do.<br>
<br>
</div></div><a href="https://dicomiseasy.blogspot.com/2012/04/dicom-modality-worklist.html#more">Read more »</a>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com62tag:blogger.com,1999:blog-4086510872090494676.post-71983928643226231492023-06-28T00:19:00.000-07:002023-06-28T00:19:06.486-07:00Modality Performed Procedure Step<h2>
Introduction</h2>
<br>
After the post on <a href="https://dicomiseasy.blogspot.co.il/2012/04/dicom-modality-worklist.html">Modality Worklist</a>, 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.<br>
<br>
<h2>
IHE Comes to Rescue</h2>
<br>
Though the <b>DICOM </b>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 <a href="https://www.ihe.net/Technical_Framework/index.cfm#radiology" target="_blank">IHE radiology technical framework</a> 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. <b>The IHE TF is high quality software specification document that you can use almost as is for your healthcare IT software projects</b>.<br>
<br>
<br>
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:<br>
<br>
<ol>
<li>The modality makes a MWL Query. Each result is a requested procedure object with one or more Scheduled Procedure Steps (SPS).</li>
<li>The user picks one SPS to perform. </li>
<li>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. </li>
<li>There’s a state machine for MPPS with three states:</li>
<ol>
<li>In Progress (A dot at the center of the circular checkbox)</li>
<li>Completed (A dash on the checkbox)</li>
<li>Discontinued (Back to the beginning)</li>
</ol>
<li>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).</li>
<li>At this point the Scheduler should dash the checkbox to mark the task as completed (or discontinued).</li>
<li>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.</li>
</ol>
<br>
<div>
<div>
<h2>
The DIMSE-N Protocol</h2>
</div>
<div>
<br></div>
<div>
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.</div>
<div>
Like, in MWL before, here’s where MPPS fits into the DICOM Data Model:</div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglP1qbPpQQXRqrAUlgs2YYU5y8jOyx2dKQ9QEmWkJn8c-u_HCrs_i-rrzu91HDnvEnpfLPCs1uFf-7s6wvc54nrGMiMijXe2IM9hRyfiRGvVlO5yNoEZV25SkTDGvUgnGA1q1ilYDQ1pI7/s1600/MPPS+data+Model.JPG" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglP1qbPpQQXRqrAUlgs2YYU5y8jOyx2dKQ9QEmWkJn8c-u_HCrs_i-rrzu91HDnvEnpfLPCs1uFf-7s6wvc54nrGMiMijXe2IM9hRyfiRGvVlO5yNoEZV25SkTDGvUgnGA1q1ilYDQ1pI7/s1600/MPPS+data+Model.JPG"></a></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div class="separator" style="clear: both;">
</div>
<a href="https://dicomiseasy.blogspot.com/2012/06/modality-performed-procedure-step.html#more">Read more »</a>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com33tag:blogger.com,1999:blog-4086510872090494676.post-78307931322200300632023-06-28T00:11:00.000-07:002023-06-28T00:11:34.769-07:00Storage Commitment<div>
<h2>
<span style="background-color: white;">What is DICOM Storage Commitment Service and why is it needed</span></h2>
</div>
Storage commitment (SCM) is a DICOM service that lets you verify if files that were previously sent to the PACS using the DICOM Storage Service were indeed stored by the application you sent it to. The SOP Class UID of this Service is “1.2.840.10008.1.20.1”. One can argue if it is necessary or not because when you send a DICOM image using C-STORE command and get a success status (0x0000) then it is supposed to be stored so the existence of Storage Commitment raises doubts about the meaning of that status in the first place. However, I can defiantly think of reasons for having such service, first because better safe than sorry and second because I already had some programming experience in the days when the DICOM standard was specified, Thanks god, we did make a long way since then. For example, some engineers, for the sake of efficiency and performance considerations, may have decided to first puts the files in a temporary storage or a queue, without even looking at their content and reply immediately with success and then later, when some batch or another thread processes the files in the queue and try to fill the database errors occur. I wouldn’t implement it this way, and I’ll give you reasons for that at the end of this post, but I did run into such implementations.
The DICOM standard gives us the service but doesn’t go into the details of what is the implementation meaning should be but IHE does. IHE says that if your application creates instances and send it to somewhere, before deleting them from your local disk it should send a Storage Commitment and if all instances are OK, go ahead and make some space on your hard drive. Sounds like a good idea to me, it’s like double booking. Storage is the transaction and Storage Commitment is the reconciliation, Why not.
<br>
<h2>
Storage Commitment Data Flow</h2>
All together SCM is pretty straight forward. All we need to do is to send a list of the instances and get back a reply saying which are in the PACS database and which are not, and that’s exactly how it works. Well, almost.
<br>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEit_Bq9JgOXaCtF8bfps-Ss9GGabUHqzbrNFCsbL5wSFnO0iMUc0jk7nFgEBRKPxB2APGMfUNhVxvzElD0Iz0tIEsDKdESk3OVNKYQQWDg3hfYmGxACtV6qtj0uhkYu8xZG3LvkS0EweQL1/s1600/SCM+Data+Flow.PNG" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEit_Bq9JgOXaCtF8bfps-Ss9GGabUHqzbrNFCsbL5wSFnO0iMUc0jk7nFgEBRKPxB2APGMfUNhVxvzElD0Iz0tIEsDKdESk3OVNKYQQWDg3hfYmGxACtV6qtj0uhkYu8xZG3LvkS0EweQL1/s1600/SCM+Data+Flow.PNG"></a></div>
<br>
<a href="https://dicomiseasy.blogspot.com/2012/06/storage-commitment.html#more">Read more »</a>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com22tag:blogger.com,1999:blog-4086510872090494676.post-79740828590289677982023-06-28T00:09:00.000-07:002023-06-28T00:09:41.992-07:00Chapter 12: Pixel Data<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif2mSr0GFhHI1QmBydGljz1Ppe9KGqeonB9Xx-wgg08mFqUpaoqia244qViJ_EHwBi-Y7KcF7lIGjIjxhYmhwiMjL7yP5EbhJMygiaQf1DYRi8to65pZ4c6CjzaHLLCg9_XGgrdoxNc5Xa/s1600/frame-0001.png" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif2mSr0GFhHI1QmBydGljz1Ppe9KGqeonB9Xx-wgg08mFqUpaoqia244qViJ_EHwBi-Y7KcF7lIGjIjxhYmhwiMjL7yP5EbhJMygiaQf1DYRi8to65pZ4c6CjzaHLLCg9_XGgrdoxNc5Xa/s200/frame-0001.png" width="200"></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Frame 0001</td></tr>
</tbody></table>
I guess that one can't escape talking about pixels when dealing with DICOM. After all, imaging is what DICOM is all about and digital images are built from pixels. So today, to celebrate release 2.0.2.6 (and the x64 version) of <a href="https://www.hrzkit.com/products/modalizer-sdk/" target="_blank">the DICOM Toolkit</a>, I'm finally going to touch the heart of every DICOM Image, The Pixel Data.<br>
<br>
For today's post I've prepared a little C++ test application that really does nothing much other then putting pixels into the pixel data of a DICOM file and save it. Well, not exactly nothing much, because it creates a huge DICOM file, more then 0.7 GB and compress it and never use more then 20 MB of memory. If you want to know how, read on.<br>
<br>
<a href="https://dicomiseasy.blogspot.com/2012/08/chapter-12-pixel-data.html#more">Read more »</a>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com66tag:blogger.com,1999:blog-4086510872090494676.post-84261262204500289352023-06-28T00:08:00.001-07:002023-06-28T00:08:55.489-07:00DICOMDIR and Media Interchange<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; text-align: center;"><tbody>
</tbody></table>[update 24 March 2023: Latest releases of HRZ software can be found on HRZ website - <a href="https://www.hrzkit.com">www.hrzkit.com</a>]<div><br><div>
DICOMDIR, Have you heard this term? What does it mean? Do I need this in my system? Lots of questions. Let's try to answer some.<br>
<br>
Here's a list with quick information about DICOMDIR:<br>
<br>
<ol>
<li>Standard DICOM CD/DVD should have a file named DICOMDIR in its root directory.</li>
<li>The DICOMDIR file has in it records that hold paths to DICOM files on the media.</li>
<li>DICOMDIR is a DICOM Object holding a sequence of DICOMDIR records nodes each having a type like PATIENT, STUDY, SERIES and IMAGE</li>
<li>The DICOMDIR file include key attributes from the data on the media such as Patient Name, Patient ID, Study ID, Study Date.</li>
<li>The file names of DICOM files on a standard DICOM CD/DVD should be capital alphanumeric up to 8 characters with no suffix.</li>
<div style="text-align: left;">
</div>
<li>The CD/DVD may include other files that are not DICOM. The DICOMDIR file does not reference them.</li>
<li>The mandatory elements of the DICOMDIR nodes are not 1-2-1 with the mandatory elements in the DICOM Objects. For example Study ID which is Type 2 in DICOM Image objects is Type 1 in DICOMDIR STUDY Record. So when creating your DICOM images if you intend to create DICOMDIR for them, add these elements too.</li>
</ol>
There are two ways DICOM application can collaborate with one another. They can communicate over TCP/IP network connection or they can exchange files over some physical media.<br>
<br>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin3uegm1NsQsjSuAuYKD631xfopLdWgUs9w9wMgtOLX4HMs42Q02Ku2lLkhSCpYgbFTm62Q0Gjr4_rLNQpT-qTErfBG8_8XT5L0KSlVgtdWL8CZd26V39NvOdGV4QhuycEd-eL2z98Mzzs/s1600/Screen+Shot+2013-03-14+at+8.26.29+AM.png" style="margin-left: auto; margin-right: auto;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin3uegm1NsQsjSuAuYKD631xfopLdWgUs9w9wMgtOLX4HMs42Q02Ku2lLkhSCpYgbFTm62Q0Gjr4_rLNQpT-qTErfBG8_8XT5L0KSlVgtdWL8CZd26V39NvOdGV4QhuycEd-eL2z98Mzzs/s640/Screen+Shot+2013-03-14+at+8.26.29+AM.png" width="494"></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The first figure in the DIOM standard makes sense eventually</td></tr>
</tbody></table>
The picture above, which is by the way the first figure in the DICOM standard (page 10 of chapter 1), explains that very well although when I first looked at thirteen years ago it it didn't mean anything to me.<br>
It is worth staying a bit longer on this figure because it has a lot of valuable information in it so lets work it top to bottom.<br>
<br>
</div></div><a href="https://dicomiseasy.blogspot.com/2013/03/dicomdir-and-media-interchange.html#more">Read more »</a>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com8tag:blogger.com,1999:blog-4086510872090494676.post-10209490551863274462023-06-28T00:08:00.000-07:002023-06-28T00:08:10.891-07:00Converting Bitmap, JPEG and PDF to DICOM<div>Before we move any further, the examples in this post are included in HRZ's <a href="https://www.hrzkit.com/products/modalizer-sdk/">MODALIZER-SDK</a> <a href="https://downloads.hrzkit.com/MODALIZER-SDK/Examples/">DICOM C# Examples</a> package. Non programmers, can achieve the same results and much more using <a href="https://www.dicomizer.com">MODALIZER+ DICOM</a> Wizard, HRZ's administrative PACS workstation. Let's start.</div><div><br></div><div>Imagine you're a dermatologist taking pictures of patients' skin for treatment tracking using a digital camera. The pictures are JPEG's and have no patient info in them. If you could convert them to DICOM and send them to the clinic PACS, that would be a great advancement.</div>
<span class="Apple-style-span" style="font-size: 24px; font-weight: bold;"></span><br>
<a href="https://dicomiseasy.blogspot.com/2011/10/converting-bitmap-jpeg-and-pdf-to-dicom.html#more">Read more »</a>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com8tag:blogger.com,1999:blog-4086510872090494676.post-74992677129950363282023-06-27T11:59:00.000-07:002023-06-27T11:59:10.799-07:00Getting Oriented using the Image Plane Module<div class="separator" style="clear: both; text-align: left;">
Just before diving into how to get oriented using the Image Plane Module, so we can put the letters right in our viewer, I want to get equipped with few more latin words so we understand what Radiologists are mumbling. If you're a Doctor, please be patient with us programmers. </div>
<div class="separator" style="clear: both; text-align: left;">
<br></div>
<div class="separator" style="clear: both; text-align: left;">
Cuts! Three major cuts we have (or planes): </div>
<div class="separator" style="clear: both; text-align: center;">
<br></div>
<div class="separator" style="clear: both; text-align: center;">
Transverse (AKA Axial) divides head from feet</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_QkRPfLOSDTdD-QJpcKiS67uSPtsyhO_oKKSoMZOp6O-tIxjTCa_D52Bdh4_scr_pzc8jRclyHODhyJDIv_IgS_1nUAC3Lnyk37QOl2fL3nOhI9ZgPSR1QBvOOXlsIKchls3Id-1kEAIp/s1600/Axial-Cut.png" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_QkRPfLOSDTdD-QJpcKiS67uSPtsyhO_oKKSoMZOp6O-tIxjTCa_D52Bdh4_scr_pzc8jRclyHODhyJDIv_IgS_1nUAC3Lnyk37QOl2fL3nOhI9ZgPSR1QBvOOXlsIKchls3Id-1kEAIp/s320/Axial-Cut.png" width="286"></a></td></tr>
<tr><td class="tr-caption" style="font-size: 13px;">Axial Cut</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br></div>
<div class="separator" style="clear: both; text-align: center;">
Sagittall Cut - right between the eyes</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFg-8B1YkYrRqfyu0iceIKXY4whBF3y-kkhpat7-oxVlTWC1zP2kyJd7mdLXsEXkc93_XwtgV2jLIilGUMBVgCV0L5zqX3Rv-a8pjQt3S_WHMjCfQ6e3-K7FBugOjcujju_7t40Jq2tCSd/s1600/Sagittal-Cut.png" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFg-8B1YkYrRqfyu0iceIKXY4whBF3y-kkhpat7-oxVlTWC1zP2kyJd7mdLXsEXkc93_XwtgV2jLIilGUMBVgCV0L5zqX3Rv-a8pjQt3S_WHMjCfQ6e3-K7FBugOjcujju_7t40Jq2tCSd/s320/Sagittal-Cut.png" width="286"></a></td></tr>
<tr><td class="tr-caption" style="font-size: 13px;">Sagittal Cut</td></tr>
</tbody></table>
<br>
<div class="separator" style="clear: both; text-align: center;">
and Coronal Cut - the Filet</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoQzOvMJzmaVOK3uUKXZ4oVAsMaBytc-rMQSWNfiJ3LtJqmU2oIhUeJ55AY6aKf3s47VioJccQzZnnnu1SYErVw3GBnd80qYJ3vIVAScPb-VEZb6AIy3tL-l78z8589G3AqbDjytVNr0Su/s1600/Coronal.png" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoQzOvMJzmaVOK3uUKXZ4oVAsMaBytc-rMQSWNfiJ3LtJqmU2oIhUeJ55AY6aKf3s47VioJccQzZnnnu1SYErVw3GBnd80qYJ3vIVAScPb-VEZb6AIy3tL-l78z8589G3AqbDjytVNr0Su/s320/Coronal.png" width="286"></a></td></tr>
<tr><td class="tr-caption" style="font-size: 13px;">Coronal Cut</td></tr>
</tbody></table>
<br>
<div class="separator" style="clear: both; text-align: center;">
<br></div>
<div class="separator" style="clear: both; text-align: left;">
<br></div>
<span style="text-align: left;">And now that we're done with Anatomy let's do some Geometry.</span><span style="text-align: left;"> </span><span style="font-family: inherit;">In this post I'm going to start explaining the use of the Image Plane Module. To refresh on Modules read <a href="https://dicomiseasy.blogspot.co.il/2011/12/chapter-4-dicom-objects-in-chapter-3.html">chapter 4 of the DICOM Tutorial</a>. The Image Plane module is part of the CT Image IOD and the MR Image IOD and any other object that have a frame of reference, i.e. that has a spatial coordinates system related to the patient or in other words is a 3D scan of the body.<span id="goog_448473481"></span></span><br>
<span style="font-family: inherit;"></span><br>
<a href="https://dicomiseasy.blogspot.com/2013/06/getting-oriented-using-image-plane.html#more">Read more »</a>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com38tag:blogger.com,1999:blog-4086510872090494676.post-26304901733246021442023-06-27T11:57:00.001-07:002023-06-27T11:57:43.491-07:00Introduction to DICOM - Chapter 4 - DICOM Objects<br>
<div style="border-bottom: solid #4F81BD 1.0pt; border: medium; mso-border-bottom-themecolor: accent1; mso-element: para-border-div; padding: 0in 0in 4pt;">
<div class="MsoTitle">
</div>
<div style="border-bottom: solid #4F81BD 1.0pt; border: medium; mso-border-bottom-themecolor: accent1; mso-element: para-border-div; padding: 0in 0in 4pt;">
<div class="MsoTitle">
<b style="font-size: 32px;"><span style="color: #365f91; font-family: Cambria; font-size: medium;"><span style="font-size: 14pt; line-height: 115%;">Chapter 4 – DICOM Objects</span></span></b></div>
</div>
<div style="text-align: justify;">
In <a href="chapter 3">chapter 3</a> we’ve learned about DICOM elements. Every element is one piece of typed data with a pre defined, well specified meaning. There are thousands of DICOM elements (See chapter 6 of the standard) from the very basic attributes of patient name and birth date to the most esoteric uses of 3D surface vortices. In this chapter we’re going to collect elements into image object that is called Secondary Capture Image. </div>
<div style="text-align: justify;">
<br></div>
<div style="text-align: justify;">
The guys at DICOM did a lot of very good work and created well defined classes for a very detailed Data Model. This is why I always advise to dig in the DICOM standard before designing your imaging device software because there’s a very good chance that the DICOM technical committees already did the work for you and you can save a lot of expansive design time this way. </div>
<div style="text-align: justify;">
<br></div>
<div style="text-align: justify;">
In a way DICOM objects definitions are similar to object oriented programming. I prefer though the analog to interfaces specifications. The motivation to adhere to a standard is to enable interoperability. By detailing information object definitions (IOD’s) DICOM enables us to exchange virtual objects between applications without knowing in advance anything about the application we are going to interface with. </div>
<div style="text-align: justify;">
<br></div>
<div style="text-align: justify;">
In this chapter I'm going to complete chapter’s 3 examples by adding elements to the object until it’s a valid Secondary Capture Image according to the DICOM standard. Secondary Capture Image is the simplest DICOM image object. Secondary Captures is not related to any specific device. It has the very basic set of elements that a DICOM application needs in order to display and archive a DICOM image properly.<br>
<br>
</div></div><a href="https://dicomiseasy.blogspot.com/2011/12/chapter-4-dicom-objects-in-chapter-3.html#more">Read more »</a>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com564RXM5F44+3J-30.8447683 153.4565-59.155002136178844 118.30025 -2.5345344638211529 -171.38725tag:blogger.com,1999:blog-4086510872090494676.post-30781947130444131692023-06-23T01:55:00.000-07:002023-06-23T01:55:14.419-07:00Introduction to DICOM - Chapter 3 - DICOM Elements<h3>
Chapter 3 – DICOM Elements</h3>
Let’s start with a useful example. Suppose you are a dermatologist and that you use your Smartphone digital camera to record and track patients’ skin condition. You practice a simple procedure that is basically this:<br>
<br>
1. Take a photo <br>
<br>
2. Send it to yourself by email <br>
<br>
3. Open the email on your laptop and save the picture in a folder having the patient name. <br>
<br>
As programmers, we don’t have to talk much about the flows of this practice but for a small, one doctor clinic, this might just work. <br>
<br>
In this lesson, we’ll take the JPEG image and DICOMIZE it. When we DICOMIZE an Image we wrap the image in a DICOM envelope and add important data that is required by the DICOM standard in order to enable all DICOM enabled applications to read and display the image correctly. It’s true that non DICOM application can display the JPEG image just as it is now without DICOMIZING but that’s another story. <br>
<br>
<a href="https://dicomiseasy.blogspot.com/2011/11/introduction-to-dicom-chapter-iii-dicom.html#more">Read more »</a>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com38tag:blogger.com,1999:blog-4086510872090494676.post-42154826828095232512023-06-23T01:37:00.000-07:002023-06-23T01:37:48.946-07:00Introduction to DICOM - Chpater 2 - Why is it this way in DICOM?<span class="Apple-style-span" style="font-size: 24px; font-weight: bold;">Introduction to DICOM</span><br>
<span class="Apple-style-span" style="font-size: 19px; font-weight: bold;">Chpater 2 - Why is it this way in DICOM?</span><br>
Many times when I explain features and aspects of DICOM I get questions like, “Why do you need DICOM if you have JPEG and XML?”; or, ”why is DICOM so complicated?”. Many variants of this question come up over and over again. These types of questions can be very broad or very specific and relate to all kind of choices that the people who write the standard make and the options that they take.<br>
<div>
<br>
</div><a href="https://dicomiseasy.blogspot.com/2011/10/introduction-to-dicom-chpater-2-why-is.html#more">Read more »</a>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com18tag:blogger.com,1999:blog-4086510872090494676.post-24698529041480674032023-06-23T01:12:00.000-07:002023-06-23T01:12:22.281-07:00Introduction to DICOM - Chapter 1 - Introduction<h2>
Introduction to DICOM</h2>
<h3>
<span class="Apple-style-span" style="font-size: small; font-weight: normal;">Chapter 1: Introduction</span></h3>
DICOM is a software integration standard that is used in Medical Imaging. All modern medical imaging systems (AKA Imaging Modalities) Equipment like X-Rays, Ultrasounds, CT (Computed Tomography), and MRI (Magnetic Resonance Imaging) support DICOM and use it extensively.<br>
<br>
In this tutorial I present a high level review of DICOM. We will look at DICOM from the user point of view trying to avoid the fine details when possible.<br>
<a href="https://dicomiseasy.blogspot.com/2011/10/introduction-to-dicom-chapter-1.html#more">Read more »</a>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com47tag:blogger.com,1999:blog-4086510872090494676.post-23686915640743748552023-04-06T10:29:00.000-07:002023-04-06T10:29:16.323-07:00New releases of MODALIZER+ and MODALIZER-SDK<p>A quick update on HRZ latest software releases. We've released MODALIZER+ V6.1 with video capture capabilities. Check the <a href="https://www.hrzkit.com/product_updates/new-release-modalizer-v6-1-brings-back-video-capture-directly-from-the-app/" target="_blank">post on HRZ web site</a>. And also a new release of MODALIZER-SDK (version <a href="http://3.2.2.4" target="_blank">3.2.2.4</a>) that is available on HRZ downloads page.</p>Ronihttp://www.blogger.com/profile/11833431782003065520noreply@blogger.com0tag:blogger.com,1999:blog-4086510872090494676.post-34801655448237763112023-02-01T22:50:00.003-08:002023-02-07T08:17:10.767-08:00Hello Dubai! A visit to ArabHealth 2023<div class="separator"><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhk3dzhB_zKfSMzdKqy77zxCLC8NWeTbJYj0LiRri8hzrysT-REcTxFXJT2Rj6WMxEU8hX_ANchihwXt4czJrppDyK1pa__S7oIhKrwE_DdCisoOn7TVJVLACWo2UDM1NCKJB8surhOxqYV9jAm-2r09CLmvr44SX5rQtlTWGhD6ZcVdmhu0HGQoAPUhw/s1599/Burj-Khalifa.jpeg" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1599" data-original-width="899" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhk3dzhB_zKfSMzdKqy77zxCLC8NWeTbJYj0LiRri8hzrysT-REcTxFXJT2Rj6WMxEU8hX_ANchihwXt4czJrppDyK1pa__S7oIhKrwE_DdCisoOn7TVJVLACWo2UDM1NCKJB8surhOxqYV9jAm-2r09CLmvr44SX5rQtlTWGhD6ZcVdmhu0HGQoAPUhw/w360-h640/Burj-Khalifa.jpeg" width="360"></a></td></tr><tr><td class="tr-caption" style="text-align: center;">The Moon over Burj Khalifa tower in Dubai</td></tr></tbody></table><p dir="ltr" style="margin-left: 1em; margin-right: 1em; text-align: left;">The <a href="https://en.wikipedia.org/wiki/Abraham_Accords" rel="nofollow" target="_blank">Abraham Accords</a> opened the UAE to Israelis and here I am in Dubai for the <a href="https://www.arabhealthonline.com/" target="_blank">ArabHealth</a> 2023 convention. I'm not a big fan of trade shows but when the opportunity came up I just couldn't say no. Add to that the 10% discount on <a href="https://www.emirates.com" rel="nofollow" target="_blank">Emirates</a> flights a week before and after the show and the connection flight to Colombo, Sri Lanka, one of my favorite surf destinations, and there you go, business and pleasure comes together. </p><p dir="ltr" style="margin-left: 1em; margin-right: 1em; text-align: left;">Business first, how can you make business in a trade show? </p><p dir="ltr" style="margin-left: 1em; margin-right: 1em; text-align: left;"></p><ol dir="ltr" style="text-align: left;"><li>Set up a booth, you may say? Well, for a small company like HRZ, when looking at the huge pavilions of GE and Siemens, I don't think so. Actually I tried this once at <a href="https://www.medica-tradefair.com" target="_blank">MEDICA</a> and wasn't happy at all with the results.<span></span></li></ol></div><a href="https://dicomiseasy.blogspot.com/2023/02/hello-dubai-visit-to-arabhealth-2023.html#more">Read more »</a>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com0tag:blogger.com,1999:blog-4086510872090494676.post-50082561625205792182021-08-01T03:20:00.006-07:002023-03-24T10:56:13.796-07:00MODALIZER+ V6<p dir="ltr" style="text-align: center;"></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEhkS5iQt62CNpHilCOZ_GXH55ndTX387IcH1kRs9STdZedlasmJuAAaXKmX8CpZIsK0XbujHRKHLNeGxFqkTsW0f1zgSs-knjB1HxRar9mSGh8_F9E49bF4uhMCchqudqszCTPDhuz5FCdk8MwtIJv87TM5pp9wHeHxqKRJ9wGRIqRkfxSKRs5ZQzUfKw" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="141" data-original-width="141" src="https://blogger.googleusercontent.com/img/a/AVvXsEhkS5iQt62CNpHilCOZ_GXH55ndTX387IcH1kRs9STdZedlasmJuAAaXKmX8CpZIsK0XbujHRKHLNeGxFqkTsW0f1zgSs-knjB1HxRar9mSGh8_F9E49bF4uhMCchqudqszCTPDhuz5FCdk8MwtIJv87TM5pp9wHeHxqKRJ9wGRIqRkfxSKRs5ZQzUfKw=s16000"></a></div><p></p><p dir="ltr" style="text-align: left;">Well, I guess it's time to celebrate. <a href="https://www.dicomizer.com">MODALIZER+ V6</a> is being released today. Seriously, it's been a long journey. We started working on this version more than two years ago. This been a team work of many people. Evgenia that was in charge of the DICOMIZER-MODALIZER product line since its beginning, Bezalel that designed the new UI, Bar that finished the work and added the latest features, and also David and Rotem that helped allong the way. Additionally, this release completes the work on all HRZ V6 products: <a href="https://www.hrzkit.com/products/modalizer-sdk/">MODAIZER-SDK DICOM Library</a>, <a href="https://www.hl7kit.com">ZiKiT PACS Server</a> and now MODALIZER+.</p><p dir="ltr" style="text-align: left;">So, what's new in MODALIZER+ V6? The first thing you will notice is of course the new graphic design.</p><div class="separator" style="clear: both; text-align: center;"><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlBsAG2dswqzDL_XnEbfUwuSMEoilXUFXUJrxgvVjNw8uOmjM3WbwaJ25d238VllHnUMo26hEHJQO7jRm43yXsWOsY4YuQwWxqoYa-WvVgxsiYlgs6qFqg1Xz5otr4PwwBBBOH72rEItPu/s1477/MPV6_MAIN.png.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="800" data-original-width="1477" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlBsAG2dswqzDL_XnEbfUwuSMEoilXUFXUJrxgvVjNw8uOmjM3WbwaJ25d238VllHnUMo26hEHJQO7jRm43yXsWOsY4YuQwWxqoYa-WvVgxsiYlgs6qFqg1Xz5otr4PwwBBBOH72rEItPu/s320/MPV6_MAIN.png.jpg" width="320"></a></td></tr><tr><td class="tr-caption" style="text-align: center;">MODALIZER+ V6 Home Screen<br><br></td></tr></tbody></table><div class="separator" dir="ltr" style="clear: both; text-align: left;">The new MODALIZER+ is colorful. You will also notice the colors are following into the different workflows, allowing the user to distinguish between them, as we realized that some of the screens look very similar to one another. Also, there's usability, you will notice larger fonts and wider spaces.</div><span></span></div><a href="https://dicomiseasy.blogspot.com/2021/08/modalizer-v6.html#more">Read more »</a>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com0tag:blogger.com,1999:blog-4086510872090494676.post-55534911316843035252021-01-18T02:06:00.005-08:002021-01-18T02:10:39.880-08:00Move all studies of patients with ID in CSV file from PACS-A to PACS-B<p>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 <a href="http://modalizer-sdk.roniza.com" target="_blank">MODALIZER-SDK</a> 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 <a href="https://www.hrzkit.com/solutions/archiving-solutions/" target="_blank">lightweight PACS server</a> with no plugin so the DICOM files were saved on the disk and from there he picked them up.</p><p style="color: darkred; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: #a82d00;">$my_ae_title</span><span style="color: dimgrey;">=</span>"MY-AE-TITLE"</p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px; min-height: 9px;"><br /></p><p style="color: #a82d00; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;">$pacs_a_ae_title<span style="color: dimgrey;">=</span><span style="color: darkred;">"PACS-A"</span></p><p style="color: #a82d00; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;">$pacs_a_ip_address<span style="color: dimgrey;">=</span><span style="color: darkred;">"10.0.0.10"</span></p><p style="color: #a82d00; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;">$pacs_a_dicom_port<span style="color: dimgrey;">=</span><span style="color: purple;">104</span></p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px; min-height: 9px;"><br /></p><p style="color: #a82d00; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;">$pacs_b_ae_title<span style="color: dimgrey;">=</span><span style="color: darkred;">"PACS-B"</span></p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px; min-height: 9px;"><br /></p><p style="color: blueviolet; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: darkblue;">function</span><span style="color: black;"> </span>MoveStudyByPatientID<span style="color: black;"> { </span></p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px; min-height: 9px;"><span class="Apple-tab-span" style="white-space: pre;"> </span></p><p style="color: darkblue; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>param<span style="color: black;">(</span><span style="color: #a82d00;">$pat</span><span style="color: black;">)</span></p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px; min-height: 9px;"><span class="Apple-tab-span" style="white-space: pre;"> </span></p><p style="color: blueviolet; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #a82d00;">$r</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: blue;">New-Object</span><span style="color: black;"> </span><span style="color: navy;">-ComObject</span><span style="color: black;"> </span>rzdcx.DCXREQ</p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px; min-height: 9px;"> </p><p style="color: darkgreen; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"> </span># Lets echo to be sure</p><p style="color: #a82d00; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>$r<span style="color: dimgrey;">.</span><span style="color: black;">Echo(</span>$my_ae_title<span style="color: dimgrey;">,</span><span style="color: black;"> </span>$pacs_a_ae_title<span style="color: dimgrey;">,</span><span style="color: black;"> </span>$pacs_a_ip_address<span style="color: dimgrey;">,</span><span style="color: black;"> </span>$pacs_a_dicom_port<span style="color: black;">)</span></p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px; min-height: 9px;"><span class="Apple-tab-span" style="white-space: pre;"> </span></p><p style="color: blueviolet; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #a82d00;">$o</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: blue;">New-Object</span><span style="color: black;"> </span><span style="color: navy;">-ComObject</span><span style="color: black;"> </span>rzdcx.DCXOBJ</p><p style="color: blueviolet; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #a82d00;">$e</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: blue;">New-Object</span><span style="color: black;"> </span><span style="color: navy;">-ComObject</span><span style="color: black;"> </span>rzdcx.DCXELM</p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px; min-height: 9px;"><span class="Apple-tab-span" style="white-space: pre;"> </span></p><p style="color: darkgreen; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span># Query Level - STUDY</p><p style="color: purple; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #a82d00;">$e</span><span style="color: dimgrey;">.</span><span style="color: black;">Init(</span>0x00080052<span style="color: black;">)</span></p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #a82d00;">$e</span><span style="color: dimgrey;">.</span>Value <span style="color: dimgrey;">=</span> <span style="color: darkred;">"STUDY"</span></p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #a82d00;">$o</span><span style="color: dimgrey;">.</span>insertElement(<span style="color: #a82d00;">$e</span>)</p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px; min-height: 9px;"><span class="Apple-tab-span" style="white-space: pre;"> </span></p><p style="color: darkgreen; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span># Patient ID</p><p style="color: purple; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #a82d00;">$e</span><span style="color: dimgrey;">.</span><span style="color: black;">Init(</span>0x00100020<span style="color: black;">)</span></p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #a82d00;">$e</span><span style="color: dimgrey;">.</span>Value <span style="color: dimgrey;">=</span> <span style="color: #a82d00;">$pat</span></p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #a82d00;">$o</span><span style="color: dimgrey;">.</span>insertElement(<span style="color: #a82d00;">$e</span>)</p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px; min-height: 9px;"><span class="Apple-tab-span" style="white-space: pre;"> </span></p><p style="color: darkgreen; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span># Study Instance UID</p><p style="color: purple; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #a82d00;">$e</span><span style="color: dimgrey;">.</span><span style="color: black;">Init(</span>0x0020000d<span style="color: black;">)</span></p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"> <span style="color: #a82d00;">$e</span><span style="color: dimgrey;">.</span>Value <span style="color: dimgrey;">=</span> <span style="color: darkred;">""</span></p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #a82d00;">$o</span><span style="color: dimgrey;">.</span>insertElement(<span style="color: #a82d00;">$e</span>)</p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px; min-height: 9px;"><span class="Apple-tab-span" style="white-space: pre;"> </span></p><p style="color: #a82d00; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>$i<span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span>$r<span style="color: dimgrey;">.</span><span style="color: black;">Query(</span>$my_ae_title<span style="color: dimgrey;">,</span><span style="color: black;"> </span>$pacs_a_ae_title<span style="color: dimgrey;">,</span><span style="color: black;"> </span>$pacs_a_ip_address<span style="color: dimgrey;">,</span><span style="color: black;"> </span>$pacs_a_dicom_port<span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: darkred;">"1.2.840.10008.5.1.4.1.2.1.1"</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span>$o<span style="color: black;">)</span></p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"> <span style="color: darkblue;">if</span> (<span style="color: #a82d00;">$i</span><span style="color: dimgrey;">.</span>AtEnd()) {</p><p style="color: darkred; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"> </span>"No Studies for patient id: "<span style="color: black;"> </span><span style="color: dimgrey;">+</span><span style="color: black;"> </span><span style="color: #a82d00;">$pat</span></p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"> }</p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"> <span style="color: darkblue;">else</span></p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"> {</p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"> <span style="color: darkblue;">while</span> (<span style="color: #a82d00;">$i</span><span style="color: dimgrey;">.</span>AtEnd() <span style="color: dimgrey;">-ne</span> <span style="color: #a82d00;">$true</span>)</p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"> {</p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"> <span style="color: #a82d00;">$res</span> <span style="color: dimgrey;">=</span> <span style="color: #a82d00;">$i</span><span style="color: dimgrey;">.</span>Get()</p><p style="color: darkred; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span> </span>"LOG: Study Instance UID: "<span style="color: black;"> </span><span style="color: dimgrey;">+</span><span style="color: black;"> </span><span style="color: #a82d00;">$res</span><span style="color: dimgrey;">.</span><span style="color: black;">GetElement(</span><span style="color: purple;">0x0020000d</span><span style="color: black;">)</span><span style="color: dimgrey;">.</span><span style="color: black;">Value</span></p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span style="color: #a82d00;">$o</span><span style="color: dimgrey;">.</span>insertElement(<span style="color: #a82d00;">$res</span><span style="color: dimgrey;">.</span>GetElement(<span style="color: purple;">0x0020000d</span>))</p><p style="color: #a82d00; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span> </span>$r<span style="color: dimgrey;">.</span><span style="color: black;">Move(</span>$my_ae_title<span style="color: dimgrey;">,</span><span style="color: black;"> </span>$pacs_a_ae_title<span style="color: dimgrey;">,</span><span style="color: black;"> </span>$pacs_a_ip_address<span style="color: dimgrey;">,</span><span style="color: black;"> </span>$pacs_a_dicom_port<span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: purple;">104</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span>$pacs_b_ae_title<span style="color: dimgrey;">,</span><span style="color: black;"> </span>$o<span style="color: black;">)</span></p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"> <span style="color: #a82d00;">$i</span><span style="color: dimgrey;">.</span>Next();</p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span> } </p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"> }</p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;">}</p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px; min-height: 9px;"><br /></p><p style="color: darkgreen; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"># A log never hurts</p><p style="color: blueviolet; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: #a82d00;">$a</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: blue;">New-Object</span><span style="color: black;"> </span><span style="color: navy;">-ComObject</span><span style="color: black;"> </span>rzdcx.DCXAPP</p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: #a82d00;">$a</span><span style="color: dimgrey;">.</span>StartLogging(<span style="color: darkred;">"log.log"</span>)</p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: #a82d00;">$a</span><span style="color: dimgrey;">.</span>LogLevel <span style="color: dimgrey;">=</span> <span style="color: purple;">5</span></p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px; min-height: 9px;"><br /></p><p style="color: blueviolet; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: #a82d00;">$patients</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: blue;">Import-Csv</span><span style="color: black;"> </span><span style="color: navy;">-Path</span><span style="color: black;"> </span>.\patients.csv</p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: darkblue;">foreach</span> (<span style="color: #a82d00;">$pat</span> <span style="color: darkblue;">in</span> <span style="color: #a82d00;">$patients</span><span style="color: dimgrey;">.</span>patient_id) </p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;">{</p><p style="color: darkred; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"> </span>"LOG: Patient ID: "<span style="color: black;"> </span><span style="color: dimgrey;">+</span><span style="color: black;"> </span><span style="color: #a82d00;">$pat</span></p><p style="color: blue; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>MoveStudyByPatientID<span style="color: black;"> </span><span style="color: #a82d00;">$pat</span></p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;">}</p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px; min-height: 9px;"><br /></p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: #a82d00;">$a</span><span style="color: dimgrey;">.</span>StopLogging()</p><p style="font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px; min-height: 9px;"><br /></p><p style="color: darkgreen; font-family: "Lucida Console"; font-stretch: normal; line-height: normal; margin: 0px;"># That's it for now </p><div><br /></div><p><br /></p><p><br /></p>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com3tag:blogger.com,1999:blog-4086510872090494676.post-57100079011684974012020-12-22T08:11:00.004-08:002020-12-22T08:11:47.504-08:00 Finally released, ZiKiT 2020, now available on our web site<p></p><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJB_9uhDayiH6e4mxT113-vRxcia01tz0xRCxMm-jx8qJl-gIoK_5-TGBE1WqmDOiUAbQOZK2xuRwitPa87vcOJV07yT09Z1ncWjA-bE6KFizYtbQ89dVMPq-gAxl_LTxBygLvLF663KFL/s1125/ZiKiT2020.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="488" data-original-width="1125" height="278" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJB_9uhDayiH6e4mxT113-vRxcia01tz0xRCxMm-jx8qJl-gIoK_5-TGBE1WqmDOiUAbQOZK2xuRwitPa87vcOJV07yT09Z1ncWjA-bE6KFizYtbQ89dVMPq-gAxl_LTxBygLvLF663KFL/w640-h278/ZiKiT2020.jpg" width="640" /></a></div><br /><span style="text-align: left;">This was a race against the clock but finally its on our downloads web site.</span></div><div class="separator" style="clear: both; text-align: center;"><span style="text-align: left;">Check it out.</span></div><div class="separator" style="clear: both; text-align: center;"><span style="text-align: left;">Here's the <a href="http://downloads.roniza.com/zikit/3.1.0/">link</a>.</span></div><div class="separator" style="clear: both; text-align: center;"><span style="text-align: left;"><br /></span></div><p></p>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com0tag:blogger.com,1999:blog-4086510872090494676.post-51687951337498650142020-08-27T04:55:00.008-07:002020-08-27T04:58:03.114-07:00Sending DICOM files indexed in a DICOMDIR on a DICOM CD to PACS using PowerShell and MODALIZER-SDK<p> I'm posting this PowerShell script in response to a question I got about sending DICOM files on a CD to PACS. </p><p>This functionality is available in <a href="https://www.modalizer.plus">MODALIZER+</a> 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.</p><p>But, for the automation enthusiasts, here's a PowerShell script that do the same. Recalling on <a href="http://dicomiseasy.blogspot.co.il/2013/03/dicomdir-and-media-interchange.html">DICOMDIR</a>, 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 <a href="http://modalizer-sdk.roniza.com/group___storage_s_c_u.html#gab4663d6270597d78805b19f6c45fed3f">DCXREQ.Send</a> command to the PACS.</p><p>Here it is. Enjoy!</p><p style="color: darkgreen; font-family: helvetica; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black; font-stretch: normal; line-height: normal;"> </span># Send DICOMDIR Patients to PACS</p><p style="font-family: helvetica; font-stretch: normal; line-height: normal; margin: 0px; min-height: 11px;"><br></p><p style="color: #a82d00; font-family: helvetica; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: darkblue;">param</span><span style="color: black;">(</span>$rootFolder<span style="color: black;">);</span></p><span></span><a href="https://dicomiseasy.blogspot.com/2020/08/sending-dicom-files-indexed-in-dicomdir.html#more">Read more »</a>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com0tag:blogger.com,1999:blog-4086510872090494676.post-84041160050185813512019-05-08T08:32:00.001-07:002020-01-08T08:29:05.451-08:00More PowerShell DICOM<div style="color: darkgreen; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
# PowerShell DICOM</div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: darkgreen; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
# This little script becomes handy for example for a daily test of your PACS</div>
<div style="color: darkgreen; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
# It generates a 1000x1000 image with date and key attributes (Study, Series and Instance UID) burned in</div>
<div style="color: darkgreen; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
# This script uses HRZ's RZDCX.DLL.</div>
<div style="color: darkgreen; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
# See <a href="https://dicomiseasy.blogspot.com/2019/01/powershell-dicom-scripting.html">https://dicomiseasy.blogspot.com/2019/01/powershell-dicom-scripting.html</a></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: darkgreen; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
# Create DICOM Object</div>
<div style="color: blueviolet; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$DCM</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: blue;">New-Object</span><span style="color: black;"> </span><span style="color: navy;">-com</span><span style="color: black;"> </span>rzdcx.DCXOBJ</div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: darkgreen; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
# UID Generator</div>
<div style="color: blueviolet; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$UID</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: blue;">New-Object</span><span style="color: black;"> </span><span style="color: navy;">-com</span><span style="color: black;"> </span>rzdcx.DCXUID</div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: darkgreen; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
# Create new Key UID's</div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$studyInstanceUID<span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span>$UID<span style="color: dimgrey;">.</span><span style="color: black;">CreateUID(</span><span style="color: purple;">1</span><span style="color: black;">)</span></div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$seriesInstanceUID<span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span>$UID<span style="color: dimgrey;">.</span><span style="color: black;">CreateUID(</span><span style="color: purple;">2</span><span style="color: black;">)</span></div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$sopInstanceUID<span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span>$UID<span style="color: dimgrey;">.</span><span style="color: black;">CreateUID(</span><span style="color: purple;">3</span><span style="color: black;">)</span></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: darkgreen; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
# Add minimal elements to the dataset</div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$tagValues<span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> @(</span></div>
<div style="color: darkred; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: purple;">0x00080016</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span>"1.2.840.10008.5.1.4.1.1.7"<span style="color: dimgrey;">,</span><span style="color: black;"> </span></div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: purple;">0x00080018</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span>$sopInstanceUID<span style="color: dimgrey;">,</span></div>
<div style="color: purple; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
0x00080020<span style="color: dimgrey;">,</span><span style="color: black;"> (</span><span style="color: #a82d00;">$studyDate</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: blue;">Get-Date</span><span style="color: black;"> </span><span style="color: navy;">-UFormat</span><span style="color: black;"> </span><span style="color: darkred;">"%Y%m%d"</span><span style="color: black;">)</span><span style="color: dimgrey;">,</span></div>
<div style="color: purple; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
0x00080030<span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: darkred;">""</span><span style="color: dimgrey;">,</span></div>
<div style="color: darkred; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: purple;">0x00080050</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span>"ACCNUMHRZTEST"<span style="color: dimgrey;">,</span></div>
<div style="color: purple; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
0x00080060<span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: darkred;">"SC"</span><span style="color: dimgrey;">,</span></div>
<div style="color: purple; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
0x00080064<span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: darkred;">"WSD"</span><span style="color: dimgrey;">,</span></div>
<div style="color: purple; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
0x00080090<span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: darkred;">"HRZ"</span><span style="color: dimgrey;">,</span></div>
<div style="color: purple; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
0x00100010<span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: darkred;">"HRZ^TEST"</span><span style="color: dimgrey;">,</span></div>
<div style="color: purple; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
0x00100020<span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: darkred;">"HRZTEST"</span><span style="color: dimgrey;">,</span></div>
<div style="color: purple; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
0x00100030<span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: darkred;">"20100101"</span><span style="color: dimgrey;">,</span></div>
<div style="color: purple; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
0x00100040<span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: darkred;">"O"</span><span style="color: dimgrey;">,</span></div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: purple;">0x0020000d</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span>$studyInstanceUID<span style="color: dimgrey;">,</span></div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: purple;">0x0020000e</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span>$seriesInstanceUID<span style="color: dimgrey;">,</span></div>
<div style="color: purple; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
0x00200010<span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: darkred;">"123"</span><span style="color: dimgrey;">,</span></div>
<div style="color: purple; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
0x00200011<span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: darkred;">"1"</span><span style="color: dimgrey;">,</span></div>
<div style="color: purple; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
0x00200013<span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: darkred;">"1"</span><span style="color: black;">)</span></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: blueviolet; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$E</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: blue;">New-Object</span><span style="color: black;"> </span><span style="color: navy;">-com</span><span style="color: black;"> </span>rzdcx.DCXELM</div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: darkblue;">for</span> ((<span style="color: #a82d00;">$i</span><span style="color: dimgrey;">=</span><span style="color: purple;">0</span>); (<span style="color: #a82d00;">$i</span> <span style="color: dimgrey;">-lt</span> <span style="color: #a82d00;">$tagValues</span><span style="color: dimgrey;">.</span>Count); (<span style="color: #a82d00;">$i</span><span style="color: dimgrey;">+=</span><span style="color: purple;">2</span>))</div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal;">
{</div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span>$E<span style="color: dimgrey;">.</span><span style="color: black;">Init(</span>$tagValues<span style="color: dimgrey;">[</span>$i<span style="color: dimgrey;">]</span><span style="color: black;">)</span></div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: black;"> </span>$E<span style="color: dimgrey;">.</span><span style="color: black;">Value </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span>$tagValues<span style="color: dimgrey;">[</span>$i<span style="color: dimgrey;">+</span><span style="color: purple;">1</span><span style="color: dimgrey;">]</span></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$DCM</span><span style="color: dimgrey;">.</span>insertElement(<span style="color: #a82d00;">$E</span>)</div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal;">
}</div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: darkgreen; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
# Create 1000x1000 Image with text printed on it</div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$rows<span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: purple;">1000</span></div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$cols<span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: purple;">1000</span></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: darkgreen; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
# jpeg image</div>
<div style="color: blueviolet; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: blue;">Add-Type</span><span style="color: black;"> </span><span style="color: navy;">-AssemblyName</span><span style="color: black;"> </span>System.Drawing</div>
<div style="color: darkred; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$imageFormat</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span>"System.Drawing.Imaging.ImageFormat"<span style="color: black;"> </span><span style="color: dimgrey;">-as</span><span style="color: black;"> </span><span style="color: dimgrey;">[</span><span style="color: #006161;">type</span><span style="color: dimgrey;">]</span></div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$format<span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span>$imageFormat<span style="color: dimgrey;">::</span><span style="color: black;">jpeg</span></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: darkred; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$uidType</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span>"rzdcx.UID_TYPE"<span style="color: black;"> </span><span style="color: dimgrey;">-as</span><span style="color: black;"> </span><span style="color: dimgrey;">[</span><span style="color: #006161;">type</span><span style="color: dimgrey;">]</span></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$createDate<span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: blue;">Get-Date</span></div>
<div style="color: blueviolet; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$bmp</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: blue;">new-object</span><span style="color: black;"> </span>System.Drawing.Bitmap<span style="color: black;"> </span><span style="color: #a82d00;">$cols</span><span style="color: dimgrey;">,</span><span style="color: #a82d00;">$rows</span></div>
<div style="color: blueviolet; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$font</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: blue;">new-object</span><span style="color: black;"> </span>System.Drawing.Font<span style="color: black;"> </span>Consolas<span style="color: dimgrey;">,</span><span style="color: purple;">24</span><span style="color: black;"> </span></div>
<div style="color: #006161; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$brushBg</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: dimgrey;">[</span>System.Drawing.Brushes<span style="color: dimgrey;">]::</span><span style="color: black;">Yellow </span></div>
<div style="color: #006161; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$brushFg</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: dimgrey;">[</span>System.Drawing.Brushes<span style="color: dimgrey;">]::</span><span style="color: black;">Black </span></div>
<div style="color: #006161; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$graphics</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: dimgrey;">[</span>System.Drawing.Graphics<span style="color: dimgrey;">]::</span><span style="color: black;">FromImage(</span><span style="color: #a82d00;">$bmp</span><span style="color: black;">) </span></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$graphics</span><span style="color: dimgrey;">.</span>FillRectangle(<span style="color: #a82d00;">$brushBg</span><span style="color: dimgrey;">,</span><span style="color: purple;">0</span><span style="color: dimgrey;">,</span><span style="color: purple;">0</span><span style="color: dimgrey;">,</span><span style="color: #a82d00;">$bmp</span><span style="color: dimgrey;">.</span>Width<span style="color: dimgrey;">,</span><span style="color: #a82d00;">$bmp</span><span style="color: dimgrey;">.</span>Height) </div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$graphics<span style="color: dimgrey;">.</span><span style="color: black;">DrawString(</span>$createDate<span style="color: dimgrey;">,</span><span style="color: black;"> </span>$font<span style="color: dimgrey;">,</span>$brushFg<span style="color: dimgrey;">,</span><span style="color: purple;">10</span><span style="color: dimgrey;">,</span><span style="color: purple;">10</span><span style="color: black;">) </span></div>
<div style="color: blueviolet; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$font</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: blue;">new-object</span><span style="color: black;"> </span>System.Drawing.Font<span style="color: black;"> </span>Consolas<span style="color: dimgrey;">,</span><span style="color: purple;">8</span><span style="color: black;"> </span></div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$graphics<span style="color: dimgrey;">.</span><span style="color: black;">DrawString(</span><span style="color: darkred;">"StudyInstance UID: "</span><span style="color: black;"> </span><span style="color: dimgrey;">+</span><span style="color: black;"> </span>$studyInstanceUID<span style="color: dimgrey;">,</span><span style="color: black;"> </span>$font<span style="color: dimgrey;">,</span>$brushFg<span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: purple;">10</span><span style="color: dimgrey;">,</span><span style="color: purple;">110</span><span style="color: black;">) </span></div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$graphics<span style="color: dimgrey;">.</span><span style="color: black;">DrawString(</span><span style="color: darkred;">"Series Instance UID: "</span><span style="color: black;"> </span><span style="color: dimgrey;">+</span><span style="color: black;"> </span>$studyInstanceUID<span style="color: dimgrey;">,</span><span style="color: black;"> </span>$font<span style="color: dimgrey;">,</span>$brushFg<span style="color: dimgrey;">,</span><span style="color: purple;">10</span><span style="color: dimgrey;">,</span><span style="color: purple;">210</span><span style="color: black;">) </span></div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$graphics<span style="color: dimgrey;">.</span><span style="color: black;">DrawString(</span><span style="color: darkred;">"SOP Instance UID: "</span><span style="color: black;"> </span><span style="color: dimgrey;">+</span><span style="color: black;"> </span>$studyInstanceUID<span style="color: dimgrey;">,</span><span style="color: black;"> </span>$font<span style="color: dimgrey;">,</span>$brushFg<span style="color: dimgrey;">,</span><span style="color: purple;">10</span><span style="color: dimgrey;">,</span><span style="color: purple;">310</span><span style="color: black;">) </span></div>
<div style="color: darkred; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$graphics</span><span style="color: dimgrey;">.</span><span style="color: black;">DrawString(</span>"TARGET AET: "<span style="color: black;"> </span><span style="color: dimgrey;">+</span><span style="color: black;"> </span>"PACS-A"<span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: #a82d00;">$font</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: #a82d00;">$brushFg</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: purple;">10</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: purple;">410</span><span style="color: black;">) </span></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$graphics</span><span style="color: dimgrey;">.</span>Dispose() </div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: darkgreen; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
# Save the JPEG image</div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$filename<span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: darkred;">"</span>$home<span style="color: darkred;">\HRZTEST.jpg"</span></div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$bmp<span style="color: dimgrey;">.</span><span style="color: black;">Save(</span>$filename<span style="color: dimgrey;">,</span><span style="color: black;"> </span>$format<span style="color: black;">) </span></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: darkgreen; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
# Insert it to the DICOM object</div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$DCM</span><span style="color: dimgrey;">.</span>SetJpegFrames(<span style="color: #a82d00;">$filename</span>);</div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: darkgreen; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
# Save the DICOM file</div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$dcmfile<span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span>$filename<span style="color: black;"> </span><span style="color: dimgrey;">+</span><span style="color: black;"> </span><span style="color: darkred;">".dcm"</span></div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$DCM<span style="color: dimgrey;">.</span><span style="color: black;">saveFile(</span>$dcmfile<span style="color: black;">)</span></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: darkgreen; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
# Send it to the PACS</div>
<div style="color: blueviolet; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$REQ</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: blue;">New-Object</span><span style="color: black;"> </span><span style="color: navy;">-com</span><span style="color: black;"> </span>rzdcx.DCXREQ</div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$succeeded<span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: darkred;">""</span></div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$failed<span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: darkred;">""</span></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: darkgreen; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
# Start logging for network comunication and save to log file</div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: blueviolet; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$APP</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: blue;">New-Object</span><span style="color: black;"> </span><span style="color: navy;">-com</span><span style="color: black;"> </span>rzdcx.DCXAPP</div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$APP</span><span style="color: dimgrey;">.</span>LogLevel <span style="color: dimgrey;">=</span> <span style="color: purple;">5</span> <span style="color: darkgreen;"># Debug</span></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: darkred; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$logFile</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span>"<span style="color: #a82d00;">$home</span>\SendTestImage.log"</div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$APP</span><span style="color: dimgrey;">.</span>StartLogging(<span style="color: #a82d00;">$logFile</span>)</div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: darkred; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$REQ</span><span style="color: dimgrey;">.</span><span style="color: black;">Echo(</span>"HRZ-TEST"<span style="color: dimgrey;">,</span><span style="color: black;"> </span>"PACS-A"<span style="color: dimgrey;">,</span><span style="color: black;"> </span>"localhost"<span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: purple;">104</span><span style="color: black;">)</span></div>
<div style="color: darkred; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$REQ</span><span style="color: dimgrey;">.</span><span style="color: black;">Send(</span>"HRZ-TEST"<span style="color: dimgrey;">,</span><span style="color: black;"> </span>"PACS-A"<span style="color: dimgrey;">,</span><span style="color: black;"> </span>"localhost"<span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: purple;">104</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: #a82d00;">$dcmfile</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: dimgrey;">[</span><span style="color: #006161;">ref</span><span style="color: dimgrey;">]</span><span style="color: black;"> </span><span style="color: #a82d00;">$succeeded</span><span style="color: dimgrey;">,</span><span style="color: black;"> </span><span style="color: dimgrey;">[</span><span style="color: #006161;">ref</span><span style="color: dimgrey;">]</span><span style="color: black;"> </span><span style="color: #a82d00;">$failed</span><span style="color: black;">)</span></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: darkgreen; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
# Print results</div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$filename</div>
<div style="color: #a82d00; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
$dcmfile</div>
<div style="color: darkred; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
"Succeeded: "<span style="color: black;"> </span><span style="color: dimgrey;">+</span><span style="color: black;"> </span><span style="color: #a82d00;">$succeeded</span></div>
<div style="color: darkred; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
"Failed: "<span style="color: black;"> </span><span style="color: dimgrey;">+</span><span style="color: black;"> </span><span style="color: #a82d00;">$failed</span></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: darkgreen; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
# Stop logging</div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal;">
<span style="color: #a82d00;">$App</span><span style="color: dimgrey;">.</span>StopLogging()</div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="color: darkred; font-family: "lucida console"; font-stretch: normal; line-height: normal;">
"Done!"</div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<br />
<div style="font-family: "lucida console"; font-stretch: normal; line-height: normal; min-height: 9px;">
<br /></div>
<div>
<br /></div>
ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com3tag:blogger.com,1999:blog-4086510872090494676.post-3972602026875680992019-01-15T08:35:00.002-08:002019-10-14T11:51:44.369-07:00PowerShell DICOM ScriptingDisclosure: This post is purely technical!<br />
Assumption: you know your way around PowerShell or how to get there and a bit of DICOM and our RZDCX API.<br />
<br />
If your system is x64 (probably) than make sure to regsvr32 radix.dll the x64 version.<br />
<br />
Let's PowerShell!!!<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"># download rzdcx</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">Invoke-WebRequest -Uri http://downloads.roniza.com/rzdcx/2.0.8.7/RZDCX_2087.zip -OutFile ./rzdcx.zip</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"># unzip it</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">Expand-Archive ./rzdcx.zip -DestinationPath ./rzdcx</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"># regsvr32 win32 version</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">$rzdcx32 = Resolve-Path .\rzdcx\win32\rzdcx.dll</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">Start-Process regsvr32 -verb runAs -argumentlist $rzdcx32</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">$rzdcx64 = Resolve-Path .\rzdcx\x64\rzdcx.dll</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">Start-Process regsvr32 -verb runAs -argumentlist $rzdcx64</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"># Create DICOM Object</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">$DCM = New-Object -com rzdcx.DCXOBJ</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"># I assume you have a directory called DICOM with DICOM files in it</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">$files = @(Get-ChildItem ".\DICOM\*")</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"># Write headers</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">"filename, Patient Name, Patient ID"</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"># For each file extract and print patient name and patient id</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">foreach ($file in $files) {</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> $DCM.openFile($file)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> $patname = $DCM.GetElement([int32]::Parse(00100010,'HexNumber')).Value</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> $patid = $DCM.GetElement([int32]::Parse(00100020,'HexNumber')).Value</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> Write-Host $file "," $patname "," $patid</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">}</span><br />
<br />
Try it!<br />
<div>
<br /></div>
<br />Ronihttp://www.blogger.com/profile/11833431782003065520noreply@blogger.com7tag:blogger.com,1999:blog-4086510872090494676.post-26424011298382833842018-11-01T14:37:00.000-07:002018-11-01T14:44:21.738-07:00HL7Kit 2018 - Integrated DICOM and HL7 SolutionYo! It's been a while ... no posts since June 2016 :-§<br>
<br>
Maybe its because when you do there's less time to talk, ah? Anyway, I finally got some time for it and that's because HRZ have finally officially released HL7Kit 2018. Yeah! Check this <a href="https://www.hl7kit.com/" target="_blank">beautiful little web site</a> we've published for the occasion. Let me tell you about this product that my team and I worked so hard to push through the door.<br>
<br>
For those of you that worked with the kit before, the first thing you will notice is the new UX. We've invested in usability and graphic design to make the kit nicer and simpler to use.<br>
<br>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPF6mc2xP0Uya8WefX9RpGE73YOtJiiipEZ8UGPJRqz9uTxlhxrelOrbw_pVKBuMgVx1aNStlC_FRBSgbeoFfxuGmc5IkE4w5WdMvTCUy-lnH2B_M8_XlC14pYS-yV55H5ldRJdjQ-5Gz6/s1600/Screen+Shot+2018-11-01+at+11.32.00+PM.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="448" data-original-width="1238" height="231" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPF6mc2xP0Uya8WefX9RpGE73YOtJiiipEZ8UGPJRqz9uTxlhxrelOrbw_pVKBuMgVx1aNStlC_FRBSgbeoFfxuGmc5IkE4w5WdMvTCUy-lnH2B_M8_XlC14pYS-yV55H5ldRJdjQ-5Gz6/s640/Screen+Shot+2018-11-01+at+11.32.00+PM.png" width="640"></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">HL7Kit desktop applications shortcuts and the control panel</td></tr>
</tbody></table>
<br>
<span id="goog_653142600"></span><br>
Another improvement is that now the installation and evaluation is much simpler because after installation (which is just a series of next-next-nexts) everything works with an internal <a href="https://sqlite.org/" target="_blank">SQLite</a> database and by everything I mean everything! DICOM Storage, Q/R, Modality Worklist MPPS, and HL7 Orders ORM^O01 and Schedules SIU^S12 that are automatically mapped to Modality Worklist entries. Apart for the fact that it makes evaluation a snap, it also makes it really attractive for <br>
<a href="https://dicomiseasy.blogspot.com/2018/11/hl7kit-2018-integrated-dicom-and-hl7.html#more">Read more »</a>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com0tag:blogger.com,1999:blog-4086510872090494676.post-48139787128627477762016-06-25T01:01:00.002-07:002016-06-26T01:34:47.538-07:00ReflectionBack in the old days, C++ templates were the highest level of code abstraction for me. I loved creating template classes. On the other hand, <a href="https://msdn.microsoft.com/en-us/library/mt656691.aspx">Reflection</a>, when I first learned about it, it didn't raise such an emotional feeling in me. It seamed like a complicated way to do simple things. About a year ago I was lucky to work with John Volkar from Bayer Healthcare. His project used Reflection to transform between C# data members and DICOM data elements. Recently, while working on another project, this technique came in handy. It's a nice example of how to use the Attribute class to link between a data member and a DICOM tag. Here it is. Thanks John.<br>
<br>
<div>
First, how to you use it. It's very simple. Use the Tag attribute above the class member like this:<br>
<div style="font-family: Consolas; font-size: 9.5px; line-height: normal;">
<br></div>
<div style="font-family: Consolas; font-size: 9.5px; line-height: normal;">
[<span style="color: #33a2bd;">Tag</span>(0x0010,0x0010)]</div>
<div style="font-family: Consolas; font-size: 9.5px; line-height: normal;">
<span style="color: #0433ff;">public</span> <span style="color: #0433ff;">string</span> patient_name;</div>
<div style="font-family: Consolas; font-size: 9.5px; line-height: normal;">
<br></div>
<div style="font-family: Consolas; font-size: 9.5px; line-height: normal;">
<br></div>
This just mapped the patient_name member to a DICOM Patient Name data element by using the tag (0010,0010).<br>
<br>
</div><a href="https://dicomiseasy.blogspot.com/2016/06/reflection.html#more">Read more »</a>ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com5tag:blogger.com,1999:blog-4086510872090494676.post-24998069456017803832016-01-24T08:14:00.001-08:002023-03-24T09:54:54.199-07:00A ready-made DICOM Software that fits your needs - MODALIZER!<div>[update 24 March 2023: latest HRZ softwarecan be found on HRZ website - <a href="https://www.hrzkit.com">www.hrzkit.com</a>]</div><div><br /></div>Its here, its ready, its published, MODALIZER, Take it for a ride! This DICOM Application is really a game changer! We took our DICOM Toolkit, combined it with our examples, mixed in our stand alone software and created the MODALIZER. Its an amazing software waiting for your imaging device to turn it into something big.<br />
<br />
Lets say you're developing a new imaging technology and now you want to integrate it into the PACS environment. Take MODALIZER, configure your image capture application as the EXAP and that's it! MODALIZER takes care of all the rest.<br />
<br />
Look at this DIAGRAM:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3vKBdfQ7m7eJ7Qhx8XRRRfyjV3QnLqxRVaHML-rPdXnXyEphYt3rZpXfOHTUMr5jS4S899UDHL5acdYuchGcb2zSmX2kmerVcEZ9rKYhbWT9q3LhLpJMz0LtYryevIWamIU5CMUB0DB-S/s1600/Screen+Shot+2016-01-24+at+1.32.25+PM.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="318" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3vKBdfQ7m7eJ7Qhx8XRRRfyjV3QnLqxRVaHML-rPdXnXyEphYt3rZpXfOHTUMr5jS4S899UDHL5acdYuchGcb2zSmX2kmerVcEZ9rKYhbWT9q3LhLpJMz0LtYryevIWamIU5CMUB0DB-S/s320/Screen+Shot+2016-01-24+at+1.32.25+PM.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
MODALIZER is a stand-alone DICOM application that implements an Imaging Modality according to the IHE Scheduled Workflow (SWF) Technical Framework. MODALIZER provides all the UI and the DICOM integration. The imaging part is performed by your technology that MODALIZER launches to the front after collection the patient and study details. Your image capture program acquire the images and then gives back the control to MODALIZER to complete the study. So simple. </div>
<div class="separator" style="clear: both; text-align: left;">
And it comes with DICOM Conformance Statement and even more you can license its source code! Check it our on our web site.</div>
ronizahttp://www.blogger.com/profile/00133919772972711462noreply@blogger.com2