Digital Imaging

Last update: February 12, 2017

Digital imaging is the creation of digital images, such as of a physical scene, and includes the processing, compression, storage, printing, and display of such images. The information is converted by image sensors into digital signals that are processed by a computer. If the medium which conveys the information that constitutes the image is visible light, it’s called digital photography.

Photosensor Array

A digital camera or a scanner uses an array of photosensors (photosites) to record and store photons. Once the exposure finishes, the relative quantity of photons in each photosite is then sorted into various intensity levels, whose precision is determined by bit depth (0 – 255 for an 8-bit image).

One photosensor per image pixel would only create grayscale pictures. To capture color images, distinct photosensors are necessary for each of the three primary colors (RGB). To separate the colors, a filter array is placed over each photosensor. The most common type of color filter array is called a Bayer Array, as shown in the figure below.

credit

image credit : www.cambridgeincolour.com

A Bayer Array consists of alternating rows of red-green and green-blue filters. Because the human eye is more sensitive to green light than both red and blue light, the Bayer Array contains twice as many green as red or blue sensors to approximate the human vision.

Dynamic Range

When speaking about dynamic range, we need to distinguish between recordable or displayable dynamic range. Let’s start with the first one.

The Dynamic Range in digital imaging describes the ratio between the maximum (white) and minimum (black) measurable light intensities. The black level (few photons) is limited by noise. The white level (large number of photons) is limited by overflow (saturation). If an ideal photosensor identifies one photon for black and hosts a maximum of 1.000 photons (white), the dynamic range would be 1.000:1. The most commonly used unit for measuring dynamic ranges in digital photography is the f-number (f-stop) which describes the total light range by powers of 2. A dynamic range of 1.000:1 is therefore equivalent to 10 f-stops (2 exp 10 = 1.024). In scanners the dynamic range is described in terms of density (D). Density is measured using powers of 10. A dynamic range of 1.000:1 is represented by a density of 3 (10 exp 3 = 1.000). As a scanner has full control over it’s light source, such a device can ensure that minimal photosensor overflow occurs.

The approximated dynamic range in f-stops for several devices is indicated below :

recordable displayable
  • human eye : 24
  • scanner : 8 – 12
  • digital camera : 5 – 9
  • monitor display : 6 – 11
  • printed media : 2 – 7

ISO sensitivity

How much light is needed to saturate a medium is determined by it’s sensitivity. That was as true for glass plates as it was for film and now for digital photosensors. The sensitivity (film speed) is expressed in ISO. The normal range of ISO is about 200 to 1.600, but can sometimes go as low as 50 or as high as 204.800.

Image Bit Depth

Bit depth quantifies how many values are available to specify each image pixel. Even if a digital imaging system can capture a vast dynamic range, the light measurements must be translated into discrete numerical values with an analog to digital (A/D) converter. With 8 bits per color channel, the dynamic range cannot exceed 8 f-stops (density of 2.4) if the numerical values are linearly interspaced. With 16 bits per color channel, the theoretical value for the dynamic range in an ideal linear system would be 16 f-stops (densitiy 4.8). In practice the dynamic range of a linear system is much lower, even with 16 bits (typically about 12 f-stops). If we use however an nonlinear system to interspace and save the discrete numerical values, we could even conceive to record an infinite dynamic (posterized) range with an image depth of a few bits.

RAW image

At the end of the A/D conversion, we have a raw digital image, with W x H pixels, specified with consecutive discrete numerical values, each value coded with N bits per color channel. Each camera manufacturer and each scanner software developer uses a proprietary format for a raw digital image. A common format called Digital Negative (DNG) has been defined by Adobe in 2004.

Image Histograms

Image histograms are great tools to evaluate the correct exposure of a captured digital image.

Each pixel in the raw image is specified by the primary colors red, green and blue (RGB). Each of these colors can have a brightness value ranging from 0 to X ( X = 2 exp N ). A histogram results when the computer scans through each of the brightness values and counts how many are at each level from 0 through X. Low brightness values are called shadows, high values are the highlights, in-between are the midtones.

histogram

Histogram

A well balanced histogram where no shadows or highlights are clipped is shown at left. The region where most of the brightness values are present is called the tonal range. When highlights are heaped at the right edge in the histogram, they are clipped (blown). Some regions in the image have been overexposed and the corresponding details can never been recovered.

When shadows are heaped at the left edge in the histogram, some regions of the image have been underexposed and the relevant dark details are also lost. The histogram of a raw digital image should not present high values at the left (shadows) and right (highlights) edges of the chart. If clipping occurs you see a tall vertical line at the far left or right side of the histogram.

Usually an image is underexposed if no channel of the histogram goes all the way to the right. Images that are too dark are easy to correct later in this case; just drag the right slider in Photoshop’s Levels command to the left to meet the edge of the histogram.

The distribution of peaks in a histogram depends on the tonal range of the subject. Images where most of the tones occur in the shadows are called low key, whereas in high key images most of the tones are in the highlights. The histogram describes also the contrast which is the measure of the difference in brightness between dark and light areas in an image. Broad histograms reflect a significant contrast, narrow histograms present low contrast resulting in flat (dull) images.

All histograms are normalized and are intentionally scaled so that the top of the tallest peak always reach full height. Scale is relative, shown percentage-wise.

There exist three types of image histograms :

  • Color Histograms
  • RGB Histograms
  • Luminosity (Luminance) Histograms

Each histogram type has it’s own use and it’s own shortcomings. All three should be used as a collective tool. The following figures show the different histograms relative to a scanned Kodachrome slide of a landscape.

Landscape

Scanned Kodachrome slide of a landscape

Photoshop histogram windows

Landscape photo histogram windows RGB, R, G, B, Luminosity and Colors in Photoshop

Color Histograms

A color histogram describes the brightness distribution for any of the three primary color channels R, G, B. This is helpful to assess whether or not individual colors have been clipped.

Sometimes color histograms are presented as color overlays (colors histogram).

RGB Histograms

An RGB histogram produces three independent histograms for each color channel and then adds them together, irrespective of whether the color came from the same pixel. This way RGB histograms discard the location of each pixel.

Luminosity (Luminance) Histograms

The terms luminosity and luminance are often used interchangeably, even though each describes a different aspect of light intensity. Technically the term luminosity is correct and I will use it in the following, even if luminance is more common. The luminosity histogram takes into account that our eyes are most sensitive to green; we see green as being brighter than we see blue or red. Luminosity weighs the effect of this to indicate the actual perceived brightness of the image pixels based on the NTSC television formula

Luminosity = Red x 0.3 + Green x 0.59 + Blue x 0.11

Color Models

Until now we have used the terms primary colors (RGB), color channels, color and colors histograms, luminosity, luminance, light intensity, brightness, but we never really dealt with colors.

The search for a comprehension of exactly what color is and how it functions has been going on for hundreds of years. Artists and philosophers have theorized that color is three-dimensional. Contemporary neuroscientists have confirmed this theory, finding that our sensation of color comes from nerve cells that send messages to the brain about:

  • The brightness of color
  • Greenness versus redness
  • Blueness versus yellowness

Numerous models and systems have been developed :

There are several ways to associate the converted discrete numerical values of the primary color channels R, G, B to colors. We can rely on the physics of light waves (visible spectrum), on the characteristics of inks, dyes, paints or pigments, on the human eye or visual perception. In all cases we need a color model as reference to process (adjust)  the discrete numerical values.

Wikipedia defines colors and color models as follows :
Color (American English) or colour (Commonwealth English) is the visual perceptual property corresponding in humans to the categories called red, blue, yellow, etc.”
A color model is an abstract mathematical model describing the way colors can be represented as tuples of numbers, typically as three or four values or color components.”

The ICC defines colors as :
Color is the sensation produced in response to selective absorption of wavelengths from visible light. It possesses the attributes of Brightness, Colorfulness and Hue. White, grey and black are achromatic colors.

My personal definition of color in digital imaging is the following :
Color is the tone displayed when the numerical values of the three color channels are not all the same. This implies that black, white and all grey tones are not colors.”

This personal definition is consistent with all what has been said up to now in this post. With an image bit depth of 8 bits, 256 x 256 x 256 = 16.777.216 different colors and grey tones can be specified (in theory).

The color models used today are the following :

  • RGB (ca 1860) : Additive Color Model ( Red + Green + Blue = white)
  • CMYK (ca 1906) : Subtractive Color Model (Cyan + Magenta + Yellow = brown; + K = Black)
  • LAB (1948) : developed by Richard S. Hunter
  • NCS (1964) : Natural Color System
  • HSV (1978) : Hue, Saturation and Value (Alvy Ray Smith)
  • HSL (1978) : Hue, Saturation, and Lightness (Alvy Ray Smith)
  • HWB (1996) : Hue, Whiteness, Blackness (Alvy Ray Smith)
Main color models : RGB, CMYK, Lab

Main color models : RGB, CMYK, Lab

The most common color model is RGB. The following figure shows the RGB cube with the 3D representation of all possible (in theory) colors and grey-tones, including black (R = G = B = 0) in the back lower corner and white (R = G = B = max) in the front upper corner.

RGB cubes

RGB cube

RGBA is a RGB color model with and additional alpha (opacity) channel. There is an open ended set of RGB spaces; anyone can invent one by picking new primaries and a gamma value. Some color spaces are commercial ones and copyrighted, some are defined for special purposes and some are obsolete.

Typically used in color printing, CMYK assumes that the background is white, and thus subtracts the assumed brightness of the white background from four colors: cyan, magenta, yellow, and black. Black is used because the combination of the three primary colors (CMY) doesn’t produce a fully saturated black. You should however be aware that some desktop printers have only an RGB interface. Some printers use special premixed inks called Spot Colors.

The Natural Color System (NCS) is a proprietary perceptual color model based on the color opponency hypothesis of color vision, first proposed by Ewald Hering. The current version of the NCS was developed by the Swedish Colour Centre Foundation.

HSV and HSL have been developed in 1978 by Alvy Ray Smith, a pioneer in computer graphics and cofounder of the animation studio Pixar. They are used today in color pickers. The two representations rearrange the geometry of RGB in an attempt to be more intuitive and perceptually relevant than the cartesian (cube) representation. The colors are represented in a cylindrical coordinate system. Twenty years later Alvy Ray Smith created HWB to address some of the issues with HSV and HSL. HWB came to prominence in 2014 following its use in the CSS Level 4 Color Module.

In contrast to color models which define a coordinate space to describe colors, the Color Apperance Model (CAM) is a mathematical model that seeks to describe the perceptual aspects of human color vision.

Color Spaces

A color space is a specific implementation of a color model. The physical colors represented in the coordinate space (cube, cylinder) of a color model are not all visible by humans. For this reason the International Commission on Illumination (CIE) defined in 1931 quantitative links between physical pure colors (wavelengths) in the electromagnetic visible spectrum and physiological perceived colors in human color vision. These links are represented as 3D regions (3D solids) containing all producible colors, called the CIE 1931 color space. The CIE 1931 color space standard defines both the CIE 1931 RGB space, which is an RGB color space with monochromatic primaries, and the CIE 1931 XYZ color space, which works like an RGB color space except that it has non-physical primaries that cannot be said to be red, green, and blue. The CIE standards are based on a function called the standard (colorimetric) observer, to represent an average human’s chromatic response.

3D Color Space

Color Space : different vues of the 3D solid representing visible colors

Visualizing color spaces in 3D is not very easy and intuitive. For this reason color spaces are usually represented using 2D slices from their full 3D shape. Unless specified otherwise, a 2D chromacity diagram shows the cross-section containing all colors which are at 50% luminosity (luminance). The next figure shows the CIE 1931 XYZ color space in two dimensions.

CIE 1931 XYZ color space

CIE 1931 XYZ color space at 50% luminosity (mid-tones)

The CIE defined additional standards for color spaces for special purposes like TV, video, computer graphics. A list is shown below :

CIE color spaces : XYZ, Lab, Luv

CIE color spaces : CIEXYZ, CIELAB, CIELUV

Gamuts

It’s good to know that the CIE XYZ color space encompasses all color sensations that an average person can experience, but it’s more important to know the subsets of colors that a given digital device can handle and reproduce. Such a portion of the CIE XYZ color space is called a device color space or gamut. The term gamut was adopted from the field of music, where it means the set of pitches of which musical melodies are composed. The following figure shows typical gamuts for some digital devices.

Typical gamuts of digital devices

Typical gamuts of digital devices with 50% luminosity

Keep in mind that this representation only shows mid-tones with 50% luminosity. When colors are dark or light, we perceive less variation in their vividness. We see the maximum range of color saturation for middle-toned colors. This is why the 2D slices of color models are usually represented with 50% luminosity. If we are interested in the color gamuts for the shadows or highlights, we could look instead at a 2D slice of the color space at about 25% and 75% luminosity.

The following figure shows the gamuts of real devices, the iPad 2 and iPad 3.

Gamuts of iPad 2 and iPad 3

Gamuts of iPad 2 and iPad 3

Color Transformation

Color transformation (color space conversion) is the translation of the representation of a color from a source color space to a target (destination) color space.

Out of

Out of

A typical use case is to print on an inkjet printer in the CMYK space a photo captured with a camera in the RGB color space. The printer gamut is different than the camera gamut, certain camera colors cannot be reproduced with the printer. Those colors are said to be out of gamut.

During the color transformation process, the RGB colors out of gamut must be converted to values within the CMYK gamut. This conversion is called gamut mapping. There are several reasonable strategies for performing gamut mapping, these are called rendering intents. Four particular strategies were defined by the International Color Consortium (ICC), with the following names:

  • Absolute Colormetric
  • Relative Colormetric
  • Perceptual
  • Saturation

If a complete gamut mapping is not possible, a gamut mismatch results and the best approximation is aimed. An interactive Flash demo explaining color gamut mapping is available at the website of the Stanford University.

In digital image edition programs (for example Adobe Photoshop), device independent color spaces, called working spaces, are used as a reference for the device-dependent gamuts. Working color spaces are color models that are well suited to image editing tasks such as tonal or color adjustments. The most important working spaces are listed below :

sRGB is sort of common denominator and used as default for unmanaged computers. This color space is appropriate for uploading images to the web and to send them for printing to minilabs if no custom space is specified. It has been endorsed by the W3C and by many industry leaders. sRGB is not well suited as working space because it has a narrow gamut.

Usually the input and output color spaces are smaller than the working color space.

Color temperatures

Color temperature is another characteristic of visible light that is important in digital imaging and photography. Color temperature is conventionally stated in the unit of absolute temperature, the Kelvin, having the unit symbol K. Color temperatures over 5.000K are called cool colors, while lower color temperatures (2.700–3.000 K) are called warm colors.

The color temperature of sunlight above the atmosphere is about 5.900 K. Tungsten incandescent lamps used formerly in the photography had a temperature of 3.200 K. The CIE introduced in 1931 the concept of the Standard Illuminant, a theoretical source of visible light. Standard illuminants provide a basis for comparing images or colors recorded under different lighting. Each of these is defined by a letter or by a letter-number combination.

Fluorescent lighting adds a bluish cast to photos whereas tungsten lights add a yellowish tinge to photos. Humans don’t generally notice this difference in temperature because our eyes adjust automatically for it. The process in digital system to compensate these color casts is called white balance. The goal is to correct the lighting so that white objects appear white in images. White balance can be done automatically or manually. Two standard white points are used in white balance : D50 and D65.

In digital imaging, it is important to know a monitor’s color temperature. Common monitor color temperatures, along with matching standard illuminants, are as follows:

  • 5.000 K (D50)
  • 5.500 K (D55)
  • 6.500 K (D65)
  • 7.500 K (D75)

The spectrum of a standard illuminant, like any other profile of light, can be converted into tristimulus values. The set of three tristimulus coordinates of an illuminant is called a white point and can equivalently be expressed as a pair of chromaticity coordinates.

Color Profiles

Informations about device gamuts and illuminants are registered in ICC profiles. ICC is the International Color Consortium which was formed in 1993 by eight vendors in order to create an open, vendor-neutral color management system which would function transparently across all operating systems and software packages. Every device that captures or displays color can be profiled. A profile can be considered as a description of a specific color space.

Profiles describe the color attributes of a particular device or viewing requirement by defining a mapping between the device source or target color space and a profile connection space (PCS, either CIEXYZ or CIELAB) serving as reference.There are two types of profiles :

  • matrix-based : mathematical formulas
  • table-based : large tables of sample points (LUT = look up table) to define the 3D color space

Mappings may be specified this way using tables, to which interpolation is applied, or through a series of parameters for transformations.

ICC profiles help you to get the correct color reproduction when you input images from a camera or scanner and display them on a monitor or print them.

Color

Color conversion with ICC profiles

An ICC profile must conform to the ICC specification. The latest profile version is 4.3.0.0, the corresponding specification ICC.1:2010-12 is technically identical to the ISO standard 15076-1:2010.

There are different device classes of profiles : input, output, display, link, abstract, colorspace, … ICC profiles may have the suffix .icc or .icm. Display profiles are commonly of the Matrix/TRC type with a 3×3 matrix of the colorant primaries tristimulus values and a one-dimensional tone curve for each colorant. They can also be of the multi-dimensional look-up table (LUT) type with a three-dimensional look-up table and a second one-dimensional tone curve. Some device-independant profiles are purely theoretical and describe a way to turn color into numbers. Others are device-dependant and describe the color signature of a particular device.

A profile does not correct anything in the image. An original with a color cast (Farbstich) keeps the cast during the color conversion. Image correction and cast removals are separate processes which need specific software.

ICC profiles can be embedded in digital images, for example in JPEG files. If the profile uses a standard color space like sRGB, a simple EXIF tag is sufficient to indicate it. If a custom (non-standard) color space is used, the complete data segment can be embedded. Photoshop features check-boxes to embed ICC profiles in dialog boxes when saving or creating images.

A free program for Windows to view the content of ICC profiles has been developed by Huan (Huanzhao) Zeng. The software is called ICC Profile Inspector; the current version 2.4.0 was updated on February 22, 2009. The following figure shows a screenshot of the program displaying the header and the tag table of the Blurb ICC Profile for Blurb books.

ICC Inspector

ICC Profile Inspector showing the Blurb book ICC profile

The device class of the Blurb ICC profile is output, the color space is CMYK, the profile connection space is Lab, the rendering intent is relative colormetric and the illuminant has the values X = 0.9642, Y = 1.0, Z = 0.82491. AToBn (A2Bx) and BToAn (B2Ax) are gamut mapping tables used in printer profiles. A refers to the device, B to the profile connection space. A2B tags are used for proofing, B2A tags are used for printing.

By clicking on a tag in the ICC Profil Inspector, the corresponding content is displayed.

The next figure shows a screenshot of the program displaying the header and the tag table of my Sony Vaio laptop :

sony_srgb

ICC Profile Inspector showing the ICC profile of a labtop display

The device class of the Sony ICC profile is display, the color space is RGB, the profile connection space is XYZ, the rendering intent is perceptual and the illuminant has the values X = 0.96419, Y = 1.0, Z = 0.82489. The tags rXYZ, gXYZ and bXYZ present the gamut for the three channels, the tag wtpt shows the white point, the tags rTRC, gTRC and bTRC indicate the Tone Response Curves for the three channels in 16bit mode (see gamma encoding later in this post).

ICC

ICC color profile  for Sony Vaio labtop display : gamut, white point, gamma

Windows Color Management panel allows to change settings for the ICC profiles. Mac OS X has an inbuilt ICC profile inspector inside the umbrella application ColorSync Utility.

An OpenICC project was launched in 2004. Files are available at Sourceforge.

RAW to JPEG / TIFF conversion

To view our image, we must display it on a monitor or print it on paper. In both cases we need to process (edit) the image to cope with limitations of the output medium and with another particularity of the human vision. Compared to a photosensor, our eyes are much more sensitive to changes in dark tones than we are to similar changes in bright tones.

A standard computer monitor can only display 8 bits per color channel. The common image file formats used in this environment are compressed JPEG or uncompressed TIFF files. To convert our raw image into on of these standards, we need to apply several image adjustments; some are irreversible. Often these adjustments are done automatically inside the digital imaging system (camera, scanner), but it’s also possible to do it manually outside with an image editing software like Photoshop.

The steps to adjust the digital image are the following :

  • Demosaicing
  • Gamma encoding
  • White Balance
  • Tonal compensation
  • Color Compensation
  • Sharpening
  • Compression

Demosaicing

Let’s come back to our photosensors without considering their dynamic range, sensitivity or bit depth. To create a color image from the captured photons in the photosensors, a first process is the Bayer Demosaicing to provide full color information at each image pixel. Different demosaicing algorithms are applied to improve the image resolution or to reduce the image noise. Small-scale details in images near the resolution limit of the digital sensor can produce visual artifacts, the most common artifact is Moiré.

Gamma encoding

To translate between our eye’s light sensitivity and that of a digital imaging system, a function called gamma is used. In the simplest case the nonlinear gamma function is defined by the following power-law expression:

Vout = A * Vin exp gamma

Vout and Vin are the input and output luminositye values, A is a constant (usually A = 1) and gamma is the exponent. A gamma value lower than 1 is called an encoding gamma, a value greater than one is a decoding gamma. In the first case the compressive power-law nonlinearity is called gamma compression; conversely the application of the expansive power-law nonlinearity is called gamma expansion. The term gamma correction is sometimes used for both processes.

We distinguish three types of gamma :

  • Image Gamma
  • Display Gamma
  • System Gamma

The image gamma is applied on the raw image data before converting them to a standard JPEG or TIFF file and saving it to the memory card. The gamma encoding redistributes the native tonal levels into ones that are perceptually more uniform, making a more efficient use of a given bit depth. The encoding gamma is usually about 1 / 2.2 = 0.455.

The display gamma refers to the video card and monitor and compensate for the image gamma to prevent that the image is displayed too bright on the screen. The display gamma is usually equal to 2.2.  On old Mac computers the value was 1.8.

The system gamma (viewing gamma) is the net effect of all gammas applied to the image. The system gamma should ideally be close to 1, resulting in a straight line in the gamma chart.

The following figures shows the three gamma plots :

Gamma charts

Gamma charts image, display and system

The precise gamma is usually specified by the ICC color profile that is embedded within the image file. If no color profile is indicated, then a standard gamma of 1/2.2 is assumed.

Tone and color adjustment

We should now have a good understanding about colors, but we didn’t yet explained what are tones. Are tones synonymous to brightness ? Some specialists refer to musical allusions to define tones. Other say that tones include colors. Years ago in a photo forum it was stated that there are only two terms needed to specify tones and colors : hue and luminosity. Ken Bhasin concluded in this forum : “Tone is the degree of greyness. If the subject has color, imagine taking away its color – what remains is its tone. Absence of any tone makes a subject bright (light grey/white). Presence of a tone makes a subject dark (Dark grey/black).” I endorse this definition.

There are several tools to adjust or correct tones and colors. Most are interrelated and influence both tones and colors. The most common tools are presented hereafter with reference to the Photoshop software.

Levels is a tool which can move and stretch the levels of an image histogram. It adjust brightness, contrast and tonal range by specifying the location of complete black, complete white and midtones in a histogram.

The following example shows two Kodachrome slides scanned with a cheap diascanner Maginon FS6600.

Scanned Kodachrome portrait with histograms

Scanned Kodachrome portrait with histograms

The histograms of the three color channels indicate an underexposure.

Color adjustment with Levels Tool in Photoshop

Color adjustment with Levels Tool in Photoshop

By moving the white point to the left in the R, G and B histograms in Photoshop the levels are adjusted. Holding down the ALT-key while dragging the black or white slider is a trick to visualize shadow or highlight clipping and avoid it.

Adjusted portrait

Adjusted portrait

Because the levels have been modified differently in the three color channels, the adjustment influenced also the hue of the image.

Photoshop curves tool

Photoshop curves tool (non-sense adjustment)

A second tool is the Photoshop curves. It’s a very powerful and flexible image transformation utility. Similar to Photoshop levels, the curves tool can take input levels and selectively stretch or compress them. A curve is controlled using up to a total of 16 anchor points. The left figure shows an example of an (artistic nonsense) curve applied to the preceding portrait. The curves tool only redistributes contrast and allow us to better utilize a limited dynamic range. You can never add contrast in one tonal region without also decreasing it in another region. You must decide how to spend your contrast budget. Curves also preserves the tonal hierarchy, unless there are negative slopes in it. The following figure shows the resulting modified image.

Portrait

Portrait modified in Photoshop with the Curves Tool based on nonsense points

 

Curves can also be used on individual color channels to correct color casts (Farbstiche) in specific tonal areas. A typical example of digital images with color casts are scanned film negatives which have a strong orange mask. The reason an orange mask was added to color negative films was because of imperfections in the cmy dyes.

Scanned film negative with orange color cast and inverted into a positive

Scanned film negative

The orange color cast becomes purple when the image is inverted to a positive. All film scanning software comes  with color negative options. Typically a variety of color negative film types, such as Kodak Gold 100, Agfa, Fuji etc are listed in the scanner software. A good scan should avoid clipping in all the color channels, which can be easily checked in the histograms.

If the scanned image is not converted to a positive in the scanner, it can be done in Photoshop. The third Photoshop adjustment tool, called eyedropper (pipette), is well suited for this purpose. The eyedropper figures in the levels and curves panels (see figures above). The far left dropper tool is used to set the black point by clicking on a location within the image that should be black. The far right dropper tool does the same for the white point. The middle dropper tool sets the grey point which is an area in the image that should be colorless.

In a negative white and black are inverted. The lightest part of the negative (the darkest part of the scene) can be no lighter than the color of the base orange cast. If the orange cast can be converted to pure white in the negative (black in positive), then the remainder of the colors will be converted as expected. The next figure shows the areas where the eyedropper tool has been applied and the resulting inverted positive.

positive

Adjusted negative with the dropper (3 areas black, white, grey) and resulting positive

The global adjustment of the colors is called color balance. If the goal is to render specific neutral colors correctly, the method is called grey balance, neutral balance, or white balance respectively. General color balance changes the overall mixture of colors in an image and is used to get colors other than neutrals to appear correct or pleasing.

Photoshop offers various methods to automatize tone and color adjustments :

  • Auto Levels
  • Auto Contrast
  • Auto Color
  • Photo Filter
  • Special filters like ColorPerfect

Photoshop provides also various sliders to adjust manually the parameters color balance, brightness, contrast, hue, saturation, exposure, shadows, highlights etc. A great help is the Photoshop Variations Tools showing incremental changes of different parameters in images, with an indication of eventual clippings. The next figure shows variations of the portrait image for the shadows, mid-tones, highlights and saturation.

Photoshop Variations

Photoshop Variations

Another method to automatize color balance used by several image editors are selectors for  presets, for example :

  • landcsape
  • portraits, skin tones
  • night
  • beach
  • jewelry

Sharpening

The next step in the image processing workflow is sharpening. Resolution adds the detail that lets us recognize features. Sharpness makes edges clear and distinct. The standard tool of choice for sharpening is the UnSharp Mask filter (USM).

All color filter Bayer array algorithms, by definition, blur the image more than could have been theoretically captured by a perfect camera or scanner. Thats why sharpening is often integrated in the demosaicing process. If not, it can be done separately in an image editor like Photoshop.

Compression

A last step in the image processing workflow is compression to reduce irrelevance and redundancy of the image data in order to be able to store or transmit data in an efficient way. Image compression may be lossy or lossless.

The common image formats used in digital imaging today are JPEG and TIFF.

Color Management

Color management is the cross-platform view of all the features presented in the present post, based on ICC standards. Wikipedia defines color management in digital imaging systems as “the controlled conversion between the color representations of various devices. A color management system transforms data encoded for one device (camera, scanner) into that for another device (monitor, printer) in such a way that it reproduces the original colors. Where exact color matching is not possible, the result should be a pleasing approximation.”

Parts of the color management technology are implemented in the operating system (OS), for example ColorSync in Mac OS X and Windows Color System (WCS, formerly ICM) in Windows. Other parts are included in applications (for example Photoshop) and in devices (for example cameras). An open source color management called Little CMS (LCMS) was initiated by Marti Maria in 1998. LCMS is released under the terms of the MIT License as a software library for use in other programs which will allow the use of ICC profiles. The current version is 2.7, updated on March 17, 2015, available on Github.

One of the main components of a color management system is the Color Matching  Module (CMM), which is the software engine in charge of controlling the color transformations that take place inside the system. A Color Transformation Language (CTL) was created by the Academy of Motion Picture Arts and Sciences (A.M.P.A.S.) in 2007.
Besides the color profiles for devices and color spaces, the ICC has standardized a CMM. CMM’s are built into ColorSync and WCS. Photoshop is also a good example of a CMM.
Proper color management requires that all images have an embedded profile. Recent web browsers like Internet Explorer 9, Safari 6 or Firefox support color management.

Calibration

Profiling a device is called characterization. Instruments used for measuring device colors include colorimeters and spectrophotometers. Calibration is like characterization, except that it can include the adjustment of the device, as opposed to just the measurement of the device. When all device are calibrated to a common standard color space such as sRGB, no color translations are needed to get all devices to handle colors consistently. Monitors, scanners and printers are the common devices that can be calibrated.

Windows Display Calibration Tool

Windows Display Calibration Tool

Display Calibration Tool Adobe_gamma

Display Calibration Tool Adobe_gamma

Modern monitors include a factory-created profile that is loaded into the monitor firmware and is communicated to the computer. Some people prefer to replace these profiles with custom ones. Most operating systems include tools to calibrate the monitor. Adobe Gamma is a monitor calibration tool included in Photoshop.

Color charts such as IT8 are used to calibrate scanners. Printers should be calibrated for every type of paper and inks you use. One solution is to print a test chart and to scan it with a IT8 calibrated scanner. Scanner software like SilverFast calculates then an ICC profile for the printer and the paper and ink combination.

IT8 color chart

IT8 color chart

Photo Restoration

Digital photo restoration uses specific image editing techniques to remove visible damage, fading, color casts and other aging effects from digital copies of physical photographs. The most common tools are :

  • levels, curves, contrast and black level tools to remove fading
  • white balance, color balance and other color tools to remove color casts
  • clone stamp, healing brush and other selective editing tools to remove localized damage

Conclusions and recommendations

The human eyes and brain work together to create what we call vision. The eyes collect input and send it to the brain for processing. It’s the brain that decides what it is we see (or think we see). The brain makes its decisions based largely on perceived color and contrast data sent to it by the eye’s sensory elements such as cones and rods. Sometimes these decisions don’t match reality which can give rise to what we know as optical illusions. The human vision still performs better than the most complex digital imaging system.

Here are some rules based on the explanations given in the present post to guide you through the digital imaging process :

  • use Adobe RGB as a working space for 8 bit images and ProPhoto RGB for 16 bit images
  • assign the sRGB profile as default for unprofiled images
  • use a generic CMYK profile for printing if the printer does not supply a custom profile and if it’s not restricted to an RGB interface
  • use perceptual as default rendering intent; it’s the best choice for general and batch use and for images with intense colors
  • use relative colormetric rendering intent  for images with subtle tones (portraits); they benefit from the increased accuracy
  • apply the Photoshop Curves Tool only to 16 bit images

Links

A list with links to websites providing additional information about digital imaging is shown hereafter :

Electronic publishing platforms

Electronic publishing (e-publishing) includes the digital publication of e-books, digital magazines, and the development of digital libraries and catalogues.

One of the leaders in electronic publishing is Issuu, which was founded in Copenhagen, Denmark in 2006 by Michael Hansen, Ruben Bjerg Hansen, Mikkel Jensen, and Martin Ferro-Thomsen. Issuu is a digital newsstand with over 21 million publications and 85 million active readers, featuring titles in fashion, culture, arts, and more, all of which are accessible on any device. In 2014, issuu released Clip, a tool that allows readers to take a snapshot of any part of a publication and share that on social media or through email.

Here are some thumbnails of the magazines currently  available for reading at the Issuu platform :

Magazines on the electronic publishing platform Issuu

Magazines on the electronic publishing platform Issuu

The Current Master Volume 1 Publication by World Wide Art Books (WWAB) and related publications about art and culture are shown at the Issuu website. Some magazines are shown below :

Art Magazines on the electronic publishing platform Issuu

Art Magazines on the electronic publishing platform Issuu

Issuu offers a free basic account to start with the upload of own publications.

 

Beethoven’s Google Doodle

To celebrate Ludwig van Beethoven’s 245th Year, Google created an interactive doodle to help Beethoven arranging his masterpieces during his unfortunate journey to the symphony hall. Produced by Gregory Capuano and designed by Leon Hong, the Google engineers Jordan Thompson, Jonathan Shneier, Kris Hom and Charlie Gordon programmed a new masterpiece of animation. The Piano recordings have been done by Tim Shneier. Nate Swinehart was responsible for animatics and additional art.

The following figures show some key scenes from the interactive animation.

beethoven_1beethoven_2beethoven_4beethoven_5beethoven_6beethoven_7beethoven_7abeethoven_8beethoven_9beethoven_10beethoven_10abeethoven_11beethoven_12beethoven_13beethoven_14beethoven_15beethoven_16beethoven_17beethoven_18beethoven_19beethoven_20

Mobile DICOM viewers

Last update : October 20, 2016

Note : the new versions released since spring 2016 have not yet been tested. It will be done in the coming days.

Introduction

This contribution refers to my recent updated post about DICOM image viewers. Mobile DICOM viewers are becoming more and more popular. They are very useful in the context of medical applications in the cloud.

Most web viewers can be used on mobile equipments (tablets, smart phones, …), but the focus of this post are native applications designed for Apple iOS or Android devices. DICOM Web viewers are handled in a separate contribution. In the present list I considered only those applications that have been updated after January 2014, with some exceptions.

Test Scenario

To test the selected apps, I used Orthanc (Windows versions 0.9.5 and 0.9.6) as PACS server. To have realistic DICOM samples,  I uploaded some DICOM studies from me and from family members relative to exams done in the past in hospitals in Luxembourg and France.

To set up a communication between a DICOM viewer and the Orthanc server, the viewer should allow to define the following parameters in the settings :

  • Remote AET
  • Remote Hostname/IP
  • Remote port number
  • Local AET
  • Local port number
  • Protocol : C-MOVE

The local IP is the address of the used mobile device.

If no settings are available for the port numbers, the port number of the server can be added to the remote IP address. The standard port number 104 can be tried as a first guess for the settings of the viewer. If no local AET settings are provided, the iPad name can be tried as a first guess. Another possibility is to use a DICOM network analyser like DVTk to detect unknown parameters. If the C-MOVE protocol is not supported by the viewer, the WADO or C-GET protocols can be an alternative.

In the presentation of the selected mobile viewers, I generally used the terminology published by the developers, even if I disagree with their claims.  In the case of apps that worked as expected with the Orthanc server, I added some screenshots to show the look-and-feeling of the viewer.

Purpose of the evaluation

You may ask what is the purpose to evaluate proprietary closed source applications in an open source environment. I started the evaluation in mid-2015 in the context of the development of an educational tool for radiologists, called RadioLogic. The reasons were various :

  • to familiarize with the DICOM technologies (learning by doing)
  • to compare the performance of native apps with HTML5 web apps on tablets and phones
  • to explore the different types of graphical user interfaces to create a best-of-breed GUI for the RadioLogic project
  • to examine the assets of viewers certified / cleared by FDA or CE
  • to test features that are not (yet) available on HTML5 web apps

iOS Applications

DICOM

Mobile DICOM viewers (icons) arranged in a folder on the iPad Desktop

The following DICOM viewer apps, which are currently available at the AppStore, have been tested. They are arranged and listed in alphabetical order :

1. aycan mobile

aycan mobile is an iPad app which allows to receive and display DICOM images in an easy, secure and fast way. Developed by aycan Digitalsysteme GmbH, the current version 1.08.000 was updated on July 22, 2015. The viewer works only with the aycon DICOM workstation, which is based on Osirix. A demo server with ID and password “aycan” allows to explore some demo studies. A subscription is required to use all features of the the ayMobile communication service. A free 30-days-trial subscription can be ordered on the aycan website.

2. DICOM-AVC

DICOM-AVC is available for iPad and iPhone. The current free version is 2.2 has not been updated since July 12, 2012. It has been developed by the The New Medical Product Server LLC who claims that DICOM-AVC is a complete real-time collaborative imaging and videoconferencing tool which was once the number one downloaded app on the AppStore. To use the app, registration of an account is required, which can be upgraded to a premium account for 19.99$ per year. Today it’s displayed as black screen on my iPad.

3. DICOM Mobile

Dicom Mobile is a simple but powerful DICOM viewer for iPhone and iPad, developed by Luigi Orso. The current version is 1.4.0, updated on June 3, 2015. The price is 2.99$, with additional in-app purchases for extensions. The developer provides support on his website. DICOM files can be loaded from a DropBox account or from a Web server, but not from a PACS server.

DICOM Mobile Menu

DICOM Mobile Main Menu

DICOM Mobile Dropbox Panel

DICOM Mobile Dropbox Panel

4. DICOM Viewer HD

The free version 1.0 of DICOM Viewer HD was released on July 4, 2014, by Wingspan Xi’an Electronic Technology Co., Ltd from China. I was not able to evaluate the app, the login or registration in the “User Manageer” always fails.

5. DICOM IR

DICOM IR is one of the easiest and most intuitive 2D DICOM Image viewers for iOS. DICOM IR can browse any standard PACS server. DICOM IR is developed by Pietro Zuco, a freelance mobile developer based in London/Tokyo/Barcelona. Pietro Zuco has a solid experience developing 2D games, utilities, educational and entertainment applications on iOS and OSX systems. Version 1.0 of DICOM IR was released on July 25, 2015 and is free for a limited time. The app supports C-ECHO, C-FIND and C-MOVE queries.

DICOM IR has a very clean GUI, an excellent user guide, a perfect configuration panel, a performant viewer and it works as expected with the Orthanc server. My compliments to this author.

DICOM IR PACS Server Configuration Panel

DICOM IR PACS Server Configuration Panel

DICOM IR User Guide

DICOM IR User Guide

DICOM IR search panel

DICOM IR search panel

DICOM IR Metadata Info panel

DICOM IR Metadata Info panel

DICOM IR image viewer panel

DICOM IR image viewer panel with line tool

6. iDO Viewer

The iDO medical image viewer is quickly becoming the next generation in mobile medical image viewing by combining multi-modality imaging with individualized physician workflow. Developed by EBM Technologies, Incorporated, the current version 1.1.4 was updated on March 30, 2016. This application requires the EBM iDO server, demo servers to view sample data and basic features of the app are available and can be selected in the settings panel.

7. imageFlow.mobile

imageFLOW.mobile is the best-in-class mobile application for medical imaging PACS users on iOS devices. imageFLOW is developed by imagitive GmbH. The current free version 2.0, based on Imagitive’s DaVinci framework, was updated on November 25, 2015. A DemoServer mode to explore some DICOM studies is enabled by default. A PACS server can be configured in the general iOS settings, nevertheless access trials failed with a “Server Authentication” error message.

8. iMango

iMango is the iOS adaptation of the famous Mango DICOM viewer developed at the Research Imaging Institute (RII), an Organized Research Unit (ORU) of the University of Texas Health Science Center at San Antonio. It works on iPad’s. The current version 1.3 was updated on June 10, 2015. The price is 14.99$. A PACS server can be configured in the general settings and the app works as expected with the Orthanc server. iMango also supports the WADO protocol.

iMango Transfer Options Panel

iMango Transfer Options Panel

iMango Server Configuration Panel

iMango Server Configuration Panel

iMango User Guide

iMango User Guide

iMango image viewer with about panel

iMango image viewer with about panel

iMango image viewer with metadata info panel

iMango image viewer with metadata info panel

iMango image tools

iMango image tools

9. iPaxera

iPaxera is one of the fastest and easy to use PACS viewing applications specifically designed for viewing and navigating studies with your iPad, iPhone, and iPod. iPaxera is developed by Paxeramed Corp, a world leading medical imaging solution developer based in Boston, that develops a full range of medical imaging solutions. The current free version 3.10 was updated on May 4, 2016. A PACS server can be configured in the “Add Node” panel. Ipaxera works as expected with the Orthanc server. The app also supports the WADO protocol.

Onn Akbar Ali reported that Ipaxera can display multiframe Jpeg images ( such as angiography ) quite well.

iPaxera login panel

iPaxera login panel

iPaxera PACS server configuration panel

iPaxera PACS server configuration panel

iPaxera search panel

iPaxera search panel

iPaxera worklist panel

iPaxera worklist panel

iPaxera image viewer with measure tool and series list panel

iPaxera image viewer with measure tool and series list panel

10. iTA View

iTA VIEW is a viewer for DICOM and DICOM RT objects developed for iPad and dedicated to radiotherapy. The app is developed by Tecnologie Avanzate TA srl in Italy. The current version 1.2.0 was updated on March 8, 2016. The app works with the Orthanc server. To transfer studies without limitations, an upgrade to the full version is required. The price for the upgrade is 29.99 EUR.

ITA View PACS server configuration panel

ITA View PACS server configuration panel

ITA View User Guide

ITA View User Guide

ITA View worklist panel

ITA View worklist panel

ITA View database panel

ITA View database panel

ITA View image viewer

ITA View image viewer

11. Jack Imaging Medical Image Viewer

Jack Imaging Medical Image Viewer is a medical image viewer for the iPad that makes use of nephosity’s patent pending technology, the latest in medical imaging innovation. It supports reading the DICOM format and the most common imaging modalities. The viewer is developed by Nephosity Inc. The current version 3.0.5 was updated on January 25, 2016. The prize is 0.99$. The viewer works only with the Jack Imaging platform which  stores the DICOM data in the cloud. Currently Amazon’s cloud infrastructure is used to provide the best performance and highest security levels. During a beta phase the Jack Imaging platform accounts are offered for free. On 4th generation iPads the Jack Imaging viewer offers FDA cleared capabilities.

11. Keiron

Keiron is an innovative App that allows you to view, annotate and analyse radiographic images stored in the DICOM standard. The current free version 1.0 was released on May 4, 2015. Keiron is developed by Digital Video S.p.A., the creator of Toonz. A PACS server can be configured in the settings, but only the ECHO and C-FIND queries are working with the Orthanc server. The “download” button to load DICOM instances is disabled.

Keiron serevr & client configuration

Keiron server & client configuration panels

Keiron viewer settings

Keiron viewer settings panel

Keiron worklist panel

Keiron worklist panel

12. LEADTOOLS MedicalWebViewer

The LEADTOOLS Medical Web Viewer is a zero footprint solution available for iPad and iPhone, developed by Leadtools Technologies Inc. The current free version 3.0 was updated on May 27, 2016. The viewer works only with LEAD’s web servers so you can quickly access the features of the LEADTOOLS Medical Web Viewer Framework SDK with the default settings.

13. loDicom Viewer

loDicom Viewer allows you to view, archive and transfer 2D medical images in DICOM format. Developed by Luigi Orso, the current version 4.1.1 was last updated on July 30, 2014. The price is 12.99$. The developer is also the author of the DICOM Mobile viewer. He provides support on his website, which is not useless, because the app crashes systematically on my iPad. ECHO tests with the Orthanc server are succesful, but a C-FIND query leads to a crash. I was only able lo load DICOM files via a DropBox. The GUI is not very intuitive, the user guide is not very helpful.

loDICOM viewer PACS server configuration

loDICOM Viewer PACS server configuration panel

loDICOM Viewer

loDICOM Viewer ECHO Test panel

loDICOM Viewer image panel

loDICOM Viewer image panel

loDICOM Viewer user guide

loDICOM Viewer user guide

14. MedFilm

MedFilm is a fast dicom viewer developed by Fuli Wu, a researcher at the Zhejiang University of Technology in Hangzhou, China. The app is available for iPad and iPhone. The current free version 4.25 was updated on June 1, 2016. A PACS server can be configured with support of the WADO protocol. The C-MOVE protocol is not supported.

MedFilm

MedFilm DICOM file and image panels

15. Med View

Med View is developed by Matthias Rudolph and available for iPad and iPhone. The current free version 1.1 was updated on October 23, 2015. DICOM files can be loaded from the iTunes file sharing service or from FTP servers.

16. Mobile MIM

The Mobile MIM software program is used for the viewing, registration, fusion, and/or display for diagnosis of medical images from various modalities. Developed by MIM Software Inc., the current version 4.0 was updated on July 26, 2016. Image data can only be transferred to the device by using MIMcloud or MIM 5.1+ workstation software.

17. mRay

mRay, developped by mbits, is available for iPad and iPhone. The current free version 4.1.6 was updated on October 4, 2016. mRay is a CE certified and approved medical product. To be able to receive images in mRay from your PACS, the mRay Server Software must be installed, which can be used free of charge for an evaluation period.

18. MyXray

MyXray is an easy and intuitive app that will let you see your x-ray files as a real doctor. The free version 1.0 was released on September 8, 2015. The app is developed by Pietro Zuco, the author of the outstanding DICOM IR app. MyXray is a lite version of DICOM IR without support of DICOM communications.

19. Nuance PowerShare

Nuance PowerShare Mobile gives you instant access to your medical images and reports stored on the Nuance PowerShare Network using your iOS device. The free version 5.5.10 was updated on August 16, 2016. I was not able to load this app from the AppStore.

20. OsiriX HD

OsiriX HD is the iOS adaptation of the famous OsiriX DICOM viewer, running on Mac OSX,  which is considered as a reference for DICOM image viewers. It works on iPhone’s and iPad’s. The current version 4.2 was updated on October 14, 2016. The price is 49,99$, with additional inline sales. Osirix HD can be configured in the general settings. The app works as expected with the Orthanc server and supports also the WADO protocol.

Osirix HD PACS Server configuration panel

Osirix HD PACS Server configuration panel

Osirix HD Exams Panel

Osirix HD Exams Panel

osirixhd_split_screen

Osirix HD Split Screen in image viewer

Osirix HD Image viewer

Osirix HD Image viewer with stack of 20 instances

osirixhd_metadata

Osirix HD Metadata Panel

21. PACS DICOM Viewer

PACS DICOM Viewer app is a free, vendor-neutral PACS browser and DICOM viewer which works on iPad. It is developed by Logicpond Inc, a California based product design and development solutions company. The current version 2.1.1 was updated on November 11, 2015. The viewer can be configured to work with the Orthanc server, but the C-MOVE queries are aborted during the image transfer. The WADO protocol  is also supported  and works with Orthanc.

PACSDICOM Viewer startup picture

PACSDICOM Viewer startup picture

PACSDICOM Viewer configuration panel

PACSDICOM Viewer configuration panel

PACSDICOM Viewer search panel

PACSDICOM Viewer search panel

PACSDICOM Viewer worklist

PACSDICOM Viewer worklist panel

PACSDICOM Viewer download success

PACSDICOM Viewer download success

PACSDICOM Viewer images with rainbow LUT

PACSDICOM Viewer images with rainbow LUT

PACSDICOM Viewer metadata panel

PACSDICOM Viewer metadata panel

22. R-Site Mobile

R-Site Mobile for IOS supports 2D, 3D and MIP/MPR operations for DICOM files. To use this app, you have to own at least one set of R-Site PACS. R-Site is developed by DJ HealthUnion Systems Corporation in China. The current version 1.0.2.47 was updated on August 31, 2016.

23. ResolutionMD

ResolutionMD enables doctors to securely view patient images and reports from a wide variety of computers and mobile devices, collaborate with other practitioners and diagnose from any location. The product requires access to a configured ResolutionMD Server. It contains a demo mode to allow to experience the full functionality of ResolutionMD on a variety of anonymous patient images. ResolutionMD is devloped by Calgary Scientific Inc. The free version 5.3.3. was updated on July 19, 2016.

Android Versions

DICOM Android apps on Samsung Galaxy Tablet 2 - 7.0

DICOM Android apps on Samsung Galaxy Tablet 2 – 7.0

The following iPad applications are also available as Android version on Google Play Store (in alphabetical order) :

3a. DICOM Mobile

The current Android version 1.3.2 of DICOM Mobile was updated on August 13, 2014. The price is the same as for the iOS version : 2.99$. The GUI and the features of the viewer are also identical to the iOS version. DICOM images can only be loaded from DropBox or from other web servers.

Android DICOM Mobile menu panel

Android DICOM Mobile menu panel

9a. iPaxera

The Android free version 2.0.1 of  iPaxera was updated on September 15, 2016. This app requires Android 4.4 or greater and I was not able to test it on my Samsung Galaxy tablet running Android 4.2.2. A few days later I changed my Blackberry phone with an LG Spirit phone running Android 5.0.1. After installing iPaxera on this phone, I noticed that the Android version is different from the iOS version and allows no PACS server configuration, but only dowloads of DICOM files from Dropbox or iTune sharing.

10a. iTA View

The Android free, but limited, version 1.10 of iTA View was updated on October 27, 2014. An in-app upgrade priced 26.99 EUR is available through the Google Play Store.

iTA

iTA View PACS server configuration panel

iTA

iTA View settings panel

iTA

iTA View search panel

12a. LEADTOOLS MedicalWebViewerDemo

The Android version of the LEADTOOLS MedicalWebViewer is the online live demo of the Medical Web Viewer Framework included with LEADTOOLS PACS Imaging and Medical Imaging Suite. The current version 1.4.1 was updated on February 2, 2014.

17a. mRay

The Android free version 4.1.6 of  mRay was updated on September 23, 2016. The mRay app can not be used without the installation of the mRay Server Software.

Android Applications

The following DICOM viewers are only available as Android version (in alphabetical order) :

24. Dicomite

Dicomite is a free and powerful DICOM viewer with intuitive and simple user interface, optimized for use on multi-touch devices. Dicomite is developed by Samsung MNO Lab. The current version 1.7.1 was updated on October 11, 2016. To display images they must be downloaded into the local memory with an Internet browser.

DICOMITE

DICOMITE image panel

25 Direct DICOM

The Direct DICOM Viewer is developed by Hui Zhang. The current version 1.2.4 was updated on March 21, 2015. To display images they must be downloaded into the local memory with an Internet browser. The app works however as DICOM server and local DICOM files can be stored to the Orthanc server.

Direct Dicom viewer image and metadata panels

Direct Dicom viewer image and metadata panels

Direct Dicom viewer server and store (push) panels

Direct Dicom viewer server and store (push) panels

26. Droid Dicom Viewer

The Droid Dicom Viewer was developed by Pierre Malarme. The free current version 3.2.3 was updated on May 17, 2011. Droid Dicom Viewer is a Free and Open Source Software (FOSS) licensed under the terms of the GNU General Public License. To display images they must be downloaded into the local memory (cache) with an Internet browser.

Droid DICOM viewer about panel

Droid DICOM viewer about panel

Droid DICOM viewer cache panel

Droid DICOM viewer cache panel

Droid DICOM image panel

Droid DICOM image panel

Droid DICOM viewer image panel with

Droid DICOM viewer image panel with LUT/CLUT

27. DroidRender

DroidRender is a 3D DICOM viewer for Android, including DICOM file support by GDCM,
volume rendering and tissue segmentation and display. Developed by Startm, the current version 3.2.0 was updated on August 26, 2016. The app proposes in-app purchases at prices between €1.04 – €104.08 per item and displays ads at the bottom of the screen. To display images they must be downloaded into the local memory (cache) with an Internet browser.

Droid Renderer

Droid Render image panel

28. Mobile Dicom

Mobile Dicom is a free Android Mobile Dicom (Diconde) Viewer application which is based on opensource OFFIS DCMTK as its backend library. Inspired by opensource community and in the hope of extending usage of the library on Android devices, the Mobile Dicom / Diconde tool was created by Feng Gao. The current version 2.4 was updated on November 23, 2015. To display images they must be downloaded into the local memory (cache) with an Internet browser. The app works however as DICOM server and can store local DICOM files tthe Orthanc server.

Mobile Dicom Viewer about and config panels

Mobile Dicom Viewer start and about panels

Mobile Dicom Viewer load and config panels

Mobile Dicom Viewer load and config panels; ECHO test was succesfull

Mobile Dicom Viewer image and metadata panels

Mobile Dicom Viewer image and metadata panels

29. simplyDICOM

Simply DICOM is currently in public beta. It should work with any uncompressed DICOM images, downloaded into the local memory. The viewer has a minimal interface to keep the focus on the images themselves. The developer is Christopher Boyd. The current version 0.7.3 was updated on May 27, 2015. To display images they must be downloaded into the local memory (cache) with an Internet browser.

Simply DICOM

SimplyDICOM image viewer

DICOM file downloads

If DICOM files are served with the extension .dcm or/and with the content type application/dicom, they are recognized as DICOM images in iOS Safari and can be opened directly in the following DICOM viewers : MedFilm, MyXray, Osirix HD, DICOM IR, iMango or Dicom Mobile.

Safari .dcm files

.dcm files recognized as DICOM images in iOS Safari browser by DICOM viewers

DICOM files embedded in .zip archives are recognized by the same DICOM viewers in the iOS Safari browser.

Safari .zip files

.zip files recognized in iOS Safari browser by DICOM viewers

On Android devices, DICOM files are only recognized by the DIRECT DICOM viewer in the Android browser, but they can be downloaded in the /storage/emulated/0/Download/ folder where they are accessible by most Android DICOM viewers.

Android DICOM file download panel

Android DICOM file download panel

Links

The following list provides links to mobile applications which are not DICOM viewers, but related to medical imaging (in alphabetical order) :

Conclusions

Among the 29 tested native mobile DICOM viewers, 18 are iOS apps, 6 are Android apps and 5 are available on the two platforms. 9 viewers can be configured to access a vendor-neutral PACS server, but only 5 of them work as expected and comply with the Orthanc PACS server. Among them are the three renowned commercial viewers iMango, iTA View and Osirix (priced between 15 and 50 USD), one free app (iPaxera) developed by a world leading medical imaging solution provider (Paxeramed Corp) and one app (DICOM IR) created by an independent free-lance developer ( Pietro Zuco). The other 4 configurable viewers are limited, partially disabled or crashing.

The remaining viewers are demo apps working with proprietary PACS systems, displaying only DICOM files loaded from DropBox or from another web server or crashing and working not at all. There are additional DICOM viewer apps in the AppStore and the Google PlayStore which are not listed because they were not updated in the last two years.

My two cents

I was shocked to see that most native mobile apps in the medical domain are not state of art. Apps in the stores which have not been updated in the last few years, text errors in the menus, program errors in the logic ( 2 viewers change the AETitle during communications), crippled GUI’s when the orientation of the device changes, wrong version numbers in the about panel etc, are testimonies of the poor quality.

DICOM Testing with DVTk

Last update : December 11, 2015

DVTk history

DVTk is an Open Source project for testing, validating and diagnosing communication protocols and scenarios in medical environments. It supports DICOM and IHE integration profiles. The project started in 1997 by Philips and was joined by Agfa in 2001. In 2005, DVTk was open sourced and one year later ICT Automatisering joined the open source community. in 2009 Agfa left the project.

The following tools are currently free available from the DVTK.org website or from SourceForge (Windows binaries and library sources) :

  • DICOM Compare, v 3.0.3
  • DICOM Editor, v 3.2.6
  • DICOM Network Analyzer, v 3.3.2
  • DVT Validator, v 2.6.8
  • Query Retrieve SCP Emulator, v 4.1.3
  • RIS Emulator, v 3.2.0
  • Storage SCP Emulator, v 3.3.0
  • Storage SCU Emulator, v 3.3.0

DVTk Tests

I used these tools in the context of the development of an education tool for radiologists called RadioLogic. I edited the following script to execute an ECHO test and a STORE-SCP test with the Orthanc DICOM Server, version 0.9.5 :

# DVT Dicom Script
SESSION
SESSION-TYPE emulator
SESSION-FILE-VERSION 1
# Product Test Session Properties
SESSION-TITLE "Orthanc Server"
SESSION-ID 001
MANUFACTURER "Manufacturer"
MODEL-NAME "Product Name"
SOFTWARE-VERSIONS "Version 1.0"
APPLICATION-ENTITY-NAME "ORTHANC"
APPLICATION-ENTITY-VERSION "0.9.5"
TESTED-BY "Marco Barnig"
DATE "20151208"
# SUT ACSE Properties
SUT-ROLE acceptor
SUT-AE-TITLE "ORTHANC"
SUT-MAXIMUM-LENGTH-RECEIVED 16384
SUT-IMPLEMENTATION-CLASS-UID ""
SUT-IMPLEMENTATION-VERSION-NAME ""
# DVT ACSE Properties
DVT-AE-TITLE "DVTK_STR_SCU"
DVT-MAXIMUM-LENGTH-RECEIVED 16384
DVT-IMPLEMENTATION-CLASS-UID "1.2.826.0.1.3680043.2.1545.1"
DVT-IMPLEMENTATION-VERSION-NAME "DVT2.6"
# Socket Properties
SUT-HOSTNAME "localhost"
SUT-PORT 4242
DVT-PORT 104
DVT-SOCKET-TIMEOUT 30
USE-SECURE-SOCKETS false
TLS-VERSION "TLSv1"
CHECK-REMOTE-CERTIFICATE true
CIPHER-LIST "aRSA+kRSA+SHA1+eNULL:@STRENGTH:-SSLv2"
CACHE-TLS-SESSIONS true
TLS-CACHE-TIMEOUT 300
CREDENTIALS-FILENAME ""
CERTIFICATE-FILENAME ""
# Test Session Properties
LOG-ERROR true
LOG-WARNING true
LOG-INFO true
LOG-RELATION false
LOG-DEBUG false
LOG-DULP-STATE false
LOG-SCP-THREAD true
PDU-DUMP false
STORAGE-MODE as-media
STRICT-VALIDATION false
DETAILED-VALIDATION-RESULTS true
SUMMARY-VALIDATION-RESULTS true
INCLUDE-TYPE-3-NOTPRESENT-INRESULTS false
AUTO-TYPE-2-ATTRIBUTES true
DEFINE-SQ-LENGTH false
ADD-GROUP-LENGTH false
# Supported Transfer Syntaxes
SUPPORTED-TRANSFER-SYNTAX "1.2.840.10008.1.2"
SUPPORTED-TRANSFER-SYNTAX "1.2.840.10008.1.2.2"
SUPPORTED-TRANSFER-SYNTAX "1.2.840.10008.1.2.1"
# Configurable Delay between N-Action and N-Event Command
DELAY 10
# Definitions
DEFINITION-DIRECTORY "%COMMONPROGRAMFILES%\DVTk\Definition Files\DICOM\"
DEFINITION "All DIMSE Commands.def"
DEFINITION "CT Image Storage.def"
DEFINITION "Digital X-Ray Image Storage - For Presentation.def"
DEFINITION "Digital X-Ray Image Storage - For Processing.def"
DEFINITION "Enhanced CT Image Storage.def"
DEFINITION "Enhanced MR Image Storage.def"
DEFINITION "Media Storage Directory.def"
DEFINITION "MR Image Storage.def"
# Results
RESULTS-ROOT ".\results\"
APPEND-TO-RESULTS-FILE false
# DICOMScript Description Directory
DESCRIPTION-DIRECTORY ".\html\"
ENDSESSION

Scripts are saved as text files with the extension .ses. Several scripts can be referenced in an xml-project file with the extension .pdvt.

The following figure shows the resulting settings in the DVTk session panel :

Session

DTVk DICOM validator session panel

By double-clicking on the Storage-SCU-emulator link at the left, a window pops up allowing to do an ECHO test or to send a DICOM file to the Orthanc server. The exchanged messages are displayed in the Activity Logging panel :

DVT

DVTk Activity Logging

After the succesful sending of a DICOM file to the Orthanc server, a summary of the validation results is shown in the Validation Results panel :

DVT

DVTk Validation Results

In verbose mode, the Orthanc Server provides the following releated messages in the command window :

Orthanc Server output in verbose mode

Orthanc Server output in verbose mode

DVTk Network Sniffer

The next figure shows the results of the DVTk network sniffer analyzing the DICOM traffic between the OSIRIX HD viewer on iPad with the ORTHANC DICOM server (version 0.9.6) running on Window 8.1.

DVTk

DVTk summary results of FIND Request sent by Osirix HD from iPad

I entered only the first characters of the patient name to send a FIND query. DVTk reports four errors in the C-FIND communication because the following data elements are not valid :

  • (0008, 0018) : SOP Instance UID > should be present with at least a zero length
  • (0010, 0020) : Patient ID > should be present with at least one value
  • (0020, 000D) : Study Instance UID > should be present with at least one value
  • (0020, 000E) : Series Instance UID > should be present with at least one value

The C-MOVE communication works without errors and the received results displayed in Osirix HD are correct.

DVTk

DVTk reports no errors in the C-MOVE communication between Osirix HD and Orthanc

The Orthanc server shows no specific error message in the command window.

The OSIRIX HD viewer is configured as follows :

  • Remote AET : ORTHANC
  • IP : 192.168.178.26
  • Port : 4242
  • AETitle : OSIRIXHD
  • IP : 192.168.178.65
  • Port : 4096
  • Transfer Syntax : Implicit Little Endian (preferred syntax by Orthanc)
  • Encoding : ISO IR 100 (Latin-1)
  • Protocol : C-MOVE
  • Timeout : 90 sec

Communication Failure

The next example shows the case of a failed communication. The C-FIND query sent by the PACS DICOM iPad app to the Orthanc server (version 0.9.6) is aborted with a DIMSE failure. The query is identical to the C-FIND request sent by Osirix HD. The Orthanc log signals “DIMSE No data available (timeout in none-blocking mode)”.

PACS DICOM

Orthanc log messages related to a C-FIND command sent by the PACS DICOM app

The DVTk network analyzer shows the same four errors as in the case of the Osirix communication. After a timeout, the communication is aborted.

DVTk

DVTk signals an Abort Request in the PACS DICOM – Orthanc association

The PACS DICOM viewer is configured as follows :

  • Server AET : ORTHANC
  • Host Name/IP : 192.168.178.26
  • Server Port : 4242
  • Local AET : TEST-SCU
  • Device IP Address : 192.168.178.65
  • Local Port : 4096
  • Protocol : C-MOVE

A deeper analysis is required to identify the reason of the abort request. If the problem is caused by a non-valid parameter in the C-FIND query, the recently proposed LUA script filter will be an excellent remedy.

Accessing Local Virtual Hosts

Last update : September 7, 2015

Local Networks

A local area network (LAN) is a computer network that interconnects computers within a limited area such as a residence, school, laboratory, or office building. It is contrasted to a wide area network (WAN), which covers a larger geographic distance and may involve leased telecommunication circuits. Ethernet over twisted pair cabling and Wi-Fi (WLAN) are the two most common transmission technologies in use for local area networks.

Virtual Hosts

The term Virtual Host refers to the practice of running more than one website (such as dev.radiologic.fr and local.radiologic.fr) on a single machine. The fact that they are running on the same physical server is not apparent to the end user. Apache was one of the first servers to support virtual hosts right out of the box.

Computer Name, Address and Route

To find and access a computer in an network, we must know the following informations :

  1. Name : to indicate what we seek ( > Domain Name )
  2. Address : to indicate where it is ( > IP Address )
  3. Route : to indicate how to get there ( > Routing )

Domain Name

Domain names are used to identify one or more IP addresses. They are used in URLs to identify particular web pages. Domain names can be local or public. The latter must be registered with an ICANN accredited registrar.

A domain name consists of one or more parts, technically called labels, that are conventionally concatenated, and delimited by dots, such as example.com. The right-most label conveys the top-level domain (TLD), including the generic top-level domains (gTLDs), such as the prominent domains com, info, net, edu, and org, and the country code top-level domains (ccTLDs) such as lu, de, fr.

Below the top-level domains in the domain name hierarchy are the second-level domain (SLD) names. These are the names directly to the left of the top-level domains. Second-level domain names are usually created based on the name of a company, product or service. There can be additional sub-level domains with virtually no limitation. Below these levels, the most right domain name component is used to designate a particular host server, for example www for a world wide web server, ftp for an FTP server, or any other label. A domain name with TLD, SLD and hostname is called a fully qualified domain name (FQDN), for example dev.radiologic.fr.

Local domain names used in local networks can be freely chosen by the network administrator, but some TLD’s should be avoided. For example Apple uses the domain extension .local for it’s implementation of zero-configuration networking called Bonjour.

To map domain names to IP addresses, a Domain Name System (DNS) is used.

IP Address

An IP Address (Internet Protocol address) is a numerical label assigned to each device participating in a computer network that uses the Internet Protocol for communication. The designers of the Internet Protocol defined an IP address as a 32-bit number (IPv4) which is still in use today. A new version of IP (IPv6), using 128 bits for the address was developed in 1995 to avoid a depletion of the available addresses. Its deployment has been ongoing since the mid-2000s.

IP addresses are usually written and displayed in human-readable notations, such as 172.16.254.1 (IPv4), and 2001:db8:0:1234:0:567:8:1 (IPv6).

An IP address is logically recognized as consisting of two parts: the network prefix and the host identifier, or interface identifier (IPv6). The routing prefix is expressed in CIDR (Classless Inter-Domain Routing) notation. It is written as the first address of a network, followed by a slash character (/), and ending with the bit-length of the prefix. For example, 192.168.1.0/24 is the IPV4 prefix starting at the given address, having 24 bits allocated for the network prefix, and the remaining 8 bits reserved for host addressing.

IPv4 reserves some addresses for special purposes such as private (local) networks or multicast addresses. The following ranges are reserved for private networks :

Prefix length Start End
/8 10.0.0.0 10.255.255.255
/12 172.16.0.0 162.31.255.255
/16 192.168.0.0 192.168.255.255

In IPV6, the reserved address blocks for private networks are referred to as unique local addresses (ULA) and they use the routing prefix fc00::/7.

IP addresses can be static (fix) or dynamic. Static IP addresses are manually assigned to a computer by the network administrator. Dynamic IP addresses are assigned either by a server (router) using Dynamic Host Configuration Protocol (DHCP) or by the computer itself, as in Zeroconf. In the last case of address autoconfiguration (link-local address) the address block 169.254.0.0/16 is reserved in IPv4 networks and the block fe80::/10 in IPV6 networks.

Subnets

In IPV4 a subnet mask is used to indicate how the IP address is divided into network and host parts. A subnet mask is made by setting network bits to all “1”s and setting host bits to all “0”s. For example, 255.255.255.0 is the network mask for the 192.168.1.0/24 prefix.

Routing

Routing is the process of selecting best paths in a network. Routing schemes differ in their delivery semantics:

  • unicast : destination is a single specific node in the network
  • broadcast : destinations are all nodes in the network
  • multicast : destinations are all interested nodes in the network
  • anycast : one to many routing topology
  • geocast : destinations are all nodes in a geographical area

Unicast is the dominant form of message delivery on the Internet.

DNS Resolver

The main job of a DNS server is to store DNS name data and serve it when it receives requests. The main job of a DNS resolver is to transform a DNS name into an IP address, but this is only one of several types of resolution services performed by DNS. The process to resolve an hostname to an ip address is normally called dns lookup.

Reverse DNS lookup or reverse DNS resolution (rDNS) is the determination of a domain name that is associated with a given IP address.

Accessing local virtual hosts

There are different ways that local websites can be viewed from other computers which are connected within the same LAN. These computers can be desktops or laptops running Windows, Mac OSX, Linux or be mobile devices like tablets (iPad, Samsung, …) or smart phones (iPhone, Android, …).

  • Use the LAN IP of the server : downside – only one website can be accessed
  • Use the LAN host name of the server : downside – only one website can be accessed
  • Use a LAN-wide hosts file : downside – this doesn’t work on iOS and most other mobile devices
  • Use own DNS server : downside – setup is complex ; DNS server must always be turned on
  • Use a Wi-Fi router with DNS Masquerading : downside – only a few routers support this option
  • Use registered domain names : downside – all website domain names must have a common base; works only with Internet access
  • Use a HTTP proxy server : downside – multiple

We are analyzing now what solution to adapt for a real network case, related to the specific RadioLogic project.

RadioLogic project requirements

RadioLogic is an university education tool for radiologists which uses three websites, working as virtual hosts :

  • www.radiologic.fr : hosted on Amazon AWS, this website provides the tools and data for public users
  • local.radiologic.fr : hosted on a local server, this website provides the tools and data for private users on a local network
  • dev.radiologic.fr : hosted on a local server, this website provides the beta versions of new tools and data for testing before deployment on the public and private hosts

If possible, the IT consumerization policy BYOD (Bring your own device) is promoted allowing the radiologists in residence to use their own devices. The local server is a MacBookAir laptop running OSX Yosemite 10.10.5 or later. The clients are iPads running iOS 8.1.4 or later. Both the server and the clients will be used for other purposes.

There exist four operational modes :

  1. The server is used as standalone client without Internet connection
  2. The server is used as standalone client with an Internet connection through a Wi-Fi router
  3. An iPad is used as client with an Internet connection through the same Wi-Fi router (same local network)
  4. An iPad is used as client with a local AdHoc Wi-Fi Connection (SSID = radiologic-open) established by the server

The following figure shows the four operational modes.

Four

RadioLogic : four operational modes

The project requirement is that the same host names are used in each operation mode to access the three websites. Let’s examine how to achieve this goal.

Server without Internet connection used as a client

Without Internet connection, it’s not possible to access the public website www.radiologic.fr. To access the local websites local.radiologic.fr and dev.radiologic.fr, the most simple solution is to use the internal hosts file available on every desktop computer (Windows, Linux, Mac OSX, …). This configuration file for the loopback interface is located at /private/etc/hosts on the Mac OSX, but it’s also accessible through the more traditional location /etc/hosts. This file is configured as follows :

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
127.0.0.1       local.radiologic.fr
127.0.0.1       dev.radiologic.fr
255.255.255.255	broadcasthost
::1             localhost

The default values are the IP addresses for the localhost in IPV4 and IPV6 and the broadcasthost for IPV4. The radiologic hosts have been added.

Server with Internet connection used as a client

Accessing the public website www.radiologic.fr is now possible and the preceding loopback solution is also working.

iPad used as a client with Internet connection in local network

There is no problem to access the public website www.radiologic.fr, but the simple loopback solution to access the local hosts is not possible on mobile devices without jailbreaking.

The next possibility consists in using a local DNS server. Setting up a DNS server on the Mac laptop with primary zones for the local hosts needs a parameter change in the DNS configuration of the iPad Wi-Fi connection.

Wi-Fi

Wi-Fi settings in iPad

We must change the IP address of the DNS server, assigned by the Internet provider via the Wi-Fi router, by the local IP address of the Mac laptop, which leads to various problems :

  • The IP address of the Mac laptop changes when you use it in a different local network or when the DHCP server assigns a new address in the same network at booting
  • The DNS server of the Mac laptop must be continuously running to use the iPad for Internet surfing
  • Using an additional DNS server with forwarding to a public DNS server to set up an Internet connection may lead to delays or performance problems
  • Frequent changes of the DNS addresses on an iPad is an error-prone process for a normal user

I recommend to never change the network parameters assigned by the Internet provider on your router and local devices to avoid all sort of problems.

There exist a third solution to access the local hosts in our case, which some developers consider as a hack : using the public DNS server to point towards the internal private IP address of the Mac computer.

This solution is simple and feasible in our case because all hosts use the same domain name radiologic.fr which is registered and managed in a public DNS server. Instead of creating an A record for both dev.radiologic.fr and local.radiologic.fr we can use a wild-card (*) to catch all DNS records.

Some reasons to not use a public DNS server with local IP addresses, invoked by other developers, are the following :

  • leak of internal informations to third parties
  • it’s not considered best practice
  • external clients may inadvertently be redirected to a host on their own local network
  • it’s likely to cause confusion and human miscommunication
  • risk of mail delivery timeouts or mail bounces
  • risk of DNS rebinding attacks

I don’t agree with these arguments that I consider as minor problems or not applicable in specific cases. I think the solution is not a such bad idea in practice and I will use it in the RadioLogic project.

Some routers provide a security feature to protect against DNS rebinding attacks by suppressing DNS responses that refer to IP addresses in the home network. My router FRITZ!Box 7390 is such a device. It allows to enter domain names in a list of exceptions where this protection should be disabled. In our case these are dev.radiologic.fr and local.radiologic.fr.

fri

Exceptions to the DNS rebinding protection in the Fritz!Box router 7390

iPad used as a client connected to an AdHoc network

The only workable solution in this case is the use of a local private DNS server. You may ask what about the problems listed in the preceding chapter ? Well, these are no longer issues in the case of an AdHoc Wi-Fi network :

  • The self-assigned IP address of the AdHoc Wi-Fi interface in the range 169.254.0.0/16 can be defined as static
  • The DNS server is always running when the Mac laptop runs the AdHoc network
  • Without Internet connection there is no forwarding to a public DNS server
  • The DNS address is changed once in the configuration of the AdHoc Wi-Fi connection which is different from the configuration of the other Wi-Fi infrastructure connections

Search Domain

In iOS and OSX Wi-fi settings, each Wi-fi connection has a Search Domains section which is simply a convenience that allows the system to convert host names to Fully Qualified Domain Names (FQDN). Anyplace you might use a FQDN, such as in the location bar of Safari,  you can use a simple host name. If the system can’t resolve that host name to an IP address, then it will try appending the search domain to the host name and try again. If you specified more than one search domain, it will try them each in order.

If we set the search domain to radiologic.fr, we can use the host names dev and local to access the corresponding websites. I didn’t opt for this solution because it introduces more complexity and an additional delay in setting up connections.

Network Diagnose Tools

There are several tools available for iPads to diagnose access problems in local networks:

net

iPad Network Analyzer : ping statistics – LAN overview

Links

The following list provides links to websites with additional informations about accessing local virtual hosts :

Mac OSX Wireless Networks

Last update : September 17, 2015

AdHoc Wi-Fi Networks

Sometimes it’s useful to create a WLAN (wireless network) between two or more Wi-Fi-enabled computers without using an Wi-Fi router. These computer-to-computer networks are usually referred to as AdHoc wireless networks.

create

Create an ad-hoc Wi-Fi network on Mac OSX

On a Mac OSX (Yosemite 10.10.5) it’s easy to set up such a network. Choose Create Network from the Wi-Fi status icon in the menu bar. Enter a name (in my case : radiologic-open) for the new network and select the channel (default channel = 11). You will notice that there is no password protection to secure the network. A WEP (Wired Equivalent Encryption) algorithm was however available in previous versions of the OSX system. WEP was Wi-Fi’s first encryption standard and was almost intentionally designed to be weak due to issues related to the US export policies about encryption. WEP was deprecated in 2003 and replaced by WPA2 (Wi-Fi Protected Access) by the Wi-Fi Alliance.

In Yosemite, Apple killed WEP once for all, without replacing it by another protection method in AdHoc mode.

open

Chose name and channel for the AdHoc network

If the icon isn’t in the menu bar, choose Apple menu > System Preferences, then click Network (réseau). Click Wi-Fi and select the Show Wi-Fi status in menu bar checkbox.

Mac OSX

Mac OSX System Preferences

The Wi-Fi status menu shows the established connection with the radiologic-open network. The menu allows an easy logout and reconnection to another Wi-Fi network. An automatic logout occurs when the Mac screen is powered off.

Radoio

Wi-Fi status menu shows the AdHoc network active

Infrastructure Wi-Fi networks

There exist a second possibility to set up a Wi-Fi network on Mac OSX. The computer is configured as a software Wi-Fi base station. This allows to share an Internet connection and offers a password protection, but it has another inconvenience. You need a working wired Ethernet connection between your Mac and a hub, even if the hub is not connected to the Internet. The next picture shows my test setup: my MacBookAir is connected via a Ethernet-Thunderbolt interface to an ancient 10 Mbit/s Ethernet hub.

Thunderbolt-Ethernet

MacBookAir connected with Thunderbolt-Ethernet interface to hub

First you need to configure the Ethernet-Thunderbold interface. Go to Network in System Preferences and select the automatic configuration. The interface gets a self-assigned IP address in the range 169.254.x.x.

network

Ethernet-Thunderbolt automatic configuration

In the next step go to the Sharing Preference Pane in the System Preferences. Select Ethernet-Thunderbold as source port and Wi-Fi as destination port. Select Wi-Fi options to enter a name (in my case : radiologic-secure) of the network, to select a channel and to define a password (minimum 8 characters; numbers are not recognized on BlackBerry and Android).

Internet Sharing Wi-Fi network configuration

Internet Sharing Wi-Fi network configuration

Finally check the Internet sharing checkbox and confirm the settings to activate the connection.

Share

Activate the Internet sharing

The resulting pane is shown below.

rads

Activated Internet sharing pane

The Wi-Fi status is updated automatically. To log out, desactivate the Wi-Fi connection in the corresponding menu. An automatic logout occurs when the Mac screen is powered off.

Radio

Wi-Fi status menu showing Internet sharing

The following table shows which of my devices are capable to connect to the Mac OSX AdHoc and Infrastructure networks.

Device Wi-Fi AdHoc Wi-Fi infrastructure
iPad OK OK
iPhone OK OK
BlackBerry  network not shown network joined, but
no access to host
Samsung Tablet (Android 4.2.2) network not in range network joined, but
no access to host
Laptop Vista no connection network joined, but
no access to host
Desktop Windows 8.1 network not shown OK
Laptop Debian no connection OK

Wi-Fi Diagnostic

To detect the reasons why some devices don’t connect to the Mac OSX Wi-Fi AdHoc or Infrastructure networks, you can use a WLAN analyser. Mac OS X Yosemite has an in-built Wi-Fi scanner to help you find the best Wi-Fi channel. When you hold down the option key ⌥ (next to the CTRL key) and select the Wi-Fi icon in the menu bar, a secret dropdown menu opens.

secret

Secret Wi-Fi dropdown menu in Mac OSX Yosemite

Open Wireless Diagnostics and click it. After you have gotten to the page and have opened up the Wireless Diagnostics window, go to the top left of your menu bar and click on Window where you find several options: Informations, history, scan, performance, detection, …  Some results are shown below.

Mac OSX Wi-Fi Analyser

Mac OSX Wi-Fi Analyser

Another WLAN tool is available on Windows computers. When you enter the command

netsh wlan show networks mode=bssid

in the command window, you will get the following results :

Wi-Fi

Microsoft Wi-Fi Analyser

A third WLAN tool is integrated in my Wi-Fi router FritzBox 7390. Various wireless networks in my neighborhood are shown, but nor the channels used by the Mac OSX nor the names of these networks are listed. I don’t know why ?

funkkanale

Wi-Fi channels used in proximity of the Fritzbox

There are also several external software tools for Wi-Fi-analysis available, for example Acrylic Wi-Fi Free or Acrylic Wi-Fi Professional. The main window (Access points,  Signal strength) of Acrylic is shown hereafter :

Acrlylic Wi-Fi Analyser

Acrlylic Wi-Fi Analyser

Some additional windows (stations, packet viewer, 2,4 GHz APs channels, detailed info) are shown below :

Various Acrylic results

Various Acrylic results

Wi-Fi Assessment

Several methodologies are available dealing with safety aspects of wireless networks, for example :

Links

The following list shows links to websites providing additional informations about Wi-Fi networks, related to Mac OSX.

DICOM image viewers

Last update : May 30, 2016

Referring to my recent post about the DICOM standard, this contribution presents an overview about an important entity in the medical imaging workflow : DICOM image viewers. The list is not exhaustive; I did the following segmentation to present my personal selection of current DICOM image viewers :

  1. Reference viewer
  2. Reference toolkits
  3. Open source viewers
  4. Free proprietary viewers
  5. Licensed commercial viewers
  6. Mobile viewer apps
  7. Other viewers

1. Reference DICOM Viewer

Today one project is generally considered as a reference for DICOM applications : OsiriX.

OsiriX

The OsiriX project started in November 2003. The first version was developed by Antoine Rosset, a radiologist from Geneva, Switzerland, working now at the La Tour Hospital  in Geneva. He received a grant from the Swiss National Fund to spend one year in UCLA, Los Angeles, with Prof. Osman Ratib, to explore and learn about medical digital imaging. In October 2004, Antoine Rosset went back to the Geneva University Hospital in Switzerland, to continue his career as a radiologist, where he published an OsiriX reference article in June 2004 in the Journal of Digital Imaging. Joris Heuberger, a mathematician from Geneva, joined the project in March 2005 on a voluntary fellowship of 6 months in UCLA, Los Angeles. In June 2005, OsiriX received two prestigious Apple Design Awards : Best Use of Open Source and Best Mac OS X Scientific Computing Solution. Osman Ratib, Professor of Radiology in UCLA, returned to Geneva at the end of 2005 as the chairman of the Nuclear Medicine service.

In March 2009, Antoine Rosset, Joris Heuberger and Osman Ratib created the OsiriX Foundation to promote open-source in medicine. In February 2010, Antoine Rosset and Joris Heuberger created the company Pixmeo to promote and distribute the OsiriX MD version, certified for medical imaging. This version complies with the European Directive 93/42/EEC concerning medical devices. The price for a single licence is 678 EUR. The free lite version can be downloaded from the OsiriX website, the source code is available at Github.

OsiriX runs on Mac OSX and is released under the version 3 of the GNU Lesser General Public License. The current version is 7.0 and was released on December 7, 2015. Osirix can also be configured as a PACS server. The power of OsiriX can be extended with plugins.

OsririX Lite

OsririX Lite

An Osirix HD version for the iPad is available at the AppStore for 49,99 EUR.

2. Reference DICOM toolkits

DICOM toolkits are more than simple viewers; they are a complete set of tools, code samples, examples, documentation, tutorials etc to develop great healthcare applications.

DCMTK

DCMTK is a collection of libraries and applications implementing large parts the DICOM standard. It includes software for examining, constructing and converting DICOM image files, handling offline media, sending and receiving images over a network connection, as well as demonstrative image storage and worklist servers. DCMTK is is written in a mixture of ANSI C and C++. It comes in complete source code and is made available as open source software.

DCMTK is an ancestor of DICOM applications. In 1993, before the official release of the standard, a DICOM prototype implementation was created by OFFIS, the University of Oldenburg and the CERIUM (Centre Européen d’Imagerie à Usage Médical) research centre in Rennes (France) on behalf of the European Committee for Standardization (CEN/TC251/WG4).

The current version of DCMTK is 3.6.1, released in June 2015. The related snapshot is available at the dicom.offis.de website. DICOMscope is the related free DICOM viewer which can display uncompressed, monochrome DICOM images from all modalities and which supports monitor calibration according to DICOM part 14 as well as presentation states. DICOMScope 3.6.0 for Windows, implemented in a mixture of Java and C++, was released in 2003. DICOMscope can’t be installed on newer Windows systems (Vista, Windows 7, Windows 8.1), an error 105 (setup.lid missing) is issued.

DICOMscope

DICOMscope version 3.5.1 (archive image)

Some DCMTK modules, especially those that are not part of the free toolkit, are covered by a separate license which can be found in the COPYRIGHT file in the corresponding module directory. These tools can be evaluated during a period of four months, any further use of the software requires a full licence agreement, free of charge.

The following sub-packages are part of DCMTK :

  • config: configuration utilities for dcmtk
  • dcmdata: a data encoding/decoding library and utility apps
  • dcmimage: adds support for color images to dcmimgle
  • dcmimgle: an image processing library and utility apps
  • dcmjpeg: a compression/decompression library and utility apps
  • dcmjpls: a compression/decompression library and utility apps
  • dcmnet: a networking library and utility apps
  • dcmpstat: a presentation state library and utility apps
  • dcmrt: a radiation therapy library and utility apps
  • dcmsign: a digital signature library and utility apps
  • dcmsr: a structured report library and utility apps
  • dcmtls: security extensions for the network library
  • dcmwlm: a modality worklist database server
  • dcmqrdb: an image database server
  • oflog: a logging library based on log4cplus
  • ofstd: a library of general purpose classes

Each sub-package (module) contains a collection of sub-modules (functions). For example, the networking library dcmnet contains the following command line tools :

  • dcmrecv: Simple DICOM storage SCP (receiver)
  • dcmsend: Simple DICOM storage SCU (sender)
  • echoscu: DICOM verification (C-ECHO) SCU
  • findscu: DICOM query (C-FIND) SCU
  • getscu: DICOM retrieve (C-GET) SCU
  • movescu: DICOM retrieve (C-MOVE) SCU
  • storescp: DICOM storage (C-STORE) SCP
  • storescu: DICOM storage (C-STORE) SCU
  • termscu: DICOM termination SCU

dcm4che

dcm4che2 is a collection of open source applications and utilities for the healthcare enterprise developed in the Java programming language. dcm4chee2 is a DICOM Clinical Data Manager system.

dcm4che2 contains a number of useful sample applications that may be used in conjunction with dcm4chee, with another archive application, or to operate on DICOM objects in a standalone fashion. A list of the dcm4che2 utilities is shown hereafter :

  • dcm2txt- Convert a DICOM object to text
  • dcm2xml- Convert a DICOM object to XML
  • dcmdir- Manipulate a DICOM dir
  • dcmecho – Initiate a C-ECHO command as an SCU
  • cmgpwl – Query a General Purpose Worklist SCP
  • dcmmwl – Query a Modality Worklist SCP
  • dcmof – Simulate an Order Filler application
  • dcmqr – Perform C-FIND, C-GET and C-MOVE operations as an SCU
  • dcmrcv – DICOM receiver (C-STORE SCP)
  • dcmsnd – Perform C-STORE operations as an SCU
  • dcmups – Unified Worklist and Procedure Step SCU
  • dcmwado – Initiate DICOM WADO requests
  • jpg2dcm – Convert a JPEG image to DICOM
  • logger – Log files to a Syslog destination
  • mkelmdic – Create the serialized dcm4che2 DICOM Dictionary
  • mkuiddic – Create the dcm4che2 UID dictionary
  • mkvrmap – Create the dcm4che2 VR Mappings
  • pdf2dcm – Convert a PDF document to DICOM
  • rgb2ybr – Convert pixel data from YBR to RGB format
  • txt2dcmsr – Convert text to a DICOM Structured Report
  • xml2dcm – Convert XML to DICOM

The dcm4che history states that back around the year 2000, Gunter Zeilinger wrote the popular JDicom utility suite using commercial Java DICOM Toolkit (JDT). After this experience, he decided to develop his own toolkit and to name it after Che Guevara.
dcm4che and dcm4chee are licensed under an MPL/GPL/LGPL triple license, similar to Mozilla.

The dcm4che DICOM viewer is called Weasis. The current version is 2.0.4, released on June 23, 2015.

WEASIS version 2.0.4

WEASIS version 2.0.4

Grassroots DICOM

Grassroots DiCoM is a C++ library for DICOM medical files. It is accessible from Python, C#, Java and PHP. It supports RAW, JPEG, JPEG 2000, JPEG-LS, RLE and deflated transfer syntax. It comes with a super fast scanner implementation to quickly scan hundreds of DICOM files. It supports SCU network operations (C-ECHO, C-FIND, C-STORE, C-MOVE).

The current version is gdcm-2.6.3, released on January 27, 2016. The GDCM source code is available at Github. A Wiki is available at Sourceforge, a reference to GDCM is available at Wikipedia. The project is developed by Mathieu Malaterre (malat) from Lyon, France.

3. Open Source DICOM Viewers

Most open source DICOM viewer projects are web viewers based on HTML5, CCS3 and Javascript. The big advantage of these viewers is the cross-platform compatibility; they can be used with any modern browser.

DICOM web viewers are presented in a separate contribution. Among them are the following open source projects :

  • Cornerstone
  • DWV
  • Papaya
  • jsDICOM
  • webDICOM
  • dcmjs

There are also some non web open source DICOM viewers :

  • 3DSlicer
  • 3DimViewer

3DSlicer

3D Slicer is a free and open source software package for image analysis and scientific visualization. It’s more than a simple DICOM viewer. This outstanding project started as a masters thesis project between the Surgical Planning Laboratory at the Brigham and Women’s Hospital and the MIT Artificial Intelligence Laboratory in 1998.

3D Slicer is written in C++, Python, Java and Qt and can be compiled for use on multiple computing platforms, including Windows, Linux, and Mac OS X. 3D Slicer needs a powerful computer to run. The current version is 4.5.0-1, released on November 11, 2015. It’s distributed  under a BSD style, free, open source license. More than 50 plug-ins and packages of plug-ins are available.

3D Slicer

3D Slicer

The main developers are now Steve Pieper, Slicer’s principal architect and Ron Kikinis, Principal Investigator for many Slicer-related projects. The names of all contributors are available at the 3D slicer.org website.

3DimViewer

3DimViewer is a lightweight 3D viewer of medical DICOM datasets distributed as open source software. The viewer is multiplatform software written in C++ that runs on Windows, Linux and Mac OSX systems.

3DimViewer is developed by 3Dim Laboratory s.r.o., a company specializing in applications of modern computer graphics in medicine and developing innovative solutions. Founded since 2008, the company focuses on medical image processing, 3D graphics, geometry processing and volumetric data visualization. The company office is located in Brno, Czech Republic, next to many high tech companies inheriting the spirit of South Moravian Innovation Centre.

3DimViewer

3DimViewer version 2.2

The current version of 3DimViewer is 2.2, released on February 6, 2015. Several plugins are available to extend the functions. Binaries are available for download on the 3DimLab website, source code is available at BitBucket.

GDCMviewer

GDCMviewer is the simple tool that show how to use vtkGDCMImageReader. It is basically only just a wrapper around GDCM. The tool is meant for testing integration of GDCM in VTK.

4. Free Proprietary DICOM Viewers

Most free proprietary DICOM viewers are copyrighted by their owner and are available for use, as is, free of charge, for educational and scientific, non-commercial purposes. Some of them are included on DICOM CDs provided by the hospitals to the patients.

Mango

Mango (short for Multi-image Analysis GUI) is a viewer for medical research images, developed by Jack L. Lancaster, Ph.D. and Michael J. Martinez at the University of Texas.

There are several versions of Manga available :

  • Manga Desktop, a Java application running on Windows Mac OSX and Linux
  • iMango, running on iPads and available at the AppStore
  • webMango, running as a Java applet
  • Papaya, running as HTML5 application in all browsers

The software and data derived from Mango software may be used only for research and may not be used for clinical purposes. If Mango software or data derived from Mango software is used in scientific publications, the Research Imaging Institute UTHSCSA must be cited as a reference.

Mango DICOM viewer

Mango DICOM viewer

Orpalis

The Orpalis DICOM Viewer is a free tool for medical staff to view DICOM files. The current version 1.0.1, released on June 20, 2014, should run on any 32- or 64-bit Windows System, but I experienced serious problems on my Windows 8.1 system (thumbnails are not displayed, frequent viewer crashes, …). The ORPALIS DICOM Viewer is based on the GdPicture.NET SDK.

Orpalis DICOM viewer

Orpalis DICOM viewer

MicroDICOM

MicroDicom is an application for primary processing and preservation of medical images in DICOM format, with an intuitive user interface and being free for use and accessible to everyone. MicroDicom runs on Windows, the current version is 0.9.1, released on June 2, 2015.

MicroDicom viewer

MicroDicom viewer

EMV Medical Viewer

The EMV viewer is developed by Escape, which was founded in 1991 and is based in downtown Thessaloniki, Greece. EMV 4 for Windows was released on October 10, 2014, EMV 4.4.1 for Mac OSX was released on July 21, 2015.

You can download and evaluate the software for free, but you need a license for using it in a commercial environment. The price for one license is 245 EUR, for use on up to three computers.

5. Licensed commercial DICOM viewers

Photoshop

Since version 10 (CS3) launched in April 2007, Photoshop provides a comprehensive image measurement and analysis tools with DICOM file support.

Photoshop CS3 with DICOM support

Photoshop CS3 with DICOM support

DICOMIZER

Dicomizer is a Point-Of-Care Imaging and Reporting tool provided by H.R.Z Software Services LTD in Tel-Aviv, Israel. The company is specialized in developing Medical Device, Healthcare IT, DICOM and HL7 solutions and provides medical imaging consultation, development services and professional courses. The company was founded in 2002 (formerly RZ Software Services) by Roni Zaharia, a medical imaging and connectivity expert, who is acting as its CEO. Roni Zaharia is the author of the blog DICOM is easy, providing useful news about medical images and an outstanding DICOM tutorial. Dicomizer works on Windows, the current version is 5.0. The price of a licence is $470 USD, a free evaluation version is available. The annual update costs are  $120 USD. Dicomizer can also be used as an DICOM image generator.

DICOMIZER

DICOMIZER version 4.1

H.R.Z Software Services LTD provides also the following medical toolkits :

  • RZDCX : Fast Strike DICOM Toolkit
  • DSRSVC : extensible DICOM Server (PACS) for OEM
  • HL7Kit Pro : WYSIWYG HL7 Integration Engine for MS SQL Server

MedImaView – PowerDicom

MedImaView is a multi-modality DICOM viewer with an intuitive Windows Graphical User Interface. It’s part of PowerDicom Technologies, an All-in-One application for handling DICOM files developed by DICOM Solutions, an MHGS company. Licenses for PowerDicom (version 4.8.6 released on May 4, 2015) are available in a price-range from 39 EUR to 310 EUR. PowerDicom allows also the generation of DICOM images. A free trial version can be downloaded from the DICOM Solutions website. MedImaView (version 1.8) is free for personal use and students.

MedimaView DICOM viewer

MedimaView DICOM viewer

DICOM PowerTools

DICOM PowerTools are developed by Laurel Bridge who provides imaging workflow solutions and DICOM software products to the medical imaging industry. PowerTools are a suite designed for the testing, troubleshooting, or debugging of applications that use DICOM communications. PowerTools also provides for the viewing, repair, or creation of DICOM data sets and their contents.

The current version is 1.0.34, released on November 24, 2015.

PowerTools File Editor

PowerTools File Editor

RadiAnt

RadiAnt is a DICOM viewer for medical images designed with an intuitive interface and unrivaled performance. It runs on Windows, the latest version is 2.2.8.10726, released on December 11, 2015. The prices for a license range from 72 EUR to 400 EUR. A free evaluation version is available. RadiAnt is not certified as a medical product and is not intended for diagnostic purposes. RadiAnt is developed by Medixant, a small, privately funded company that was first formed by Maciej Frankiewicz in 2011 in Poznan, Poland.

RadiAnt DICOM viewer

RadiAnt DICOM viewer

CODONICS Clarity Viewer

Headquartered in Cleveland, Ohio, Codonics develops, designs, sells and supports leading-edge medical imaging and information management devices used in diagnostic imaging.
Codonics Clarity Viewer features simple image navigation and selection, an intuitive user interface, quick viewer launch and rapid image loading. The Codonics Clarity 3D/Fusion Viewer is extremely useful for viewing diagnostic imaging results. It is a comprehensive PET/CT viewer that is simple to use for single or comparison study review. All basic features of the Codonics Clarity Viewer are also included.

Codonics

Codonics Clarity 3D/Fusion viewer

MatLab Dicom Toolbox

The Image Processing Toolbox of MatLab includes import, export and conversion functions for scientific file formats, amomg them DICOM files. The available functions are dicomanon, dicomdict, dicomdisp, dicominfo, dicomlookup, dicomread, dicomuid, dicomwrite. A tutorial shows how to write data to a DICOM file.

6. Mobile DICOM viewer apps

The mobile DICOM viewers are presented in a separate contribution.

7. Other DICOM viewers

The following list provides links to additional DICOM viewers developed by the industry’s leading medical imaging equipment suppliers and by independant developers :

Links

The following list shows links to websites with additional informations about DICOM viewers :

DICOM TransferSyntaxUID

Referring to my recent post about the DICOM standard, the list of all valid transfer syntaxes is shown below. A DICOM transfer syntax defines how DICOM objects are serialized to transmit them through a network or to save them into a file.

The DICOM transfer syntax is specified by the TransferSyntaxUID located in element number (0002, 0010). There exist 35 different DICOM transfer syntaxes, but 14 have been retired from earlier standard versions and will not be supported in future DICOM releases.

The 21 valid DICOM transfer syntaxes are listed in the following table :

TransferSyntaxUID Transfer Syntax Name Comments
1.2.840.10008.1.2 Implicit VR Endian Default
1.2.840.10008.1.2.1 Explicit VR Little Endian
1.2.840.10008.1.2.1.99 Deflated Explicit VR Big Endian
1.2.840.10008.1.2.2 Explicit VR Big Endian
1.2.840.10008.1.2.4.50 JPEG Baseline (Process 1) Default Lossy JPEG 8-bit
1.2.840.10008.1.2.4.51 JPEG Baseline (Process 2 & 4) Default Lossy JPEG 12-bit
1.2.840.10008.1.2.4.57 JPEG Lossless, Nonhierarchical (Processes 14)
1.2.840.10008.1.2.4.70 JPEG Lossless, Nonhierarchical First- Order Prediction
1.2.840.10008.1.2.4.80 JPEG-LS Lossless
1.2.840.10008.1.2.4.81 JPEG-LS Near-Lossless
1.2.840.10008.1.2.4.90 JPEG 2000 Lossless Only
1.2.840.10008.1.2.4.91 JPEG 2000
1.2.840.10008.1.2.4.92 JPEG 2000 Multicomponent Lossless Only
1.2.840.10008.1.2.4.93 JPEG 2000 Multicomponent
1.2.840.10008.1.2.4.94 JPIP Referenced
1.2.840.10008.1.2.4.95 JPIP Referenced Deflate
1.2.840.10008.1.2.5 RLE Lossless
1.2.840.10008.1.2.6.1 RFC 2557 MIME Encapsulation
1.2.840.10008.1.2.4.100 MPEG2 Main Profile Main Level
1.2.840.10008.1.2.4.102 MPEG-4 AVC/H.264 High Profil Level 4.1
1.2.840.10008.1.2.4.103 MPEG-4 AVC/H.264 BD High Profil Level 4.1

Image Manipulations with Javascript

Introduction

Today most computers, graphic cards and monitors can display 16-bit, 24-bit, 32-bit or even 48-bit color depth. The color quality can be selected in the control center of the graphic (video) card.

ATI Radeon Control Center Window

Example : ATI Radeon Control Center Window

8-bit-color

In 8-bit color graphics each pixel is represented by one byte, the maximum number of colors that can be displayed at any one time is 256. There are two forms of 8-bit color graphics. The most common uses a separate palette of 256 colors, where each of the 256 entries in the palette map is given red, green, and blue values. The other form is where the 8 bits directly describe red, green, and blue values, typically with 3 bits for red, 3 bits for green and 2 bits for blue.

16-bit color

With 16-bit color, also called High color, one of the bits of the two bytes is set aside for an alpha channel and the remaining 15 bits are split between the red, green, and blue components, allowing 32,768 possible colors for each pixel. When all 16 bits are used, one of the components (usually green) gets an extra bit, allowing 64 levels of intensity for that component, and a total of 65.536 available colors.

24-bit color

Using 24-bit color, also called True color, computers and monitors can display as many as 16.777.215 different color combinations.

32-bit color

Like 24-bit color, 32-bit color supports 16.777.215 colors with an additional alpha channel to create more convincing gradients, shadows, and transparencies. With the alpha channel 32-bit color supports 4.294.967.296 color combinations.

48-bit color

Systems displaying a billion or more colors are called Deep Color. In digital images, 48 bits per pixel, or 16 bits per each color channel (red, green and blue), is used for accurate processing. For the human eye, it is almost impossible to see any difference between such an image and a 24-bit image.

CLUT

A colour look-up table (CLUT) is a mechanism used to transform a range of input colours into another range of colours. It can be a hardware device built into an imaging system or a software function built into an image processing application.

HDR

High-dynamic-range imaging (HDR) is a set of techniques used in imaging and photography to reproduce a greater dynamic range of luminosity than is possible with standard digital imaging or photographic techniques. The aim is to present the human eye with a similar range of luminance as that which, through the visual system, is familiar in everyday life.

Pixel Image

PixelImage 8 x 8

PixelImage 8×8

To dive into the Image Manipulations with Javascript, we will use the Pixel Image shown left which has 8 x 8 pixels and a color depth of 1 bit. The bit value 0 is associated to the color white, 1 means black. We see later that in real systems the colors are inverted (1 = white, 0 = black). In the next steps we will look how to display this image in a browser with HTML5 and javascript.

The following table shows the pixel data for the image. I used the MathIsFun website to do the binary to hexadecimal and decimal conversion.

rows column bits hexadecimal decimal
1 01111110 7E 126
2 10000001 81 129
3 10100101 A5 165
4 10000001 81 129
5 10011001 99 153
6 10000001 81 129
7 11100111 E7 231
8 00111100 3C 60

We can now use the following code to draw the pixels on a canvas :

<body>
<canvas id="pixelboard" width="512" height="512"></canvas> 
<script>
var myCanvas = document.getElementById("pixelboard");
var myContext = myCanvas.getContext("2d");
myContext.fillStyle = "silver";
myContext.fillRect(0, 0, myCanvas.width, myCanvas.height);
myContext.fillStyle = "black";
// here are the pixel data for the 8 rows
var pixelData = [126, 129, 165, 129, 153, 129, 231, 60];
for (i = 0; i < pixelData.length; i++ ) {
 var base2 = (pixelData[i]).toString(2);
 var p = 7; 
 // set pixels in canvas from right to left
 for (j = (base2.length-1); j >= 0; j-- ) {
 if (base2[j] == 1) {
 myContext.fillRect(p * 64, i * 64, 64, 64);
 } // end if
 p--;
 } // end base2
} // end pixelData
</script>
</body>

Click this PixelData link to see it working. The image is stored in 8 bytes.

PNG Image

To draw the picture in the original size of 8×8 pixels, we change the canvas size

<canvas id="pixelboard" width="8" height="8"></canvas> 

and the code line in the inner loop as follows

myContext.fillRect(p, i, 1, 1);

Click this PixelData link to see it working.

We can save the small Pixel image in the browser with a right mouse click as canvas.png file. The size of this PNG image file is 108 bytes, 100 bytes more than the size of the image stored in our javascript.Thats a lot of overhead. Sort od design overkill !

Let’s have a look inside this file with an HexEditor (HxD from Maël Hörz).

PNG

Anatomy of a small PNG Image File

We can identify the words PNG, IHDR, IDAT and IEND. The PNG format is specified by the W3C. A lite description is available at the FileFormat.Info website. PNG (pronounced “ping”) is a bitmap file format used to transmit and store bitmapped images. PNG supports the capability of storing up to 16 bits (gray-scale) or 48 bits (truecolor) per pixel, and up to 16 bits of alpha data. It handles the progressive display of image data and the storage of gamma, transparency and textual information, and it uses an efficient and lossless form of data compression.

A PNG format file consists of an 8-byte identification signature followed by chunks of data :

  • Header chunk (IHDR) : the header chunk (13 bytes) contains basic information about the image data and must appear as the first chunk, and there must only be one header chunk in a PNG file.
  • Palette chunk (PLTE) : the palette chunk stores the colormap data associated with the image data. This chunk is present only if the image data uses a color palette and must appear before the image data chunk.
  • Image data chunk (IDAT) : the image data chunk stores the actual image data, and multiple image data chunks may occur in a data stream and must be stored in contiguous order.
  • Image trailer chunk (IEND) : the image trailer chunk must be the final chunk and marks the end of the PNG file or data stream.
  • Optional chunks are called ancillary chunks (examples : background, gamma, histogram, transparency, …) and can be inserted before or after the image data chunks. Ten ancillary chunks have been defined in the first PNG version.

Each chunk has the following structure, each chunk has an overhead of 12 bytes :

  • DataLength (4 bytes)
  • ChunkType (4 bytes)
  • Data (number of bytes specified in DataLength)
  • CRC-32 (4 bytes)

The IHDR chunk specifies the following parameters in the 13 data bytes :

  • ImageWidth in pixels (4 bytes)
  • ImageHeight in pixels (4 bytes)
  • BitDepth (1 byte)
  • ColorType (1 byte)
  • Compression (1 byte)
  • Filter (1 byte)
  • Interlace (1 byte)

An analysis of our PixelData PNG image provides the following results :

  • ImageWidth in pixels :  00 00 00 08 (big-endian) > 8 pixels
  • ImageHeight in pixels : 00 00 00 08 (big-endian) > 8 pixels
  • BitDepth : 08 > 8 bit
  • ColorType : 06 > Truecolour with alpha (RGBA)
  • Compression : 00 > default = deflate
  • Filter : 00 > default = adaptive filtering
  • Interlace : 00 > no
  • ImageDataLength : 00 00 00 31 (big-endian) > 49 bytes

In the HexEditor we see that the 49 bytes of deflated image data are :

18 95 63 38 70 E0 C0 7F 06 06 06 AC 18 2A 07 61 
60 C3 50 85 70 95 28 12 18 0A 08 9A 80 EC 16 9C 
0A 70 9A 80 43 27 04 63 15 44 52 0C 00 67 20 8C 41

The image data is zlib-compressed using the deflate algorithm. zlib is specified in RFC1950, deflate is specified in RFC1951. The process is sufficient complex to not do it manually. We can use the javascript pako.js library to decompress the data block. This library was designed by Vitaly Puzrin and Andrey Tupitsin.

Here comes the code :

<!DOCTYPE HTML>
<html>
<head>
 <meta charset="utf-8">
 <title>Inflate byte block of PNG image pixel data with pako.js</title>
 <script type="text/javascript" src="js/pako.js"></script>
</head>
<body>
<h1>Inflate byte block of PNG image pixel data with pako.js</h1>
<div id="main"></div>
 <script type="text/javascript" >
// enter datastream as array
var hexData = [0x18, 0x95, 0x63, 0x38, 0x70, 0xE0, 0xC0, 0x7F, 0x06, 0x06, 
0x06, 0xAC, 0x18, 0x2A, 0x07, 0x61, 0x60, 0xC3, 0x50, 0x85, 0x70, 0x95, 0x28, 
0x12, 0x18, 0x0A, 0x08, 0x9A, 0x80, 0xEC, 0x16, 0x9C, 0x0A, 0x70, 0x9A, 0x80, 
0x43, 0x27, 0x04, 0x63, 0x15, 0x44, 0x52, 0x0C, 0x00, 0x67, 0x20, 0x8C, 0x41];
 // Pako inflate
 var inflateData = pako.inflate(hexData);
// output inflated data
var output = "<p>The lenght of the inflated data sequence is : " 
+ inflateData.length + "bytes.<br/>"; 
 for (i = 0 ; i < 8; i++) {
 for (j = 0 ; j < 33; j++) {
 console.log((i * 33) + j);
 output+= decimalToHexString(inflateData[(i * 33) + j]) + " ";
 } // end for loop j
 output+= "<br/>";
 } // end for loop i
 output+= "</p>";
 element = document.getElementById("main");
 element.innerHTML = output;
 function decimalToHexString(number)
{ if (number < 0)
 { number = 0xFFFFFFFF + number + 1; }
 return number.toString(16).toUpperCase();
}
</script>
</body>
</html>
Byte sequence in PNG image rows

Byte sequence in PNG image rows

The byte sequence of pixel data stored in  PNG images is shown in the left figure.

In our case we have 8 rows with 8 * 4 bytes (RGBA) plus one null byte, giving a total of 8 * 33 = 264 bytes.

Click the inflate link to see the result of the inflate process. The sequence length is really 264 bytes and the structure of the PNG format is visible in the output.

inflating

inflating PNG image data

The RGB hexadecimal values C0 generate grey (white) pixels, the values 0 generate black pixels. The alpha channel is always transparent (hex FF).

Synthesize a PNG image

To synthesize a minimal PNG image with monochrome PixelData, we modify the original canvas.png data as follows :

1. The signature does not change, the bytes in hexadecimal format are :

89 50 4E 47 0D 0A 1A 0A

2. In the header we set the bit depth to 1 (mono-chrome) and the color type to 0 (gray-scale). We get the following byte sequence in hexadecimal format :

00 00 00 0D 49 48 44 52 00 00 00 08 00 00 00 08 01 00 00 00 00

We have several possibilities to calculate the new CRC32 checksum over the header name and the new data :

CRC32 calculation with desktop and online tool

CRC32 calculation with desktop and online tool

Here comes the code for the javascript CRC32 calculation :

<!DOCTYPE HTML>
<html>
<head>
 <meta charset="utf-8">
 <title>Calculate checksum crc32 with SheetJS/js-crc32 
of canvas.png chunks</title>
 <script type="text/javascript" src="js/SheetJS_crc32.js"></script>
</head>
<body>
<h1>Calculate checksum crc32 with SheetJS/js-crc32 of canvas.png chunks</h1>
<div id="main"></div>
 <script type="text/javascript" >
 // calculate crc32 over chunk name and data
// enter datastream as hexadecimal numbers
var charData = [0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 
0x00, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00];
var myCRC32 = CRC32.buf(charData);
var crc = decimalToHexString(myCRC32);
var output = "<p>Here is the signed 32 bit number of the CRC32 : " 
+ myCRC32 + "<br/>Here is the hexadecimal value of the CRC32 : " 
+ crc + "</p>";
 element = document.getElementById("main");
 element.innerHTML = output;
 function decimalToHexString(number)
{  if (number < 0)
   { number = 0xFFFFFFFF + number + 1 }  
   return number.toString(16).toUpperCase();
} // end function
 </script>
</body>
</html>

Click this CRC32 link to see it working. The checksum to add to the IHDR chunk is EC 74 83 26.

Now we tackle the IDAT chunk. We have 8 rows for the PixelData, starting each with a NullByte (filter), followed by 1 byte in each row for the monochrome pixels. That makes a total of 16 bytes. The data length in hexadecial format is 10. We use 1 for black and 0 for white, giving us the following byte sequence :

00 7E 00 81 00 A5 00 81 00 99 00 81 00 E7 00 3C

This byte sequence is deflated with the Pako.js library with the following script :

<!DOCTYPE HTML>
<html>
<head>
 <meta charset="utf-8">
 <title>Deflate byte block of PNG image pixel data with pako.js</title>
 <script type="text/javascript" src="js/pako.js"></script>
</head>
<body>
<h1>Deflate byte block of PNG image pixel data with pako.js</h1>
<div id="main"></div>
 <script type="text/javascript" >
 // enter datastream as numbers
var charData = [0x00, 0x7E, 0x00, 0x81, 0x00, 0xA5, 0x00, 0x81, 0x00, 0x99, 
0x00, 0x81, 0x00, 0xE7, 0x00, 0x3C];
 // Pako deflate
 var deflateData = pako.deflate(charData);
 var output = "<p>The length of the deflated data sequence is : " 
+ deflateData.length + " bytes.<br/>";
 for (i = 0; i < deflateData.length; i++) {
 output+= decimalToHexString(deflateData[i]) + " ";
 } // end for loop i
 output+= "</p>";
 element = document.getElementById("main");
 element.innerHTML = output;
 function decimalToHexString(number)
{ if (number < 0)
 { number = 0xFFFFFFFF + number + 1; }
 return number.toString(16).toUpperCase();
}
</script>
</body>
</html>

Click this deflate link to see the result. The length of the deflated sequence has 21 bytes (hex : 15) and is longer than the original sequence.That happens with very short image sequences.

deflating

deflating PNG image data

There are possibilities to minify the deflated sequence lenght, but this is not our goal. There are several blogs and posts dealing with smallest possible png images.

The last step is the calculation of the CRC32 checksum, same procedure as above. The following crc32 link shows the 4 byte hexadecimal number : EC 01 89 73.

The final byte sequence for the IDAT chunk is displayed hereafter :

00 00 00 15 49 44 41 54 78 9C 63 A8 63 68 64 58 0A C4 33 81 F8 39 83 0D 00 23 
44 04 63 EC 01 89 73 

3. The IEND chunk remains unchanged and has no associated data :

00 00 00 00 49 45 4E 44 AE 42 60 82

To create and display this synthetic PNG image, we copy all the hexadecimal data in our HexEditor and save it as mysynth.png file. To check that the format is right, we can use the pngcheck tool or  load the image in Photoshop. It works.

png_check

Analayse file mysynth.png with pngcheck.exe

PNG in

Open file mysynth.png in Photoshop

Display the PNG image in the Browser

The typical HTML code to display an image in a web browser is

<img src="url" alt="abcde" width="xxx" height="yyy" />

The src attribute specifies the URI (uniform resource identifier) of the image. The most common form of an URI is an URL (uniform resource locator) that is frequently referred as a web address. URIs identify and URLs locate. Every URL is also an URI, but there are URIs which are not URLs.

The URI syntax consists of a URI scheme name (such as “http”, “ftp”, “mailto” or “file”) followed by a colon character, and then by a scheme-specific part. An example of an URI which is not an URL is a dataURI, for example

data:,Hello%20World

The data URI scheme is a URI scheme that provides a way to include data in-line in web pages as if they were external resources. This technique allows normally separate elements such as images and style sheets to be fetched in a single HTTP request rather than multiple HTTP requests, which can be more efficient.

We will use the dataURI to display our synthesized PNG image in a web browser without saving it to an external source. The data URI scheme is defined in RFC 2397 of IETF. URI’s are character strings, therefore we must convert (encode) the image data to ASCII text. The most common conversion is base64, another method is percent encoding.

There are several possibilities to encode our image data in base64 :

Here comes the code for the javascript btoa() conversion :

<!DOCTYPE HTML>
<html>
<head>
 <meta charset="utf-8">
 <title>Display mysynth.png with dataURI</title>
 </head>
<body>
<h1>Display mysynth.png with dataURI</h1>
<div id="main"></div>
 <script type="text/javascript" >
var signature = [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A]; 
var ihdr = [0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 
0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0xEC, 
0x74, 0x83, 0x26];
var idat = [0x00, 0x00, 0x00, 0x15, 0x49, 0x44, 0x41, 0x54, 0x78, 0x9C, 
0x63, 0xA8, 0x63, 0x68, 0x64, 0x58, 0x0A, 0xC4, 0x33, 0x81, 0xF8, 0x39, 
0x83, 0x0D, 0x00, 
0x23, 0x44, 0x04, 0x63, 0xEC, 0x01, 0x89, 0x73];
var iend = [0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 
0x60, 0x82];
var mysynthPNG = signature.concat(ihdr).concat(idat).concat(iend);
var imageStringBase64 = btoa(String.fromCharCode.apply(null, mysynthPNG));
var mysynthImg=document.createElement("img");
mysynthImg.setAttribute('src', 'data:image/png;base64,' + imageStringBase64);
mysynthImg.setAttribute('alt', 'mysynthPNG');
mysynthImg.setAttribute('height', '8px');
mysynthImg.setAttribute('width', '8px');
document.body.appendChild(mysynthImg);
</script>
</body>
</html>

Click the following base64 link to see the result. The pixel colors are inverted, 1 is white and 0 is black.

Links

The following list provides links to websites with additional informations about image pixel manipulations :