Video to DICOM (and back)

This is a story of a lost battle. For many years I refused to add MPEG to DICOM functionality in my DICOM SDK. The explanation I gave to myself and to my customers was that storing video in PACS is a bad idea because video streams are usually very big and nobody ever watches them. From an engineering point of view, the size of the video is not so much a matter of disk space but rather a network headache. The way that the DICOM network protocol works, with all the different levels of timeouts and with no failover mechanisms for PDU’s may cause such huge objects to fail over and over when stored and restored. For the clinical point of view, I consulted with Radiologists friends from whom I learned that the driving force behind keeping most of this stuff is not clinical but rather medico legal. These excuses held for some time but eventually, because I’m an engineer but also a businessman, I changed my mind. After all, the customer is always right, and when more and more customers asked to convert video to DICOM, I realized that winning this battle means loosing customers and that’s not something a businessman should do.

Videos were added to DICOM through the mechanism of Transfer Syntax. All together there are currently four (4) video transfer syntaxes for different types of MPEG’s. Here's the list of these transfer syntaxes:
  • MPEG2 Main Profile @ Main Level : "1.2.840.10008.1.2.4.100"
  • MPEG2 Main Profile @ High Level : "1.2.840.10008.1.2.4.101"
  • MPEG-4 AVC/H.264 High Profile / Level 4.1 : "1.2.840.10008.1.2.4.102"
  • MPEG-4 AVC/H.264 BD-compatible High Profile / Level 4.1 : "1.2.840.10008.1.2.4.103"


If I have to guess, there will probably be more added in the future as new formats of video gain take over. The embedded document option that was taken for PDF would probably be my choice but I admit that I didn’t investigate the reasons that led to the way the standard went and there may have

A short one on MPEG to DICOM

This is a quick post referencing our new release of RZDCX 2.0.4.2 that adds the option to convert MPEG to DICOM. I will post a longer article with all the information about MPEG and DICOM, video streams and audio hopefully by the end of this month. Meanwhile, check out this post on our web site and download the latest version of RZDCX DICOM SDK.
Here's a short C++ code snippet that creates a DICOM encapsulated MPEG to start with:

static void CreateVideo(string filename)
{
    /// Create a DCXOBJ
    IDCXOBJPtr obj(__uuidof(DCXOBJ));

    /// Create an element pointer to place in the object for every tag
    IDCXELMPtr el(__uuidof(DCXELM));

IDCXUIDPtr id(__uuidof(DCXUID));

rzdcxLib::ENCAPSULATED_VIDEO_PROPS videoProps;
videoProps.width = 352;
videoProps.Height = 288;
videoProps.PixelAspectRatioX = 4;
videoProps.PixelAspectRatioY = 3;
videoProps.FrameDurationMiliSec; // 40 msec = 25 FPS
videoProps.NumberOfFrames = 1600; // 1600 frames
videoProps.VideoFormat = rzdcxLib::MPEG2_AT_MAIN_LEVEL;
obj->SetVideoStream(filename.c_str(), videoProps);


obj->TransferSyntax = rzdcxLib::TS_MPEG2_MAIN_PROFILE_AT_HIGH_LEVEL;
    /// You don't have to create an element every time, 
    /// just initialize it.
char pn[]="John^Doe";
    el->Init(rzdcxLib::PatientsName);
    el->PutCStringPtr((int)pn);
    obj->insertElement(el);

el->Init(rzdcxLib::patientID);
    el->Value = "123765";
    obj->insertElement(el);

el->Init(rzdcxLib::studyInstanceUID);
el->Value = id->CreateUID(UID_TYPE_STUDY);
obj->insertElement(el);

el->Init(rzdcxLib::seriesInstanceUID);
el->Value = id->CreateUID(UID_TYPE_SERIES);
obj->insertElement(el);
el->Init(rzdcxLib::sopInstanceUID);
el->Value = id->CreateUID(UID_TYPE_INSTANCE);
obj->insertElement(el);

el->Init(rzdcxLib::sopClassUid);
el->Value = "1.2.840.10008.5.1.4.1.1.77.1.4.1"; // Video Photographic Image Storage
obj->insertElement(el);

el->Init(rzdcxLib::NumberOfFrames);
el->Value = (short)1600;
obj->insertElement(el);

el->Init(rzdcxLib::FrameIncrementPointer);
el->Value = rzdcxLib::FrameTime;
obj->insertElement(el);

filename += ".dcm";
obj->saveFile(filename.c_str());

}

One last note: You should know your video properties because we don't open or validate the MPEG file. More on "why is it this way" in the longer post soon.

What's new in RZDCX 2.0.4.0

A new release (2.0.4.0) of RZDCX Fast Strike DICOM Toolkit is ready in our downloads page.

The two major feature added in this release is the ability of DCXACC Class that implements the Storage SCP to receive DICOM Objects in memory and the Image property get in DCXOBJ . We've added the in memory accepter feature following a request from one of our customers that wanted to encrypt all Patient Healthcare Information (PHI) on the hard drive. By providing the stored object in memory, the object can be encrypted in memory and then stored encrypted to disk. An example of in memory storage is presented at the end of this post.

In release 2.0.3.9 intermediate release you could only access the last stored object from within OnStoreDone event. In release 2.0.4.0 the object stays in memory until the next request is handled or until the DCXACC object is disposed. Note therefore that if you use this feature and don't take the object you risk it staying in memory for a while.

A quick note: if you're not sure what version are you using, right click the ell and look at the details tab of the file propertoes. The release version is also set in the DICOM File Meta Header tag (0002,0013) - Implementation Version Name (RZDCX_2_0_4_0)  and sent in the association request/response in the same tag - Implementation Version Name.
RZDCX SDK Version
Another method that we've added following requests from many customers is the "No Exception" GetElement method in DCXOBJ. This method is similar to the old getElementByTag but it doesn't throw an "Element Not Found" exception. Instead if the element is not found it returns null. Depending on your preferences, either one of the methods can be used. If you must have this element or else your software should do something else use the getElementByTag and handle the exception. If on the other hand this element is optional for you, use GetElement.

DICOMIZER 3.0.3 Release Notes

The new build of DICOMIZER 3.0.3 is now available on our web site. This build addresses couple of minor issues that were found since the last release.

#155 License is installed only for installed user
#157 Default MWL query with Local AE Title checkbox use wrong AE
#159 Make "Thank you" on the activation end screen clickable

The new DICOMIZER is available for free 30 days evaluation. It was released few weeks ago and we get great feedback on it.

The most notable feature of the DICOMIZER 3.0 is the TWAIN/WIA interface that connects to supporting devices. The user can capture images directly from DICOMIZER and convert them to DICOM files.

It's the kitchen table for me


Written Expression Skills is the #1 requirement from every member in a  distributed development team

I love working from the kitchen table. After everyone in the house has left to their day, I take my laptop, a paper pad, a pencil, today's newspaper and a cup of Espresso and enjoy the silence and the space. These are my most productive hours. The kitchen's radio is playing classical music and I dive deep into my work.
Working from the Kitchen Table
Some members in our team live just few blocks away from each other, others live in another city and some are hundreds of miles away. It doest make much difference. Physical distance plays lesser role today then time zone.

Like our team, there are many others. They have learned to collaborate with team members that rarely meet face to face. People from different nations and different cultures that share a common passion to software and computers, byte crunchers, geeks, designers, artists, that enjoy the great versatility of the digital world.

Some of us maybe in different locations, away from the others, but they are not alone because we have a live and active communication channel, through which we are writing emails, chatting, sending smileys :) and thumbs ups (y), tickets and documents that we use to create great things together.

The internet opened new doors for international collaboration. Good communication has always been a key to success in almost everything and as communication became more and more efficient, successful projects get completed faster and better today then ever before.

But while this works in favor of team members that no longer need to spend hours commuting or others that get better paying oportunities, virtual teams sets new challenges to managers. Marisa Mayer decided that working from home is not good for Yahoo and shut it down. Intel on the other hand encourage employees to work from home ocasionally.

Managers of the traditional office work environment, that have strengths like charisma, excellent Verbal Expression Skills, eye contact, even looks, may

DICOMIZER 3.0 Beta 1 with TWAIN/WIA and DICOM SR

I'm very happy to announce our new DICOMIZER 3 is now available for download and evaluation.
This version has both TWAIN/WIA API and DICOM Structured Reports.
Adding the image capture and reporting makes the DICOMIZER 3 a complete product for patient encounter documentation.
DICOMIZER 3 also features enhanced viewer with Cine and improved performance.


The table bellow compares DICOMIZER 3 with the older DICOMIZER 2 that is still available for evaluation and purchase, now in a reduced price.
TWAIN/WIATWAIN/WIA Image CaptureNoYes
DICOM SRCompose and add Structured Report to StudyNoYes
ConvertJPEG to DICOMYesYes
BMP to DICOMYesYes
PNG to DICOMYesYes
PDF to DICOMYesYes
Create DICOM Multiframe ObjectsYesYes
Conversion TemplatesYesYes
DICOM to JPEG (Save As)NoYes
Converted Images PreviewNoYes
Converted Images ThumbnailsNoYes
DICOM ViewerMulti-Modality DICOM ViewerYesYes
DICOM Header Display with SearchYesYes
Optimized Instant load of long cine runsNoYes
Send from Viewer to PACSNoYes
Open file locationNoYes
DICOM CD/DVDBurn DICOM CD/DVDYesYes
Add DICOM CD Viewer to Burned CDYesYes
DICOM NetworkModaliry Worklist QueryYesYes
Modaliry Worklist Query Advanced SearchLess(less fields)Yes
Qurery/Retrieve SCU (C-FIND/C-MOVE)Less(less fields)Yes
Q/R Auto DisplayNoYes
Send converted DICOM Files to PACS (C-STORE)YesYes
Send Other DICOM FIles to PACS (C-STORE)NoYes
Verification (C-ECHO)YesYes
DICOM LogsYesYes

Unlinke DICOMIZER 2, this version requires email registration to evaluate. We do this hoping to have better connection with our users and customers. The evaluation license is valid for 30 days.