======DICOM in Dart (DCMiD)======
**Last updated: 1200 8 May 2014**
======Summary======
Our goal is to determine the feasibility of using binary DICOM for building brower-based medical applications. We want to design and implement a DICOM editor that reads and writes binary DICOM and displays it using HTML5, CSS3, and Google’s open source programming language, Dart. Our program should be able to parse and display binary DICOM imaging studies in less than 3 seconds.
* **Students:** Damish Shah (dshah15@jhu.edu); Danielle Tinio (dtinio1@jhu.edu)
* **Mentor:** Dr. James Philbin (james.philbin@jhmi.edu)
======The DICOM Standard======
Learning about the structure of the DICOM Standard and its nuances was the most crucial part in writing the web application. The DICOM Standard specifies the information entity hierarchy that a DICOM file should be stored in. At the very top it specifies a Patient which has a list of Studies. The hierarchy continues through Series followed by Instance until image frames occur at the lowest level, each stored within a separate Instance. At each level there exist information attributes about the current level, as well as a list of objects at the next lowest level of the hierarchy.
The DICOM Standard also specifies the way in which each of the information entities need to be stored in memory. A binary DICOM file has a top level Dataset that contains a list of Attributes. It is important to recognize the structure of an Attribute as the lowest level of storage specification in the DICOM Standard. Every bit of information in a DICOM file is stored as an Attribute. An Attribute is structured as shown in figure 1. An Attribute contains a unique, 4 byte, identifying Tag depending on the data that is being stored in the Attribute. The Tag contains a group part and an element part each of which is 2 bytes long. An Attribute also contains a 2 or 4 byte Value Representation that specifies the encoding of the value field contents and which parser should be used to read this Attribute. Next in the Attribute is a length field that contains the length in bytes of the Value Field. Finally, the Attribute has a Value Field that stores the actual data of the Attribute.
A Value Field within an Attribute can also contain a Sequence, which is the way that an element in the top level information entity hierarchy is stored. A Study, Series, and Instance is stored as a Sequence in memory. A Sequence is defined as a list of Items and each Item contains a Dataset allowing the entire data structure to be recursive. The Dataset structure and relationships are shown in figure 2.
{{:courses:446:2014:446-2014-13:fig1.png|Figure 1}}
Figure 1: Structure of a DICOM Attribute
{{:courses:446:2014:446-2014-13:fig2.png|Figure 2}}
Figure 2: Data structure of DICOM Data
======Problem======
While software for viewing DICOM studies exists, the reading and writing of binary DICOM data can be improved.
**Create a Zero-Footprint Web Application**
Dart, Google’s new, class-based, single-inheritance, object-oriented programming language designed explicitly for creating web applications is proposed to handle this task. One goal is to demonstrate the viability of retrieving and displaying binary DICOM in a web application. Using the nested structure shown in Figure 2, the client will display DICOM data in a nested tree-table format, allowing the user to expand and collapse the information levels.
A zero-footprint web client offers many advantages over traditional software applications. It allows the application to stream data and prevents the need for sensitive, HIPAA covered patient data to be stored on the end point device. It also allows the web application to be maintained and upgraded without the need for access control on the end point device, lowering management costs. There is also an opportunity for improved security since the data can be encrypted before transmission.
**Decrease Development Overhead**
One of the goals for the open-source DICOM web viewer was to decrease the amount of time and effort required for developers to contribute to and continue the project. The Dart programming language is a fast and intuitive tool to create and maintain the web application. Dart is similar to many object-oriented programming languages, such as Java, C++, and C#. In contrast to JavaScript, the primary language used to create web applications, Dart is easy to learn and use because it is class-based and has good library and package management functionality. Like JavaScript, it is dynamically typed and functions and their closures are first class.
**Increase Parsing Speed**
Increased speed of DICOM data management is significant for users such as large hospitals, which process hundreds of images daily, and regional Health Information Exchanges, that manage millions of images. As the use of medical imaging studies increases, it becomes more important to access and manipulate this data faster. Dart has an advantage over JavaScript in that it performs better on several major benchmarks.2 Native Dart is currently only supported in Google based browsers, but is also able to compile to JavaScript to run in other web browsers. Even when compiled to JavaScript through the dart2js compiler, Dart still maintains a large speed advantage over native JavaScript. The goal was to be able to parse all of the DICOM test files in under 3 seconds.
======Deliverables======
* **Expected:** (April 28) Complete
- Display a work list of studies of n patients
- Display patient as collapse/expand tree for study information model
- Develop a stand-alone collapsible tree-table Polymer UI Element
- Clean code and finish API
- Create a user domain
-
* **Maximum:** Future Work
- Edit metadata
- Display images
- Encrypt and decrypt studies using AES (GCM) using an encryption framework created at Hopkins Security Institute.
* **Minimum:** (April 5) Complete
- Read and display DICOM in a browser and then write it
- Build a test program that compares input and output to validate correctness
- Create unit tests for each class (final version is put on hold until close to project completion.)
======Technical Approach======
Our first step is to learn the DICOM standard to understand how
medical imaging data is stored. From this knowledge, we will design a data
structure for DICOM studies. After creating a project plan which includes
packages and classes for our viewer and editor, we will use Dart syntax to
translate our plan into code while simultaneously unit testing each class.
Once we have functional code, we will work to iteratively optimize it to
achieve our goal speed.
The flowchart below is a visualization of the information pipeline that
our program implements:
{{:courses:446:2014:446-2014-13:flowchart.png?200|}}
======Dependencies======
* Access to our mentor – Our mentor has agreed to weekly meetings on Wednesdays at 9:30 a. m. and is open to setting up additional meetings when needed.
* Computer to write code – Both team members have computers to write code on. If our computers face any unforeseen disasters, we have access to computers on campus.
* Bitbucket to share code – As of February 13, 2014, we have access to the Bitbucket repository for this project.
* Dart & DICOM Reference Information – Our mentor has provided us with the DICOM documents that we need. Dart reference information can easily be accessed online.
* Access to DICOM Test Data – Our mentor has provided us with five anonymous test studies, with access to more if the need arises.
======Milestones and Status======
- Have project proposal finished and all of the programming planned and reviewed by Dr. Philbin
*Planned: February 20
*Status: ✔
- Read input (parse)
*Planned: March 6
*Status: ✔
- Write and validate output
*Planned: March 20
*Status: ✔
- HTML5/CSS3 display metadata
*Planned: April 3
*Status: ✔
- Display/Edit images
*Planned: May 1
*Status: Further work
- Final Poster Presentation
*Planned: May 9
*Status:✔
{{:courses:446:2014:446-2014-13:timeline.png|}}
======Reports and presentations======
* Project Plan
* {{:courses:446:2014:446-2014-13:project_plan_tinio_shah.pdf| Project plan proposal}}
* {{:courses:446:2014:446-2014-13:project_proposal.pdf| Project plan presentation}}
* Project Background Reading
* See Bibliography below for links.
* Project Checkpoint
* {{:courses:446:2014:446-2014-13:checkpoint_presentation.pdf| Project checkpoint presentation}}
* Paper Seminar Presentations
* {{:courses:446:2014:446-2014-13:damish_seminar_presentation.pdf| Damish Summary}}
* {{:courses:446:2014:446-2014-13:damish_shah_seminar_presentation.pdf|Damish Presentation}}
* {{:courses:446:2014:446-2014-13:140.pdf|Damish Paper}}
* {{:courses:446:2014:446-2014-13:tinio_paperpresentation.pdf| Danielle Summary}}
* {{:courses:446:2014:446-2014-13:danielle_paperpresentation.pptx|Danielle Paper Presentation}}
* {{:courses:446:2014:446-2014-13:903905_1_.pdf|Danielle Paper}}
* Project Final Presentation
*{{:courses:446:2014:446-2014-13:poster_teaser_13.pptx|Final Poster Teaser}}
* {{:courses:446:2014:446-2014-13:project13poster_horizontal_final2.ppt|Final Poster Presentation}}
* Project Final Report
*{{:courses:446:2014:446-2014-13:final_project_paper_13.pdf|Project 13 Final Report}}
*{{:courses:446:2014:446-2014-13:dcmid_api.xlsx|DCMiD API}}
*{{:courses:446:2014:446-2014-13:dicom-in-dart-dcmid.rar|Source Code RAR}}
======Project Bibliography=======
* [[http://medical.nema.org/Dicom/2011/11_05pu.pdf|Part 5 of DICOM by the National Electrical Manufacturers Association]]
* [[https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/home | Dart documentation]]
* MINT Toolkit source code and documentation (provided by Dr. Philbin)
* {{:courses:446:2014:446-2014-13:multi-series_dicom.pdf|Mahmoud Ismail and James Philbin, Multi-series DICOM: an Extension of DICOM That Stores a Whole Study in a Single Object. Journal of Digital Imaging, August 2013; 26(4):691-697}}
* James Philbin, Tim Culp, Tim Dawson, Jonathan Whitby. RESTful Web Services in DICOM. The DICOM 2013 International Conference, Bangalore, India. March 2013.
* James Philbin, Mahmoud Ismail. Fast, Storage Efficient De-identification of Medical Studies. The DICOM 2013 International Conference, Bangalore, India. March 2013.
* Mahmoud Ismail, Yu Ning, James Philbin. Transmission of DICOM Studies using Multi-Series DICOM Objects. Proceedings SPIE 8674, Medical Imaging 2013: Advanced PACS-based Imaging Informatics and Therapeutic Applications. April 8, 2013.
* Mahmoud Ismail, Yu Ning, and James Philbin, Separation of metadata and pixel data to speed DICOM tag morphing. SPIE Medical Imaging 2014: PACS and Imaging Informatics: Next Generation and Innovations, Forthcoming.
======Other Resources and Project Files======
Project code: [[https://bitbucket.org/ohtmiami/dicom-in-dart-dcmid]]
You can read more about DICOM [[http://dicom.nema.org/|here]].
You can learn more about Google's Dart programming language [[https://www.dartlang.org|here]].
You can learn about the Polymer Project [[http://www.polymer-project.org/|here]].
======Log======
**2.5.2014**
* First Meeting with Dr. Philbin
* Received DCMiD Project Plan
* Review initial list of classes and packages
**2.12.2014**
* Meeting with Dr. Philbin
* Went over presentation
**2.17.2014**
* Received access to Bitbucket repository
* Damish was able to access the code
* Danielle was unable to access the code
**2.18.2014**
* Max 5 people per private repository
* Danielle now able to access code
**2.19.2014**
* Meeting with Dr. Philbin
* Received Reading list of papers (listed under "Project Bibliography" below)
**2.23.2014**
* Idea for byte storage
* The IO documentation specifies a readAsBytes method for File objects that returns a Future> (which means that the data is stored when it becomes available as a list of ints).
* The Uint8List class is meant to replace the List class for unsigned 8-bit ints, which the documentation claims is more space- and time- efficient for long lists.
* implement the static typing when we read the input files
* [[https://api.dartlang.org/apidocs/channels/stable/#dart-typed_data.Uint8List|Uint8List Documentation]]
**2.26.2014**
* Meeting with Dr. Philbin
* Read metadata without parsing value fields and print dataset
* all attributes have an even length - if length is odd, padding byte at end. length -1 : look for item delimiter
* Figure out efficient string UTF8 to string conversion
* Writing and testing parsers for value fields
**3.2.2014**
* Not completely sure how to use makeValueArray list in the VR class in base.dart.
* How exactly should we create a VR object?
* Tried: VR vr_object = VR.valueOf( bdv.getInt16( offset += 2, Endianness.LITTLE_ENDIAN ) ); but does not work
* will getInt16 method give the int code that we're looking for to create a VR?
* How to get code in valueOf method?
**3.2.2014**
* Dr. Philbin uploaded modified version of dataset.dart showing his intended structure
**3.5.2014**
* Plan presentation.
**3.5.2014**
* Meeting with Dr. Philbin
**3.10.2014**
* Created new branch for Damish and Danielle
* fixed readStringList method in bytebuf.dart
* Wrote Parsers:
* readAETitleList
* readCodeStringList
* readText
* readDateTimeList
* readIntegerStringList
* readDecimalStringList
* readPersonName (PersonName.parse not working)
* readPersonNameList (PersonName.parse not working)
* readUriList
* readAgeString
* TODO: write parsers
* readUidList
* readBulkdataReference
* readFloat32List
* readFloat64List)
**3.10.2014**
* VR = 2 bytes (chars or vrCodes)
* UUID = 16 bytes (Wikipedia)
* Offset = 4 bytes (int32)
* Length = 4 bytes(int32)
**3.13.2014**
* Meeting with Dr. Philbin
* Updated most recent version of unit test code.
* "Closure" errors occur when there's no closure, ()
**3.27.2014**
* Dr. Philbin rearranged code in master branch
* source files (*.dart) in ../lib should be in ../lib/src
* library file ‘data_types.dart’ stays in ../lib
* added ../tools directory
* refer to: [[https://www.dartlang.org/tools/pub/package-layout.html]]
**3.28.2014**
* Meeting with Dr. Philbin
**4.2.2014**
* Meeting with Dr. Philbin
* TODO: Try Uint16 without the endianness argument
**4.3.2014**
* Check Point presentation
**4.10.2014**
**4.14.2014**
* Meeting with Dr. Philbin
* Testing on new sets of data
**4.15.2014**
* Danielle paper presentation
**4.17.2014**
* Received MINT 2.0 study metadata format
* potentially useful: [[https://github.com/szgabsz91]]
**4.21.2014**
* Meeting with Dr. Philbin
* Issues with UI
* wanted to use tree table of html_components [[https://github.com/szgabsz91/html-components]] , but author hasn't updated it
* Possibly use CSS treeview [[http://experiments.wemakesites.net/css3-treeview.html]]
**4.22.2014**
* Damish paper presentation
*
**4.23.2014**
* Developing client-server application: [[https://plus.google.com/+OndartMe/posts/5wKpFdAdYTu]]
* Possible framework: [[https://plus.google.com/+DanielRobinson_0xor1/posts/bUCDVshNjJD?cfem=1]]
**4.28.2014**
* Meeting with Dr. Philbin
* example table code excel example layout for user interface
**5.1.2014**
* Meeting with Dr. Philbin
* Work on poster teaser and poster
* Finish the API
* Debug all of the parsers
* Clean up the user interface
**5.5.2014**
* Meeting with Dr. Philbin
* Finish Poster and send to be printed
======Lab Safety Certificates======
{{:courses:446:2014:446-2014-13:dshah15_labcertificate.pdf|}}