Purpose

The module ImageSave saves an image to a file using one of the following image file formats:

  • DICOM
  • TIFF
  • DICOM/TIFF
  • RAW
  • LUMISYS
  • PNM
  • Analyze
  • PNG
  • JPEG

Usage

In order to save an image to a file, specify the Filename (click the Browse button to select the output file using a save file dialog), the Format, enter an optional image Comment and click the Save button. The Status field indicates whether the image could be successfully stored. In case of an error, more detailed information is printed to the MeVisLab console. The filename extension of the output file is always chosen according to the selected file format (e.g. .dcm for DICOM files and .tif for TIFF files).

If the original source image is read from a DICOM file or a DICOM/TIFF pair, the Source name is filled in automatically. For other input formats, the Source Name field can be connected to the ImageLoad.filename field of the ImageLoad module.

NOTE that ImageSave does not create a directory on its own; make sure that the directory in which you want to save a file in already exists.

Details

The following image file formats are supported:

Format Description
DICOM Generates uncompressed 2D and 3D (single file) DICOM files.
TIFF Generates uncompressed 2D and 3D TIFF files.
DICOM/TIFF See explanation below.
RAW Generates raw binary data files with little endian byte order.
PNM Generates 2D PNM, PGM or PPM files.
Analyze Generates Analyze 7.5 files, consisting of a header file (*.hdr) and a raw binary data file (*.img). This format supports 2D, 3D and 4D images.
PNG The Portable Network Graphics (PNG) format supports 2D gray and RGB images up to 16 bit per sample, with or without alpha channel, with or without lossless compression.
JPEG The wide-spread JPEG standard supports 8-bit 2D gray and RGB images with lossy compression. Lossless compression, 12-bit and JPEG-2000 are not supported.
BMP The wide-spread Windows bitmap format supports 8-bit 2D RGB and palette images. Compressed BMP images are not supported.

Notes on the DICOM/TIFF format

In order to store 3D and 4D images efficiently, MeVisLab uses pairs of TIFF and DICOM image files. The two parts of a DICOM/TIFF are stored using the same path and file name with different extensions of .dcm and .tif, respectively. The TIFF file contains the image data, while the DICOM file contains all related information (e.g. patient, modality, acquisition details, image position and orientation, etc.).

The image datatypes int32, uint32 and float, which are supported by the TIFF format but not by DICOM, are handled by generating a DICOM header file for (u)int16 data. The TIFF file, however, contains the correct (u)int32 or float data. Thus, the DICOM file is not completely consistent with the properties of the stored image.

Windows

Default Panel

../../../Modules/ML/MLImageFile/mhelp/Images/Screenshots/ImageSave._default.png

Input Fields

The module has one input containing the image to be saved.

input0

name: input0, type: Image

Parameter Fields

Main Panel

The main panel provides the following elements:

Auto Filename section

In some cases it is desirable to automatically derive the output filename and location from the input filename used for reading the original source image (using the ImageLoad module at some other place in a MeVisLab network). This can be done using the fields in the Auto Filename section. When the Enable automatic filename checkbox is selected, the output filename is generated by removing the source name’s file extension, appending the string given in the Postfix field, and adding the appropriate file extension for the selected file format. If the original source image is read from a DICOM file or a DICOM/TIFF pair, the Source Name is filled in automatically. For other input formats, the Source Name can be connected from the Filename field of the ImageLoad module.

Options Panel

The Options panel shows additional options for the selected file format. The options shown depend on the currently selected format.

DICOM Section

When a DICOM image is saved, the contents of some DICOM tags are controlled by the fields in this section. In addition, the DICOM tags of an image can be viewed and modified using the DicomTagViewer and DicomTagModify modules.

DICOM/TIFF Section

JPEG Section

Visible Fields

Save In Background

name: startTask, type: Trigger

If pressed, the image file is being save in the backgroung.

This enables the user to interact with the GUI while the image is being saved.

Cancel

name: cancelTask, type: Trigger

If pressed, the saving of an image in the background is being canceled.

Status

name: status, type: String, persistent: no

Shows whether the image could successfully be stored.

In case of an error, more detailed information is printed to the MeVisLab console.

Filename

name: filename, type: String

Sets the file path to which the image is saved.

Click the Browse button to select a file path using a standard file dialog.

Save

name: save, type: Trigger

If pressed, the image is being saved.

Format

name: format, type: Enum, default: DICOMTIFF

Defines the image file format used.

The filename extension of the output file is always chosen according to the selected file format (e.g. .dcm for DICOM files and .tif for TIFF files).

Values:

Title Name Deprecated Name
Bmp BMP  
Tiff TIFF  
Quocmesh QUOCMESH  
Raw RAW  
Analyze Analyze  
Png PNG  
Jpg JPG  
Pnm PNM  
Dicom DICOM  
DICOM/TIFF DICOMTIFF DICOM/TIFF

Comment

name: comment, type: String, default: MeVisLab

Sets an optional image comment.

Allow Overwrite

name: allowOverwrite, type: Bool, default: TRUE

If checked, an existing file is overwritten without requesting permission.

Enable automatic filename

name: autoFilename, type: Bool, default: FALSE, deprecated name: appendToFilename

If checked, the file name is generated out of the input image’s file name.

Source Name

name: sourceName, type: String, deprecated name: inputFilename

Shows and sets the source file name.

This name is used for the automatic generation of the file name.

Postfix

name: postfix, type: String, default: .result1

Sets a postfix that is used for the automatic generation of the file name.

Create file meta header

name: dicomMetaHeader, type: Bool, default: TRUE

If checked, the target file is created with a DICOM meta header.

Derived/secondary image

name: dicomDerived, type: Bool, default: TRUE

If checked, certain DICOM tags in the target file are modified in order to indicate a so-called “derived” or “secondary” image.

This can be for example an image that has been obtained from an original image by some image processing (e.g. an MR image to which an image sharpening has been applied).

Derived Image Type Postfix

name: dicomDerivedImageType, type: String, default: OTHER\MEVISLAB

Postfix that is appended to the ImageType tag (DERIVEDSECONDARY+ postfix)

Discard Tags

name: dicomDiscardTags, type: Enum, default: FrameSpecific

Defines whether all or certain parts of the input DICOM tags are discarded.

Values:

Title Name Description
None None No tags are discarded.
All Private AllPrivate All private tags from the input DICOM tag list are discarded.
Frame Specific FrameSpecific This option stores the image without the special private tag containing the set of all frame specific tags of the original DICOM frame as they were imported into MeVisLab.

Store Time Info

name: dicomStoreTimeInfo, type: Enum, default: None

Defines whether the DICOM acquisition time and/or the DICOM content time are set to the time information available for the input image.

Notes on storing the time info:
  • The DICOM acquisition and content time tags can only store a single time value. For MeVisLab images with more than one time point (4D data), the value for the first time point is stored. Thus, this option makes most sense for 2D or 3D data.
  • Regardless of the Store Time Info setting, the complete time points information is always stored in private DICOM tags, provided that the Discard Tags option is not set to All Private.

Values:

Title Name Description
None None Time info is not stored in any of the standard DICOM tags (default).
Acquisition Time Acquisition Time info is stored in the DICOM tags Acquisition Date, Acquisition Time, and Acquisition Datetime.
Content Time Content Time info is stored in the DICOM tags Content Date and Content Datetime.
Acquisition & Content Time AcquisitionContent Time info is stored in both the acquistion and the content time tags.

Set window

name: dicomSetWindow, type: Bool, default: FALSE

If checked, the fields Center and Width specify the viewing window parameters stored in the DICOM file.

Otherwise these values are copied from the source image (if it contains corresponding DICOM tags).

Center

name: dicomWindowCenter, type: Integer, default: 0

Sets the center value for the Dicom windowing.

Width

name: dicomWindowWidth, type: Integer, default: 0

Sets the width value for the Dicom windowing.

Compression (tiffCompression)

name: tiffCompression, type: Enum, default: LZW

Defines the lossless compression method used for storing the image data in TIFF format.

Values:

Title Name Description
None None No compression is used.
Packbits Packbits The packbits algorithm is used for image data compression.
LZW LZW The LZW algorithm is used for image data compression.

Tile Width

name: tiffTileX, type: Integer, default: 128

Sets the width of the image data tiles stored in the TIFF file.

If the Auto options are enabled, the tile size is selected automatically.

Tile Height

name: tiffTileY, type: Integer, default: 128

Sets the height of the image data tiles stored in the TIFF file.

If the Auto options are enabled, the tile size is selected automatically.

Auto (tiffTileXAuto)

name: tiffTileXAuto, type: Bool, default: TRUE

If checked, the width of the tiles are set automatically.

Auto (tiffTileYAuto)

name: tiffTileYAuto, type: Bool, default: TRUE

If checked, the height of the tiles are set automatically.

Linear RGB

name: tiffLinearRGB, type: Bool, default: FALSE

If enabled, the saved Tiff contains a ICC color profile with gamma = 1, so that the stored RGB values are interpreted as linear values (instead of sRGB gamma 2.2).

Save DICOM header file only

name: saveDicomHeaderOnly, type: Bool, default: FALSE

If checked and the DICOM/TIFF format is selected, only the DICOM header file is saved.

This is, for example, useful for anonymization purposes to avoid rewriting of the image data.

Compression (pngCompression)

name: pngCompression, type: Enum, default: Default

Defines the lossless compression method used for storing the image datain PNG format.

Values:

Title Name
None None
Fastest Fastest
Best Best
Default Default

Interlaced

name: pngInterlaced, type: Bool, default: FALSE

If checked, the file is stored in interlaced mode, allowing some sort of progressive display, e.g. when viewed over slow Internet connections.

Quality

name: jpegQuality, type: Integer, default: 75, minimum: 0, maximum: 100

Sets the quality parameter used in the lossy compression of the image data.

Setting Quality to 100 results in the highest possible image quality and the largest file size, setting it to 0 results in the lowest possible image quality and the smallest file size.

Progressive

name: jpegProgressive, type: Bool, default: FALSE

If checked, the file is stored in progressive mode mode, allowing progressive display of the image, e.g. when viewed over slow Internet connections.

Hidden Fields

startTaskSynchronous

name: startTaskSynchronous, type: Trigger

taskVerboseLogging

name: taskVerboseLogging, type: Bool, default: FALSE

taskFinished

name: taskFinished, type: Trigger

taskCanceled

name: taskCanceled, type: Trigger

taskRunning

name: taskRunning, type: Bool, persistent: no

progress

name: progress, type: Float, persistent: no

addFileExtension

name: addFileExtension, type: Bool, default: TRUE

Enable to automatically add a filename extension to the output file according to the selected file format (e.g. .dcm for DICOM files and .tif for TIFF files). If off, the Filename is left as is.

dicomNameUsed

name: dicomNameUsed, type: Bool, default: TRUE

dicomIgnoreHalfVoxelShift

name: dicomIgnoreHalfVoxelShift, type: Bool, default: FALSE