File and export operations


Read an image from disk


img open <filename>

?-query?.........Query user

?-foreignTo byte | int | float (float)?.........Convert foreign data type

?-cmode clip | scale | auto (scale)?.........Convert mode

?-keepA?.........Keep alpha channels

?-logEnable?.........Enable history log

?-subImage string?.........Sub-image in LIF or CZI file

?-subIndex string?.........Sub-index in LIF or CZI file (an index refering to the sub image)

?-tileIndex string?.........Tile index in LIF file (2nd level nesting sub image)

?-angleIndex string?.........Angle index in LIF file (2nd level nesting sub image)

?-series auto | off | query | tool (query)?.........Handle file series


Returns: name of the newly created image. This name is also a registered Tcl command through which all image processing functions can be accessed.

The auto clipping mode is intented for integer type images only. When -foreignTo is set to int and -cmode to clip, unsigned 16 bit TIFF files are scanned while being read, allowing the compute engine to rescale them only if it is really necessary to fit the signeFSd integer format internal to Huygens. This is the current behavior of Huygens Essential.

In case of a LIF or CZI file with multiple images, a single image from the file can be opened by specifying -subImage <subImageName>. A list of `subimages' in the file can be obtained by using the preOpen command.

Example:

img open /CDROM/examples/foo.ics

=>foo

If you have an image with values > 32767 then you can open the image in 16 bit signed while clipping the data:

img open myFile -foreignTo int -cmode clip

Some foreign image formats use data types which do not match any of the internal formats of the Huygens Pro. In these cases, currently the unsigned 16 bit integer TIFF and Biorad formats, conversion options can be specified. The default destination type is float. If the specified destination is signed 16 integer or unsigned 8 bit integer the data must be scaled or clipped. When the destination is signed 16 bit integer scaling is by a factor of 2; clipping is above 215-1. When the destination is unsigned byte scaling is by a factor of 28; clipping is above 28-1. The default is scale. Conversion options are ignored for other formats. To enable querying of the user a flag -query may be specified.

The img open supports many file types, among others HDF5, ICS, LSM, LIF, OME and TIFF. For a current list, see http://www.svi.nl/FileFormats.

Single one-directory TIFF images are read as 2D images, multi-directory TIFF images are read as a 3D image (or a 3D-time series if numbered files exist), numbered series or Leica-style series of single-directory TIFF images are read as 3D images. For a more detailed discussion see http://www.svi.nl/FileFormats.

The default behavior for this command is to try to spot file series and load all the files into a single multidimensional image. To prevent this and load a single image in a series use the option -series off.

Only if you use the HDF5 or ICS format all microscopic parameters necessary for image restoration will be saved.

Not always the name of the image created on the Tcl environment matches the file name (because it contains reserved characters, or because another image exists with that name, for example). It is always recommendable to `capture' the assigned name after opening:

set myname [img open /CDROM/examples/foo.ics]

and later use the variable $myname to refer to the image.

If the file name of an ICS or Imaris file contains the string `deleteMe' it is deleted after reading. ICS file pairs should have an `.ics' and `ids' suffix; Imaris files should have a suffix `.ims' or `.imrs' for this to work.

Check setp or getFormatInfo for more information about the image parameters.

Read image header and return image parameters as Tcl list


img preOpen <filename>


When used with Huygens HDF5 or ICS images, this command reads all image meta data from the file filename without loading the complete image data into memory.

When used with other HDF5, CZI, or LIF files, it returns a list of all the subimages in that file. This list is useful in combination with the -subImage option of the open command to access particular subimages in the file.

Note: The preOpen command is at this moment only applicable for images in HDF5, ICS, CZI, or LIF format.

Determine the image file type from the specified filename


img getFileType <filename>


Determine the file type associated with the specified filename. If no file type could be associated, or if the file does not exist, the string file-type-invalid is returned.

Save an image to disk


img save <filename>

?-type hdf5 | ics | imaris | tiff | tiff16 | tiffrgb | singletiff | ppm | ics2 | pic | ome | jpeg | r3d (hdf5)?.........File type

?-compr?.........Compression

?-tiffMultiDir?.........Export to a single multi-directory tiff file

?-cmode stretch | scale | clip | query (stretch)?.........Convert mode

?-q value (90)?.........Quality


Supported file formats



  • hdf5: Hierarchical Data Format
  • ics: Image Cytometry Standard (ICS) format.
  • ics2: Image Cytometry Standard (ICS) format, version 2.0. ICS 2.0 is an extension to the ICS-standard. It combines the header information and the raw data into a single 'ics-file'. Reading and writing ics2 type files is implemented starting from Huygens 2.4. The ics2 format is not yet fully developed. It is given here for the sake of completeness and is only accessible using -type ics2 save option.
  • imaris: Bitplane A.G. Imaris Classic format.
  • ppm: stores the first three channels of a 2D image in ppm format. Images with higher dimensionality are not supported.
  • OME: The Open Microscopy Environment (OME-XML) format
  • pic: Bio-Rad Confocal format.
  • r3d: The Delta Vision IMSubs format.
  • jpeg: JPEG format. Supported in Huygens Core only. Saves single channel images in gray scale and two or three channel images in RGB. Channel four and up are ignored. The quality level can be set from 0 to 100 percent using the -q option.
  • tiff, tiff16: If the image is 2D, or -tiffMultiDir was specified, a single channel image will be exported to a single tiff file. If -tiffMultiDir was specified multi-channel images will be exported to a RGB 8bit single tif file. Otherwise, the data will be exported to a suffixed series of single channel 8- or 16-bit TIFF files. A 29 plane time series of 10 frames with base name `Series08' will be saved as:

    Series08_t00_z000.tif
Series08_t00_z001.tif
...
Series08_t01_z000.tif
Series08_t01_z001.tif
...
Series08_t09_z027.tif
Series08_t09_z028.tif

For TIFF file formats, the option -cmode determines how the intensities are adapted in case a data type conversion is necessary:


    • stretch: The intensity range between zero and the maximum is stretched to keep the contrast. (If some negative intensity is in the image, it is clipped). This happens separately per channel. Use this mode for visualization purposes. This is the default option in silent mode.

    • scale: The non-negative intensities in the different channels are scaled proportionally (linked). The ratios between their intensities are preserved. The scaling factor is reported. Use this mode if further analysis is necessary.

    • clip: the numeric values are written directly to the destination without scaling. If the values are larger than the destination possible maximum, they are clipped. Use this mode carefully, taking care in your scripts of necessary preliminar conversions to avoid data losses.

    • query: In interative (non-silent) mode the user will be prompted to select one of the above.

      Even when a data conversion is not necessary (when a signed Integer Type image is saved to a unsigned 16 bit TIFF file) the -cmode option will control whether the data is multiplied by 2 to make use of the extra available bit (stretch) or written directly (clip). In any case only the positive values are saved. See http://www.svi.nl/TiffScaling for more details.

  • tiffrgb: the first 3 channels of a 2D-4D image in a series of RGB Tiff files . The numbering scheme is as follows:

    • 2D image: the image is saved without a numbering scheme.

    • 3D image: the numbering will be simple like: foo000.tif .. foo031.tif.

    • 4D image: the scheme outlined above is adopted.


The following cases will be saved as a single file:


    • 2D single and multi channel.
    • 3D single channel (XYZ, XYT).

In the following cases the image will be saved as a file series:


    • Multi channel stacks (XYZ) and multi channel 2D time series (XYT) will be exported to a series of files, in which every file holds the data of a single image. The files are denoted as : name01, name02 ...
    • 4D images (XYZT) will be exported to a series in which every file holds the data of a single stack. The series will look like: name00101, name00201,..., name00102, name 00202, ... in which the first three digits are the time point, and the last two are the channel number.


Please note that only three channels are imported and exported in this format.


Returns: path to the written file.

Note: .ics or .ids suffixes are stripped.

Save task reports


The output of the task report window can be saved by clicking Save task reports from the File menu in the Main window. The procedure can not be evoked by a Tcl command.

Save defaults


hu_saveDef


Alternative:

huOpt saved


Save the current default settings to file .huygensDefault in the user's home directory. This file is an ASCII text file and can be edited with a regular text editor like `emacs' or `vi'.

Setting and retrieving OME XML records


img ome <get|set>

?-xml string?.........XML string


Create an image


img create <new name>

?-type bin | byte | int | float | complex (float)?.........Basic data type

?-dim IndexVector (32 32 32 0)?.........Dimensions

?-chanspec stacked | packed (stacked)?.........Channel configuration

?-chan value (1)?.........Number of channels

?-undoEnable?.........Enable undo

?-logEnable?.........Enable history log


Returns: name of newly created image.

The newly created image is available for all image operations but is not yet visible as a thumbnail. If you prefer to keep your eye on it you have to add the `show' operation to make a thumbnail image:

imagename show