Skip to main content

Store server application for dicom images

Store Server Program Using C++ and DICOM Network Protocol

A storage server program is able to receive dicom images from a source AE such as console, store them on secure user account, which matches the key attribute of the image. Create scan sheet of the images that have been received, parse out important header information, and store that header information in a database.


 It starts automatically at boot-in and running on port 104 in the background. If you don’t want the server running on port 104, edit store_server and run it on a new terminal window.
./store_server (no arguments)

To change port number you have to edit the port number as shown below.  
store_server (Port number, './Temp', './handlerdb', 'store_server_config.cfg', 1);


After an images are received from a source AE, the store program will run another script (handlerdb). This script will be responsible for moving the images into the user account with a specific organization of the folder hierarchy, and store that header information into a database.

1. Waits for a source AE such as console to connect and initiate a DICOM association.
2. Receives the images from the console.
3. Moves the images to the user account.
4. Renames and sorts the images by file naming convention.
5. Generates a scan sheet for each study and saved under the user account
6. Writes the action to the log file and store it in /raid6/Dicom_code director


The image is saved under the requesting physician account if there is no account under requesting physician name, then it will saved into referral physician account, if the referral physician doesn't have an account too, than will saved under Guest account by requesting physician.

When there is no information in the image tags about requesting physician or referral physician fields, the image will be saved into Unknown account

In each account, has a Dicom folder in which the dicom files are stored in each Study folder and series folder with a .dcm file name convention 3-3-6 dgitis as shown below:

Study Folder/ Dicom/[series number_series name] Folder / [series number-echo number-Count].dcm 

A diagram of typical folders and how they are organized is shown here 


The server class program is made up three classes that handle tags, conversions, and network.

Class tag

·      load_tags(): Loads all of the tags from a DICOM file into an array.
·      get_tag(): Returns the value of the group and element you specify.
·      write_tags(): Writes the tags contained in an array you specify to a DICOM file.

Class convert

·      dcm_to_jpg(): DICOM to JPG. Converts a DICOM file into a JPEG
·      dcm_to_tn(): DICOM to JPG thumbnail. Converts a DICOM file into a JPEG thumb nail.
·      jpg_to_dcm(): JPG to DICOM. Takes the demographic info in an array you specify and a JPEG file, produces a DICOM file.

Class net

·      storage(): Starts a DICOM receiver.
·      echo(): Sends a DICOM ping. 
·      sender(): Sends a DICOM file to the AE host. 


Popular posts from this blog

Analyzing Net Promoter Score using Machine Learning

Overview This article presents a reference implementation of a Net Promoter score analysis project that is built by using Machine Learning. In this article, we will discuss associated generic models for holistically solving the problem of industrial Net Promoter score. We also measure the accuracy of models that are built by using Machine Learning and assess directions for further development. Net Promoter Score The Net Promoter Score is an index ranging from 0 to 10 that measures the customer’s loyalty to the brand. Calculation Customers are surveyed on one single question.  “On a scale of 0 to 10, how likely are you to recommend this company’s product or service to a friend or a colleague?” Based on their rating, customers are then classified into 3 categories: detractors, passives, and promoters. continue.......

SQL Table-Valued Function to Find the Best Trend Line Using Linear Regression

Linear regression is probably one of the first regression techniques we run across. It is useful for explaining (and perhaps forecasting) data that has a linear nature, but where the underlying process is unknown.  Linear regression line between New Patient Data and  Marketing Expenses   This solution focuses on the practical aspects of finding the best trend line for a financial time series using SQL function. If you have a large dataset with multiple sets of x and y data points associated with some attribute, you can do a linear regression on each set with one query using GroupID. The great strength of the linear regression line is that it can clarify sometimes ambiguous line charts and quantify the results via the slope of the line.

Building a ML classifier on dentistry payment plans data using C#

I prefer the Naive Bayes approach, because while having small set of data, it seems to make better decisions than I did in many cases. Also, the other type of classifier seems to do better on clear-cut cases, but doesn't seem to handle uncertainty so well. In addition,   the naive Bayes classifier corresponds to a linear classifier in a particular feature space.                                                   Main Program Text Pre-processing Class   Naive Bayes Class