Click here to Skip to main content
15,508,376 members
Articles / Product Showcase
Posted 1 Mar 2012


5 bookmarked

Accessing Medical Records on iOS Devices, Part 2

1 Mar 2012CPOL7 min read
New iOS mobile devices create an opportunity for doctors and medical professionals to access patient data from anywhere. This whitepaper focuses on the AIMTools SDK, Barcode Xpress Mobile SDK and how they can be enabled to access medical records.

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

Mobile devices have made instant access to medical records by medical professionals a reality. This two-part series, “Accessing Medical Records on Mobile Devices” began with a review of how medical records may be accessed with Android™ devices. The final part of the series concludes with how to utilize an iOS™ (Apple®) mobile device to access medical records.

Medical professionals can use a mobile phone or a tablet device to access patient data. Accusoft, a leader in Windows SDKs, has moved into the mobile space with exciting new offerings that give medical professionals mobile access to a wide array of medical data. This whitepaper will focus on two recent software development toolkit releases and how they can be used to enable access to medical records on iOS devices: AIMTools™ and Barcode Xpress Mobile™.

Use Case: Patient Medical Records

The use of barcoded bracelets for patients is now commonplace, and for obvious reasons: it provides positive identification, even if a patient is unable to do so themselves. This enhances patient safety and greatly reduces the chance of a medical error arising from dosing (or worse, operating on) the wrong patient. The New England Journal of Medicine recently documented a study in an article titled, “Effect of Bar-Code Technology on the Safety of Medication Administration”. The results of the study confirmed the use of barcode technology for dosing and administering patient medications led to a significant reduction in errors.

Many facilities encode patient bracelets with 1D barcodes, such as Code 128. Code 128 is an alphanumeric symbology, which is well suited for encoding information like a patient ID or name. It can also be read easily and accurately by commonly available laser scanners.

Ease of Use

Barcode Xpress Mobile™ for iOS provides a clean, flexible and easy to use way to create a mobile application for scanning barcodes. It has an interface tailored specifically to iOS that uses Accusoft’s very fast and accurate barcode recognition library. Creating a barcode recognition application has never been easier. The source code supplied with the SDK can be used as an example, or customized and used as the basis of your own application. It does all of the work to gather and process images, leaving you free to concentrate on using the values decoded from the barcodes. Here’s a snippet of code that shows just how easy it is to start using Barcode Xpress Mobile for iOS through its public interface, named BXInterface:

// Create and initialize a BXLicense.
BXLicense* license = [[BXLicense alloc] initWithData:@"Your OEM Key Here"
                                        solutionName:@"Your Solution Name Here"
                                                key1:0 key2:0 key3:0 key4:0 ];

// Initialize the interface to the decoding library.
barcodeXpress = [[BXInterface alloc] initWithLicense:license];
[license release];

// Define the callbacks that allow program control to be altered at key points.
[barcodeXpress SetCameraCallback :self :@selector(onCameraUpdate:)];
[barcodeXpress SetRecognitionCallback :self :@selector(onBarcodeRecognition:)];
[barcodeXpress SetProcessingCallback :self :@selector(onProcessingBarcode:)];

// Create a layer that will display preview imagery from the camera.
AVCaptureVideoPreviewLayer *previewLayer = [[AVCaptureVideoPreviewLayer alloc] init];

// Configure the camera and start processing video frames.
[barcodeXpress StartRecognition :previewLayer];

At this point, the program is up and running in an event-driven manner. BXInterface takes care of configuring the camera to use the optimum resolution it can provide. It uses the appropriate number of processing threads for the number of available CPU cores. It samples the video camera frame buffer and asynchronously sends those images to Barcode Xpress for recognition. When a barcode is recognized, BXInterface notifies the user interface through the onBarcodeRecognition callback. You customize the callback to use the decoded barcode value.

Medical Bracelets using 1D Barcodes

Here is a 1D Barcode on a bracelet containing just a patient ID, encoded using the Code 128 symbology. We’ll show how Barcode Xpress Mobile for iOS can be used to create an identification application.

Here’s the bracelet on a patient’s arm:

Image 1

And here’s Barcode Xpress Mobile for iOS, reading the barcode and displaying the patient ID:

Image 2

Using the Decoded Data

We’ve previously shown how to begin gathering and decoding images with the camera on an iOS device. Once the barcode has been decoded, the data (“A32581239”) is available for use in the onBarcodeRecognition callback method. For example, suppose this patient ID is an index to a patient record that contains images on the hospital’s server. We can retrieve these images using the index from the barcode that was read by Barcode Xpress for iOS. Once retrieved, the images can be displayed on the mobile device.

Let’s see how we can use this callback to retrieve a file. In a real world implementation, due to security considerations and HIPPA requirements, HTTP would not be sufficient. This code fragment is intended to demonstrate the concept of using a barcode value, and should not be used in an implementation. Security is left as a separate exercise for the reader.

 * Callback that performs actions with the results of barcode detection.
 * This method is called when a barcode is detected by the recognition
 * library, or when the detection method reports an error.
 * @param data NSDictionary with two keys:
 * - "image" is a UIImage that contains the image upon which 
 *         decoding was performed.
 * - "results" is a BXResult that contains decoding results and 
 *         status information.  See BXResult.
- (void)onBarcodeRecognition :(NSDictionary*)data {
    // Get the decoding results.
    BXResult *bxr = [data objectForKey:@"result"];
    // Craft the URL using the decoded value.
    NSString *stringURL = [NSString stringWithFormat:@"",
    NSURL *url = [NSURL URLWithString:stringURL];
    // Get the image from the server, using the URL.
    NSData *patientImage = [NSData dataWithContentsOfURL:url];
    if (patientImage) {
        // Build a path to save the image to.
        NSString *imagePath = 
           stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.jpg",
        // Store the image.
        [patientImage writeToFile:imagePath atomically:YES];

Viewing Medical Images on iOS

Now that your application has obtained the patient’s ID using the barcode, and retrieved images associated with that ID, you need a way to view and manipulate the images. Many of the lossless image formats used in medical imaging, including 8 through 16-bit grayscale JPEG 2000 and Lossless JPEG, are not supported natively by the iOS operating system. In order to interactively view and work with these images, they would need to be converted to a lossy supported format like JPEG.

That is, until now.

The Accusoft AIMTools SDK allows developers to write apps that work with the original image data without the need for conversion or round trips to a server. This means that a native iOS app can interact with all of the original image data, while de-compressing and converting the parts of the image important to the user of the application. Window leveling, zooming and other common operations can be performed locally with no need for a call back to the server for more image conversion. This significantly increases the app’s responsiveness and dramatically improves the user’s experience.

A trial version of the AIMTools for iOS SDK can be downloaded from the Accusoft website for free. The SDK contains an ImageViewer sample that illustrates how to build a full-featured image viewer using the SDK, complete with thumbnail generation, cropping, zooming and window leveling. Developers are encouraged to use the ImageViewer Xcode project to evaluate the AIMTools kit using their own images. The sample code can then be used as a starting point for Development.

Image 3 Image 4

Figure 1 – Screen Shots of the AIMTools for iOS ImageViewer Sample

The sample code provided in the ImageViewer sample serves as a higher level of abstraction to the AIMTools C API. AIMTools provides very granular image manipulation capabilities when needed, but the ImageViewer sample attempts to hide this granularity at first and focus on the most common imaging operations. The FileDetailViewController class performs decompression of the image on a background thread by calling the executeExpand() method. The executeExpand() method calls into the AIMTools C API using the source C files included in the demo sample code. These C source files available in the sample can also be used as-is in any new development project to hide the C implementation details from the Developer, allowing them to concentrate on Objective-C and application design.


Access to patient records and the viewing of medical images are key components of a complete mobile EMR/EHR solution. However, the iOS environment does not natively support viewing of JPEG 2000 and Lossless JPEG images. Mobile SDKs from Accusoft help you overcome this limitation and build the applications your clients need in the medical space to maximize productivity.

If you haven’t done so already, please be sure to look back at our coverage of barcode decoding and medical image viewing on Android.

You can find Accusoft product downloads and features at Explore our barcode web demo at to test our barcode recognition accuracy or download a trial version of our mobile barcode SDK, Barcode Xpress Mobile, at The AIMTools demo video and SDK download are available at Please contact for more information.

About the Authors

Rob Rimbold is a Senior Software Engineer with Accusoft. He has over 20 years of multi-discipline software development experience. Rob graduated with a Bachelor of Science in Computer Science from The University of Lowell in Massachusetts.

Scott Wilson is a Project Manager with Accusoft. He has had over 20 years of software development and management experience. Scott graduated with a Bachelor of Science in Computer Science from McMaster University in Hamilton, Canada.

Steve Wilson is a Product Group Director with Accusoft. Steve is responsible for leading his team to develop new products as well as increase the feature sets within several Accusoft product lines. He brings a strong technical background to the management team, as well as experience managing diverse offshore and onshore development teams. Steve graduated with a Bachelor of Science in Computer Science from the University of South Florida.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
United States United States
Accusoft provides a full spectrum of document, content, and imaging solutions as fully supported, enterprise-grade, client-server applications, mobile apps, cloud services, and software development kits. The company is focused on solving document lifecycle complexities through:

- A customer-focused approach
- Continuous product development
- Proactive support
- Forward-thinking leadership

Founded in 1991, Accusoft has grown through persistent product innovation and strategic mergers and acquisitions into the best-in-class solutions provider it is today. The company has been awarded 30 patents and is recognized as a thought leader in the industry.
This is a Organisation

1 members

Comments and Discussions

-- There are no messages in this forum --