HomeBlogAbout Me

Meta Image 1 6 100



META 2.0 stores are planned to be opening in various Canadian cities in 2019 and beyond. We look forward to serving you through our Friendly Guides. Stay tuned for future news about store rollouts by signing up for our newsletter. MetaImage 1.6.0 Multilingual macOS 26 mb MetaImage is the ultimate tool to read, write and edit images metadata. This is first editor that allows you to edit EXIF, IPTC and XMP t.

< ITK‎ | MetaIO
  • 2Introduction and Installation
    • 2.2Installing The MetaIO Package
    • 2.3Quick Start
    • 2.4MetaIO Library Architecture
      • 2.4.1MetaObjects
    • 2.5Types of MetaObjects
      • 2.5.1MetaBlob
      • 2.5.2MetaEllipse
      • 2.5.4MetaImage
      • 2.5.5MetaLandmark
      • 2.5.6MetaLine
      • 2.5.7MetaSurface
      • 2.5.8MetaTube
      • 2.5.9MetaScene
    • 2.7Reference: Tags of MetaImage

MetaImage is the text-based tagged file format for medical images that resulted. We have now extended that file format to support a variety of objects that occur in medicine such a tubes (for vessels, needles, etc.), blobs (for arbitrary shaped objects), cubes, spheres, etc. The complete library is known at MetaIO.

The central code of MetaImage/MetaIO is quite stable. MetaImage has been in use for several years by a wide range of research at UNC, Chapel Hill. New features are occasionally added, but backward compatibility will always be maintained.

Obtaining MetaIO

The upstream MetaIO Git repository:

Tipard mac video converter ultimate 9 1. MetaIO is being distributed with the following packages:

  • National Library of Medicine’s Insight Toolkit (ITK) for medical image segmentation and registration:
  • Kitware's Visualization Toolkit (VTK)

Installing The MetaIO Package

MetaIO is a hierarchy of C++ classes and functions. We have yet to find a modern C++ compiler that does not compile MetaIO. Know compatible compilers include G++ v2.95 and beyond (and probably previous), Microsoft Visual C++ 6.0, Sun’s CC on Solaris 2.6 and beyond, Intel compiler and compilers on other workstations including HPs, SGIs, and Alpha systems. Please contact us (Stephen R. Aylward, stephen.aylward@kitware.com or Julien Jomier, julien.jomier@kitware.com) if you encounter any incompatibilities between our code and your compiler.

MetaIO should be built as part of the standard ITK and VTK installations. It is also quite easy to use MetaIO from within these toolkits without using the rest of the toolkit.

ITK MetaIO

The hierarchy of the software in the stand-alone MetaIO package is as follows:

  • MetaIO/
    • doc/
    • tests/

The top level contains the source files, the header files, and the CMakeLists.txt file that is used by the CMake program to compile MetaIO. This document and the MetaObjects www pages are in the doc directory. A sequence of simple tests is available in the tests directory.

The hierarchy of the software in the Insight and InsightApplications distributions is as follows:

  • Insight
    • Code/Utilities/MetaIO/
      • doc/
      • tests/
  • InsightApplications
    • MetaImageImporter
    • ImageViewer (formerly MetaImageViewer)
    • ColorImageViewer (formerly MetaColorImageViewer)
    • MetaImageReadWrite

Routines that wrap MetaIO for ITK's image IO object factory are in

  • Insight/Code/IO/
    • itkMetaImageReader, itkMetaImageWriter

Routines that wrap MetaIO for reading and writing ITKS's Spatial Objects (tubes, blobs, ellipses, meshes, etc.) are in

  • Insight/Code/SpatialObject

Certain examples, such as the MetaImageViewer, also require FLTK (a cross-platform user interface library available from http://fltk.org). Install FLTK and then ITK and then InsightApplications to have every MetaIO example built. Numerous other examples and applications in InsightApplications also rely on FLTK.

See the file /Insight/Examples/MetaImageReadWrite for a working example on how to develop a program using MetaImage for IO.

VTK MetaIO

The hierarchy of the software in the Visualization toolkit is as follows:

  • VTK/Utilitites
    • vtkmetaio
  • VTK/IO

Stand Alone MetaIO

MetaIO can also be compiled outside of these toolkits. This is left as an exercise to the user (hint: requires the kwsys and zlib libraries). Instead of a stand-alone installation, we highly recommend using the distribution in ITK - if you build ITK, you get MetaIO for free!

Quick Start

Data conversion via MetaHeaders

This section assumes that you have data that you wish to process using an application that reads MetaImages. This section gives examples on how “convert” your data to the MetaImage format.

For uncompressed data, “conversion” to MetaImage is actually just a matter of specifying a MetaImage Headerfile (a “MetaHeader”) that describes and points to the file(s) containing your data.

  • Uncompressed data is data stored in a raw format, possibly with a header, as is often the case for DICOM, BMP, and PNG formatted images.

For compressed data, you must first convert your data to a non-compressed format. One of the most robust image conversion software packages is ImageMagick (http://www.imagemagick.org/; Unix and PC versions available). It has an application called “convert” that handles most of the popular 2D image formats.

  • Compressed data is includes JPEG or GIF formats as well as select PNG and TIFF images.

Using MetaImageImporter

MetaImageImporter asks a series of questions about your data and then produces a MetaImage header file that points to your data and allows the MetaIO library to read your data.

MetaImageImporter is part of the InsightApplications repository. See http://www.itk.org for information on downloading and installing InsightApplications - the companion to the Insight repository.

MetaImageImporter now has a QT graphical user interface. Please see the documentation.

String to sha256. Otherwise, the following two sub-sections will step you through the conversion process. The first sub-section applies if all of your data is in one file, i.e., is a 'brick-of-bytes'. The second sub-section applies if your data is spread across files, e.g., is dicom or a tiff sequence.

Reading a Brick-of-Bytes (an N-Dimensional volume in a single file)

A “brick of bytes” is a volume of image data stored in a single file possibly with preceding and trailing non-image data. A volume can be of any dimension (1 dimensional to N dimensional).

To correctly load these images, the minimal information that you need to know is:

  1. Number of dimensions
  2. Size of each dimension
  3. Data type
  4. Name of the data file

For example, let’s say the data was 3 dimensional, had 256 x 256 x 64 voxels, used an unsigned short to represent the value at each voxel, and was stored in the file “image.raw”. The resulting MetaHeader (our naming convention would call this file “image.mhd”) file would read

That’s it, but this assumes quite a bit about the image data. Specifically, it assumes

  1. There are not any non-image data bytes (header data) at the beginning of the image data file “image.raw”.
  2. The voxels are cubes – the distance spanned by and between a voxel in each coordinate direction is 1 “unit”, e.g., 1x1x1mm voxel size and voxel spacing
  3. The byte-order of the data in image.raw matches the byte ordering native to the machine the application is running on (e.g., PC’s use LSB ordering and Suns/Macs use MSB ordering).

Mac os office crack. If these assumptions are false, the data will not be loaded correctly by the application. To fix these problems, MetaIO allows you to specify additional tag/value pairs in the header:

  1. To skip the header bytes in the image data file, use

where X is the number of bytes to skip at the beginning of the file before reading image data. If you know there are no trailing bytes (extra bytes at the end of the file) you can specify

and MetaImage will automatically calculate the number of extract bytes in the data file, assume they those bytes are at the head of the data file, and automatically skip them before beginning to read the image data.

  1. To specify the spacing of the voxels, use

where X is the distance between of the centers of the voxels along the x-dimension, Y is the spacing in the y-dimension, and Z is the spacing in the z-dimension. Therefore, to specify a 1x1x3mm voxel spacing, use

NOTE: If ElementSpacing is not specified, it is assumed to be equal to ElementSize. If neither is specified, both are assumed to be 1.

  1. To specify a voxel size, use

where X Y Z represent the size in the x, y, and z-dimensions respectively.

NOTE: If ElementSize is not specified, it is assumed to be equal to ElementSpacing. If neither is specified, both are assumed to be 1.

  1. To specify a particular byte ordering, use

or

MSB (aka big-endian) ordering is common to SPARC and Motorola processors (e.g., Macintoshes). LSB (aka little-endian) ordering is common to Intel processors (e.g., PC compatibles).

Putting it all together, to “convert” a file containing the image data in a continuous block at the end of the file, specify the header

Reading DICOM and Other One-Slice-Per-File Data Formats

If the data is split into one slice per file, as is done with most DICOM object files, only the ElementDataFile tag’s option needs to change. Note that 3D DICOM object files are becoming popular, and some such DICOM files can be read using the above, volume, technique.

Since the MetaLibrary cannot directly parse DICOM headers, those headers must be skipped and the user must specify the image dimensions and other essential image information. For DICOM files, the MetaLibrary must automatically calculate the header size of each file (luckily for almost every DICOM object the image data is stored at the end of the file). For this reason, this method only works for uncompressed files.

To specify which files comprise the volume, they can be specified as an ordered list in the MetaHeader using the ElementDataFile=LIST option. The filenames should be listed at the end of the MetaHeader, after the ElementDataFile option, and the filenames should be separated by whitespace:

This method works even if there are spaces in the file paths and file names.

Notice that this method can become tedious if a large number of files need to be read. To alleviate this, a second way of specifying a series of files can be used if the filenames are numerically distinguished. That is, the file names should be able to be specified using a numeric substitution into a c-style printf-string, for a range of values. In pseudo-code:

The parameters of this system are numBegin, numEnd, numStep, and the c-style printf string (e.g., “baseName.%03d”). The begin, end, and step parameters appear in order after the c-style printf string:

The above MetaImage header will cause the files “baseName.001” to “baseName.100” to be read to create a 100-slice volume. This method works even if there are spaces in the file paths and file names. However, when spaces are present in the file path and/or file name, all three parameters (begin, end, and step) need to be specified as the last parameters. The remaining parameters (initially parsed based on spaces) are then joined back together (including spaces) to generate the file name.

In some cases, it may be helpful to skip slices in the volume. Changing the slice spacing and the ElementDataFileNumStep enacts this…

The complete set of MetaImage Tags are given in the Reference section of this document. The next section discusses how to use the MetaImage Library for image reading and writing in your own programs.

MetaIO Library Architecture

The base class of the MetaIO library is the MetaObject class. It defines a base set of tags that are common to all metaObjects such as MetaImages, MetaTubes, etc.

The tags are defined using the protected member functions SetupReadFields and SetupWriteFields. These functions create a list of MetaFieldRecords to define the name, type, interdependence, and necessity of each tag. Helper functions for defining the fields are in MetaUtils.cxx. The types are defined via enums in MetaTypes.h

The derived classes add tags to the list via their own SetupReadFields and SetupWriteFields member functions. The MetaImage subclass also re-implements the Read and Write methods since non tag data (i.e., the pixel values) must also be read. Compare the derived classes for MetaCube and MetaImage.

MetaObjects

In this section we describe the metaObjects which have been implemented already. If you want to implement other objects, you can easily derive these classes. metaObject is the base class for metaIO. metaScene and metaGroup are also a useful objects that support multiple metaObjects.All these objects are described in details next.

Constructors

Meta image 1 6 1000

Simple constructor

Meta Image 1 6 100 Mg

Read a metafile and store the result in the current object

Define the dimension of the object at construction time.

Member functions

Specify the filename to read (Optional)

Read a MetaFile

Write a MetaFile

Print the info about the metaObject

Clear the information as well as the data of the metObject

Field descriptions

Name:

Color:

ID:ID number of the current metaObject

Parent ID:ID number of the parent metaObject

Binary Data:Specify if the data is binary or not

Binary Data Byte Order:

Comments:

Object Typename and optional subtype (i.e. the type of the object)

Associated transformations

Physical location (in millimeters and with respect to machine coordinate system or the patient) of the first element in the image. Physical orientation of the object is defined as an NDims x NDims matrix.

Offset: (equiv. to position and origin)

Position: (equiv. to offset and origin)

Origin: (equiv. to offset and position)


Rotation: (equiv. to orientation and transformMatrix)

Meta Image 1 6 1000

Orientation: (equiv. to rotation and transformMatrix)

TransformMatrix: (equiv. to rotation and orientation)

Center of rotation of the object:

Anatomical Orientation:


Element Spacing:Physical Spacing (in same units as position)


For simplicity, some dynamic functions have been recently added. They allow the user to add fields dynamically.

The function AddUserField is defined by:

The user may also want to clear the fields created by using

To determine the value of a field

Note: When using GetUserField() function, the user is responsible for the deletion of the pointer created. See the following example for details.

Example

Types of MetaObjects

All of the following objects derive from metaObject.

MetaBlob

A blob is defined by a list of points that describe the object. The points can be inside the object (if obtained by connected-component for instance) or only on the surface. Note that a color (RGBA) can be associated which each point.

The required fields are:

  • The number of points defining the object:
  • How the position of the points is stored in the file. By default the configuration is x y z red green blue alpha

To access the internal list of points user should use the GetPoints() function which returns the internal list by reference. Note that the list is a list of pointers to point and is deleted automatically by the object itself so the user does not need to free the allocated memory.

Example

MetaEllipse

MetaEllipse is an N-Dimensional object to define ellipsoids like circles, spheres or even hyper-ellipsoids.

There are several ways to input the radius:

  1. As an array of floats: void Radius(const float* radius);
  2. As a single value which means that we are defining an hyper-sphere: void Radius(float radius);
  3. A convenient way to define a 2D ellipse: void Radius(float r1,float r2);
  4. A convenient way to define a 3D ellipse: void Radius(float r1,float r2, float r3);

Example

MetaGroup

MetaGroup does not have added functionalities compared to metaObject. It allows to group object in a metafile.

MetaImage

Constructors

Simple constructor by specifying the filename

Constructor by shared memory

Other constructors

Member functions

HeaderSize: Return the size of the header.

Quantity: Total number of elements in the image.

SubQuantity: Number of elements in image spanning sub-dimensions. E.g., elements per line, 2D sub-image, 3D sub-volume.

ElementMin/Max: The default max returned is the largest allowed by ElemNBytes (12 bit uint16_t will give 4096 max). This may not represent the true max. Use _reCalc=true to force a calcuation of the actual max element value.

ElementByteOrderSwap: These functions are available only after ReadImageData() or if _read_and_close=TRUE when read


ConverTo: Converts to a new data type. Rescales using Min and Max.

Field descriptions

Modality: Specify the modality of the image

Dimension size: Specify the size of the image in each dimension

SequenceID: DICOM designation of this image relative to other images acquired at the same time

ElementSize: Optional Field. Physical size (in MM) of each element in the image (0 = xSize, 1 = ySize, 2 = zSize)

ElementType: Pixel type

ElementNumberOfChannels: Number of channels

ElementData: Returns a pointer to the data.

ElementDataFileName: Set/Get the filename

Example

MetaLandmark

MetaLandmark is a simple list of landmarks. Estudio de tiempos y movimientos meyers pdf.

The number of landmarks defining the object is set using the function

How the position of the points is stored in the file: By default the configuration is x y z red green blue alpha

To access the internal list of points user should use the GetPoints() function which returns the internal list by reference. Note that the list is a list of pointers to point and is deleted automatically by the object itself so the user does not need to free the allocated memory.

Example

MetaLine

A metaLine is actually a polyline defined by a list of connected points.A point on the line has a given position, a normal and a color.

To set the position the local variable m_X should be filled in the point structure. The variable m_V which is a double pointer to a float is used to assess the normal. The normal has the dimension of the object minus one since a metaLine in a 3D space will have two normals (a plane).

Note that the user does not need to allocate the memory for those variables, this is done automatically in the constructor of the point.

To access the internal list of points user should use the GetPoints() function which returns the internal list by reference. Note that the list is a list of pointers to point and is deleted automatically by the object itself so the user does not need to free the allocated memory.

Example

Meta Image 1 6 100

MetaSurface

The definition of a metaSurface is quite similar to the metaLine’s, except for the normal which is only a NDim vector (i.e. an array of floats) where NDim is the dimension of the metaObject.

To access the internal list of points user should use the GetPoints() function which returns the internal list by reference. Note that the list is a list of pointers to point and is deleted automatically by the object itself so the user does not need to free the allocated memory.

Example

MetaTube

A metaTube is a tubular structure defined by a list of connected points (like a metaLine) but more fields have been added for a complete representation, especially the one of blood vessels.To specify a point that belongs to the tube, the user can define: the position, the radius at that point, the normal(s), the tangent, the color, the Identification number, the medialness, the branchness, the ridgeness, and three alpha values that represents the ratio of the eigen values at that points.

Note that metaTube supports only 2D and 3D tubes.

Also for a metaTube, the ID of the root can be specified by the command Root(int rootID) and the ID of the parent point can also be assessed using ParentPoint(int parentpoint).

To access the internal list of points user should use the GetPoints() function which returns the internal list by reference. Note that the list is a list of pointers to point and is deleted automatically by the object itself so the user does not need to free the allocated memory.

Example

MetaScene

A metaScene is a metaObject that contains a flat list of metaObjects.

Member functions

Add an object to the scene:

Return the number of objects in the scene:

Get a list of objects present in the scene:

Example

Output File Example

Here is the example of a metafile with a scene that contains metaObjects

Spatial Objects

MetaIO has also been chosen to support Spatial Objects IO. To obtain a complete documentation of Spatial Objects and how to read/write them out please see the Insight user’s manual available at www.itk.org.

Reference: Tags of MetaImage

MetaObject Tags

The tags of MetaObject are:

  • Comment
    • MET_STRING
    • User defined - arbitrary
  • ObjectType
    • MET_STRING
    • Defined by derived objects – e.g., Tube, Image
  • ObjectSubType
    • MET_STRING
    • Defined by derived objects – currently not used
  • TransformType
    • MET_STRING
    • Defined by derived objects – e.g., Rigid
  • NDims
    • MET_INT
    • Defined at object instantiation
  • Name
    • MET_STRING
    • User defined
  • ID
    • MET_INT
    • User defined else -1
  • ParentID
    • MET_INT
    • User defined else -1
  • BinaryData
    • MET_STRING
    • Are the data associated with this object stored at Binary or ASCII
    • Defined by derived objects
  • ElementByteOrderMSB
    • MET_STRING
  • BinaryDataByteOrderMSB
    • MET_STRING
  • Color
    • MET_FLOAT_ARRAY[4]
    • R, G, B, alpha (opacity)
  • Position
    • MET_FLOAT_ARRAY[NDims]
    • X, Y, Z,… of real-world coordinate of 0,0,0 index of image)
  • Orientation
    • MET_FLOAT_MATRIX[NDims][NDims]
    • [0][0],[0][1],[0][2] specify X, Y, Z… direction in real-world of X-axis of image
    • [1][0],[1][1],[1][2] specify X, Y, Z… direction in real-world of Y-axis of image, etc.
  • AnatomicalOrientation
    • MET_STRING
    • This is a convenience tag, to be used and maintained by applications. Changing this tag in a MetaIO file or via the MetaIO API will not cause the MetaIO library to resample or change the direction matrix of an image. It is up to an application to correctly read, write, and maintain this tag.
    • The history of the interpretation of this tag is as follows:
      • Labels: The labels used to define a space can be 'from' labels or 'to' labels, where 'from' labels define the relative physical location of the origin of a space and 'to' labels define the physical direction of movement of a space - thereby RAI 'from' space is the same as LPS 'to' space. DICOM, ITK, and nearly every application consider label space to be 'to' labels.
      • In an LPS 'to' space ('to' space will be assumed in the remainder of this discussion), when moving in the x,y,z-directions of space, then you are physically moving to the left.
      • The direction matrix specifies how 'index' i,j,k-directions (sometimes referred to as the in-memory directions of an image) map into x,y,z-directions. Changing the direction matrix will never change the fact that you're in an LPS space, but changing a direction matrix will change how moving along the i-index direction maps to a movement in the LPS space.
      • Originally, AnatomicalOrientation was intended to define the space (LPS, RAS, etc) of an image; however, in early 2000s, its implementation was changed (and its documentation became unclear) to define how a patient was oriented in index space (it assumed an LPS space, and thus it became redundant with the direction matrix). These changes seem to have coincided with ITK's introduction of a direction matrix (thanks goes to Alexis Girault for hunting down this history!). For the past fifteen years++, ITK writes AnatomicOrientation based on the direction matrix and assumes an LPS space. See the code in itkSpatialOrientation.h that specifies a 3-letter code derived from an image's direction matrix and that 3-letter code is then used to specify the AnatomicalOrientation tag in MetaIO.
      • Moving forward, when implementing new applications, it is recommended that developers use the definition currently implemented by ITK. It represents the most common use of MetaIO.
  • ElementSpacing
    • MET_FLOAT_ARRAY[NDims]
    • The distance between voxel centers

Tags Added by MetaImage

In addition to the above tags, MetaImage provides the following tags:

  • DimSize
    • MET_INT_ARRAY[NDims]
    • Number of elements per axis in data
  • HeaderSize
    • MET_INT
    • Number of Bytes to skip at the head of each data file.
    • Specify –1 to have MetaImage calculate the header size based on the assumption that the data occurs at the end of the file.
    • Specify 0 if the data occurs at the begining of the file.
  • Modality
    • MET_STRING
    • One of enum type: MET_MOD_CT, MET_MOD_MR, MET_MOD_US… See metaImageTypes.h
  • SequenceID
    • MET_INT_ARRAY[4]
    • Four values comprising a DICOM sequence: Study, Series, Image numbers
  • ElementMin
    • MET_FLOAT
    • Minimum value in the data
  • ElementMax
    • MET_FLOAT
    • Maximum value in the data
  • ElementNumberOfChannels
    • MET_INT
    • Number of values (of type ElementType) per voxel
  • ElementSize
    • MET_FLOAT_ARRAY[NDims]
    • Physical size of each voxel
  • ElementType
    • MET_STRING
    • One of enum type: MET_UCHAR, MET_CHAR… See metaTypes.h
  • ElementDataFile
    • MET_STRING
    • One of the following:
      • Name of the file to be loaded
      • A printf-style string followed by the min, max, and step values to be used to pass an argument to the string to create list of file names to be loaded (must be (N-1)D blocks of data per file).
      • LIST [X] – This specifies that starting on the next line is a list of files (one filename per line) in which the data is stored. Each file (by default) contains an (N-1)D block of data. If a second argument is given, its first character must be a number that specifies the dimension of the data in each file. For example ElementDataFile = LIST 2D means that there will be a 2D block of data per file.
      • LOCAL – Indicates that the data begins at the beginning of the next line.
Retrieved from 'https://itk.org/Wiki/index.php?title=ITK/MetaIO/Documentation&oldid=63999'




Meta Image 1 6 100
Back to posts
This post has no comments - be the first one!

UNDER MAINTENANCE

Polaroid