LabCanvas

Open DICOM files in ImageJ (and a series as a stack)

Open DICOM files in ImageJ with File › Open, a whole series as a stack with Import › Image Sequence, read the tags, measure HU, and open compressed DICOM.

ImageJ 1.54f with a synthetic CT phantom opened from a DICOM series as a 12-slice stack: two oval ROIs and the Results table, 40.2 HU in soft tissue and -799.6 HU in an air-filled region
ImageJ 1.54f with a synthetic CT phantom opened from a DICOM series as a 12-slice stack: two oval ROIs and the Results table, 40.2 HU in soft tissue and -799.6 HU in an air-filled region.
Contents

To open a DICOM file in ImageJ, use File › Open… (or drag the file onto the ImageJ window): ImageJ 1.x and Fiji read uncompressed DICOM directly, with the pixel spacing in mm and CT values in Hounsfield units. To open a whole series as one stack, put its slices in a folder and use File › Import › Image Sequence…. Image › Show Info lists the DICOM tags. Compressed DICOM (JPEG, JPEG 2000, RLE) needs Fiji's File › Import › Bio-Formats.

What you need: ImageJ 1.x or Fiji (Fiji for compressed files). Uncompressed DICOM files; one folder per series. The example is a synthetic CT-like phantom written for this guide, not a patient: 12 slices of 256 × 256 pixels, 0.7 mm pixels, 2.5 mm slices, plus one slice saved with RLE compression. ImageJ's own sample, File › Open Samples › CT (16-bit DICOM), also works (it downloads from the internet). Time: 10 minutes.

ImageJ is research software. It is fine for measuring images in a study, but it is not a certified medical device: do not use it for diagnosis, and anonymise patient data before you share files.

Open one DICOM file, step by step

Step 1: Open the file

Choose File › Open… and pick the .dcm file (DICOM files without an extension open too). The title bar shows the size in mm: ImageJ took the pixel spacing from the file. The image is shown with the file's own window (here centre 40, width 400, so the display runs from -160 to 240).

ImageJ window showing a DICOM slice of a synthetic CT phantom, title 179.2 x 179.2 mm, 256 x 256, 16-bit
One DICOM slice in ImageJ 1.54f: 179.2 × 179.2 mm for 256 × 256 pixels, 16-bit 1, so 0.7 mm per pixel from the file. It is displayed with the window stored in the file 2.

ImageJ also applies the Rescale Slope and Rescale Intercept from the header as a calibration. The stored pixel in the centre is 1067; ImageJ shows and measures it as 1067 − 1024 = 43 HU.

Step 2: Read the tags with Show Info

Choose Image › Show Info… (Ctrl I). Each line is a tag: group and element number, name, value.

ImageJ Info window listing DICOM tags next to the image
Image › Show Info on a DICOM file: the Transfer Syntax UID 1.2.840.10008.1.2.1, uncompressed 1; the patient name and ID 2, here a synthetic phantom; the slice thickness, 2.5 mm 3.
TagWhat it tells you
0002,0010 Transfer Syntax UIDWhether the pixels are compressed (see below)
0008,0060 ModalityCT, MR, US, and so on
0010,0010 and 0010,0020 Patient's Name, Patient IDPersonal data: remove before sharing
0018,0050 Slice ThicknessSlice thickness in mm
0020,0013 Image NumberThe slice's place in the series
0028,0030 Pixel SpacingPixel size in mm (row, column)
0028,1050 and 0028,1051 Window Center, Window WidthThe display window
0028,1052 and 0028,1053 Rescale Intercept, Rescale SlopeStored value to real value (HU for CT)

From a macro, getInfo("0028,0030") returns a single tag's value.

Open a DICOM series as a stack

A CT or MR series is usually one file per slice. ImageJ opens them as one stack.

Step 3: Import the folder

Put the slices of one series in their own folder. Choose File › Import › Image Sequence…, browse to the folder, keep Sort names numerically ticked, and click OK.

ImageJ Image Sequence dialog with the DICOM series folder and Sort names numerically ticked
File › Import › Image Sequence: the folder with one series 1 and Sort names numerically 2, so that IM10 comes after IM9.

Step 4: Check the stack

The series opens as one window with a slider. The title shows the slice number and the file it came from. Image › Properties… shows the voxel size: here 0.7 × 0.7 × 2.5 mm, taken from the files, so Image › Stacks › Orthogonal Views and 3D tools have the right proportions.

ImageJ stack window with slice 6 of 12 of the DICOM series and its slider
The series as one stack: slice 6 of 12, from IM0006 1. Move through the slices with the slider 2 or the arrow keys.

If the slices come in the wrong order (files named by acquisition time, or several series mixed), check that the folder holds only one series, then sort by Image Number or Slice Location, which Show Info lists for each slice.

Step 5: Measure Hounsfield units

Draw an Oval in the tissue you want, choose Analyze › Set Measurements… (Area, Mean, Standard deviation, Min & max), and press M (Analyze › Measure). Because ImageJ applied the rescale values, Mean is in HU and Area in mm².

ImageJ slice with two oval ROIs and the Results table: 40.2 and -799.6
Two ovals on slice 6: soft tissue reads 40.2 HU, SD 8.0 1; the air-filled region -799.6 HU, SD 7.7 2. Each oval is 154.8 mm².

The phantom was written with 40 HU of soft tissue and -800 HU in the air-filled regions, with noise of 8 HU, which is what ImageJ reads back.

Why won't ImageJ open my compressed DICOM file?

Many scanners and PACS exports compress the pixel data (JPEG, JPEG 2000 or RLE). The DICOM reader built into ImageJ 1.x reads only uncompressed files, and says so:

ImageJ error: ImageJ cannot open compressed DICOM images. Transfer Syntax UID = 1.2.840.10008.1.2.5
Opening an RLE Lossless DICOM file in ImageJ 1.54f: ImageJ cannot open compressed DICOM images, with the Transfer Syntax UID 1.2.840.10008.1.2.5.

The Transfer Syntax UID tells you which compression it is:

Transfer Syntax UIDMeaningImageJ 1.x File › Open
1.2.840.10008.1.2Implicit VR Little Endian, uncompressedOpens
1.2.840.10008.1.2.1Explicit VR Little Endian, uncompressedOpens
1.2.840.10008.1.2.4.50JPEG baselineNo
1.2.840.10008.1.2.4.70JPEG losslessNo
1.2.840.10008.1.2.4.90 and .91JPEG 2000No
1.2.840.10008.1.2.5RLE losslessNo

In Fiji, open it with File › Import › Bio-Formats: the Bio-Formats DICOM reader handles uncompressed data, baseline JPEG, JPEG 2000 (lossy and lossless) and RLE lossless (Linkert et al. 2010). Choose View stack with: Hyperstack and tick Group files with similar names to open a series. If a file still does not open (for example JPEG lossless, which is not in that list), decompress it with a DICOM tool, such as dcmdjpeg from DCMTK or pydicom in Python, and open the result in ImageJ.

DICOM options worth knowing

Edit › Options › DICOM… changes how ImageJ 1.x opens DICOM:

  • Open as 32-bit float: the image is converted to real values (HU for CT) when it opens, instead of keeping the stored 16-bit values with a calibration.
  • Ignore rescale slope: uses the stored values without the slope.

To save the images for other software, use File › Save As › Tiff…. ImageJ 1.x cannot write DICOM. If the other program should see Hounsfield units, convert first with Image › Type › 32-bit: the stored 1067 becomes 43. A 16-bit TIFF keeps the stored values (HU + 1024 here), and only ImageJ knows the calibration.

Is ImageJ good for medical imaging?

For research, yes, within limits:

  • Good at: reading uncompressed DICOM, keeping pixel spacing and HU, ROI measurements on slices and stacks, projections, orthogonal views, macros for many files; Fiji adds Bio-Formats for compressed files, 3D viewing and segmentation plugins.
  • Not for: diagnosis or clinical reports (it is not certified medical software), connecting to a PACS, writing DICOM, or advanced volume rendering and registration, where dedicated research tools are better suited.

Pitfalls

  • Several series in one folder. A scout image or a second series ends up in the stack. One series per folder.
  • Compressed files. Check the Transfer Syntax UID in Show Info before you blame the file.
  • Raw values outside ImageJ. A 16-bit TIFF holds stored values; other software will not apply the rescale. Convert to 32-bit for real units.
  • Window changes are only display. Changing brightness and contrast (or the stored window) does not change measurements.
  • Uneven slice spacing. Gaps or overlapping slices make the voxel depth wrong; check Slice Location for every slice.
  • Patient data. DICOM headers carry names, dates and IDs. Anonymise before sharing, and do not post real headers.

Reporting it

DICOM images were opened in ImageJ [1.54f] (Schneider et al. 2012) as stacks (File › Import › Image Sequence; voxel size [0.7 × 0.7 × 2.5] mm from the headers). Mean attenuation was measured in [circular ROIs of 154.8 mm²] in [tissue] and reported in Hounsfield units.

Switch to LabCanvas: measure the exported TIFF

LabCanvas Image Analysis does not read DICOM. If your measurement is a simple one (areas, mean values, counts) on images you have exported as TIFF, it runs in the browser with nothing to install.

  1. In ImageJ, convert to 32-bit and File › Save As › Tiff…, so the file holds the real values.
  2. In LabCanvas, click Open an image and choose the TIFF; check the scale in the Image tab (set it with Scale if the pixel size did not come across).
  3. Draw ROIs and click Measure in the Measure tab (Area, Mean, StdDev, Min and Max).
  4. Send to Graphs to compare groups.
Image check in LabCanvas Image Analysis
Image check: All fine: nothing clipped brightest value 3,688, even illumination the background varies by 1.06×, sharpest at slice 8 of 15.

Why switch for this job:

  • No install, ImageJ's names for the measurements, on any computer.
  • An image check before you measure: clipping and the number of grey levels are flagged, so you notice an 8-bit export that lost the HU range.
  • Results straight to Graphs with statistics, and a methods sentence to copy.

For DICOM itself (opening series, headers, compressed files, 3D), ImageJ and Fiji are the right tools.

Open Image Analysis: free with a LabCanvas account (downloading files is part of LabCanvas Pro). ImageJ and Fiji are independent open-source projects; LabCanvas is not affiliated with them.

References

  • Linkert M, Rueden CT, Allan C, et al. (2010). Metadata matters: access to image data in the real world. Journal of Cell Biology 189, 777–782. doi:10.1083/jcb.201004104
  • Schindelin J, Arganda-Carreras I, Frise E, et al. (2012). Fiji: an open-source platform for biological-image analysis. Nature Methods 9, 676–682. doi:10.1038/nmeth.2019
  • Schneider CA, Rasband WS, Eliceiri KW (2012). NIH Image to ImageJ: 25 years of image analysis. Nature Methods 9, 671–675. doi:10.1038/nmeth.2089

Frequently asked questions

Can ImageJ open DICOM files?

Yes. File › Open (or drag and drop) opens uncompressed DICOM files in ImageJ 1.x and Fiji, with the pixel size in mm and the Rescale Slope and Intercept applied, so CT values read in Hounsfield units. File › Import › Image Sequence opens a folder of slices as one stack.

Why does ImageJ say it cannot open compressed DICOM images?

The built-in DICOM reader of ImageJ 1.x reads only uncompressed data. A JPEG, JPEG 2000 or RLE compressed file gives "ImageJ cannot open compressed DICOM images" with its Transfer Syntax UID. Open it in Fiji with File › Import › Bio-Formats, which reads baseline JPEG, JPEG 2000 and RLE lossless DICOM, or decompress it first with a DICOM tool.

Is ImageJ good for medical imaging?

For research, yes: it reads uncompressed DICOM, keeps the pixel spacing and Hounsfield calibration, measures ROIs and handles stacks, and Fiji adds 3D tools. It is not certified medical software, so it is not for diagnosis or clinical reporting, and it has no PACS connection or DICOM saving.

How do I see the DICOM header in ImageJ?

Image › Show Info (Ctrl I) lists every tag with its group and element number, name and value: patient fields, modality, pixel spacing, slice thickness, window centre and width, rescale values and the Transfer Syntax UID.

How do I open a DICOM series as a 3D stack?

Put the slices of one series in their own folder and use File › Import › Image Sequence with Sort names numerically ticked. ImageJ reads the slice spacing, so Image › Properties shows the voxel depth (2.5 mm in the example) and Orthogonal Views and 3D tools have the right proportions.

How do I export DICOM to TIFF?

Open the file or series, convert with Image › Type › 32-bit if you want the Hounsfield values themselves in the file (16-bit keeps the raw stored values), then File › Save As › Tiff. ImageJ 1.x cannot save DICOM.

ImageJ DICOMcompressed DICOM ImageJis ImageJ good for medical imagingopen DICOM seriesDICOM stackHounsfield unitsShow InfoBio-FormatsCTFiji

Try it in LabCanvas

Every app is free to start in your browser. Create an account and begin.

Start Image Analysis free in your browser