Classes | Typedefs | Enumerations | Enumerator | Functions | Variables

cmtkIO Library

This library provides classes for input and output of images, transformations, and other types of objects. More...

Classes

class  cmtk::ClassStream
 Class for writing and reading various library classes to and from disk. More...
class  cmtk::ClassStreamStudyList
 StudyList with class stream file system interface. More...
class  cmtk::DICOM
 Reader/writer class for DICOM images. More...
struct  cmtk::FileFormatMagic
 Structure that holds information on magic file number. More...
class  cmtk::FileFormat
 Identify file (and directory) formats. More...
class  cmtk::FileHeader
 Access to fields in a binary file header. More...
class  cmtk::PGM
 Reader/writer class for PGM (portable graymap) files. More...
class  cmtk::ResourceFile
 Resource file is a map of sections accessed by section title. More...
class  cmtk::ScalarImageIO
 Read and write scalar 2d images. More...
class  cmtk::SQLite
 Wrapper class for SQLite database. More...
class  cmtk::Study
 Class for parameters of a general imaging study. More...
class  cmtk::StudyImageSet
 An imaging study that is constructed from multiple 2-D images. More...
class  cmtk::StudyList
class  cmtk::TypedStream
 Class for reading and writing og "typedstream" archives. More...
class  cmtk::TypedStreamStudylist
 Studylist with typedstream file system interface. More...
class  cmtk::VolumeFromFile
 Class to read uniform volume from disk file(s). More...
struct  cmtk::FileHeaderBioRad
 BioRad microscopy image file header. More...
class  cmtk::VolumeFromSlices
 Class for building 3D fields from slice image data. More...
class  cmtk::VolumeFromStudy
 Class for building 3D volumes from an Study object. More...
class  cmtk::VolumeIO
 Class for input/output of 3-D image data. More...
class  cmtk::XformIO
 Utility class for one-stop transformation import. More...
class  cmtk::XformListIO
 Utility class to generate a list of concatenated transformation objects. More...

Typedefs

typedef std::list< std::string > cmtk::ResourceSection
 Resource file section is a list of strings.
typedef std::multimap
< Study::SmartPtr,
Xform::SmartPtr > 
cmtk::StudyToXform
typedef std::map
< Study::SmartPtr,
StudyToXform > 
cmtk::StudyToStudyToXform

Enumerations

enum  cmtk::AnalyzeDataType {
  cmtk::ANALYZE_TYPE_NONE = 0, cmtk::ANALYZE_TYPE_BINARY = 1, cmtk::ANALYZE_TYPE_UNSIGNED_CHAR = 2, cmtk::ANALYZE_TYPE_SIGNED_SHORT = 4,
  cmtk::ANALYZE_TYPE_SIGNED_INT = 8, cmtk::ANALYZE_TYPE_FLOAT = 16, cmtk::ANALYZE_TYPE_COMPLEX = 32, cmtk::ANALYZE_TYPE_DOUBLE = 64,
  cmtk::ANALYZE_TYPE_RGB = 128, cmtk::ANALYZE_TYPE_USHORT = 132, cmtk::ANALYZE_TYPE_UINT = 136, cmtk::ANALYZE_TYPE_ALL = 255
}
 

IDs for data types in Analyze image file.

More...
enum  cmtk::AnalyzeOrientation {
  cmtk::ANALYZE_AXIAL = 0, cmtk::ANALYZE_CORONAL = 1, cmtk::ANALYZE_SAGITTAL = 2, cmtk::ANALYZE_AXIAL_FLIP = 3,
  cmtk::ANALYZE_CORONAL_FLIP = 4, cmtk::ANALYZE_SAGITTAL_FLIP = 5, cmtk::ANALYZE_UNKNOWN = 255
}
 

IDs for slice orientations in Analyze image file.

More...
enum  cmtk::FileFormatID {
  cmtk::FILEFORMAT_NEXIST = 0, cmtk::FILEFORMAT_COMPRESSED_ARCHIVE = 1, cmtk::FILEFORMAT_STUDY = 2, cmtk::FILEFORMAT_STUDYLIST = 3,
  cmtk::FILEFORMAT_TYPEDSTREAM = 4, cmtk::FILEFORMAT_PGM = 5, cmtk::FILEFORMAT_DICOM = 6, cmtk::FILEFORMAT_VANDERBILT = 7,
  cmtk::FILEFORMAT_AMIRA = 8, cmtk::FILEFORMAT_RAW = 9, cmtk::FILEFORMAT_RAW3D = 10, cmtk::FILEFORMAT_BIORAD = 11,
  cmtk::FILEFORMAT_NIFTI_DETACHED = 12, cmtk::FILEFORMAT_NIFTI_SINGLEFILE = 13, cmtk::FILEFORMAT_ANALYZE_AVW = 14, cmtk::FILEFORMAT_METAIMAGE = 15,
  cmtk::FILEFORMAT_NRRD = 16, cmtk::FILEFORMAT_ANALYZE_HDR = 17, cmtk::FILEFORMAT_ANALYZE_HDR_BIGENDIAN = 18, cmtk::FILEFORMAT_ITK_TFM = 19,
  cmtk::FILEFORMAT_UNKNOWN
}
 

ID codes for known file formats.

More...
enum  {
  cmtk::PALETTE_GRAY = 0, cmtk::PALETTE_RED = 1, cmtk::PALETTE_GREEN = 2, cmtk::PALETTE_BLUE = 3,
  cmtk::PALETTE_RAINBOW = 4, cmtk::PALETTE_LABELS = 5
}
 

Constants to identify color table.

More...

Functions

ClassStream & cmtk::operator<< (ClassStream &stream, const AffineXform &affineXform)
 Write affine transformation object.
ClassStream & cmtk::operator>> (ClassStream &stream, AffineXform::SmartPtr &affineXform)
 Read affine transformation.
ClassStream & cmtk::operator>> (ClassStream &stream, AffineXform &affineXform)
 Read affine transformation.
template<class TMetricFunctionalType >
ClassStream & cmtk::operator<< (ClassStream &stream, const AffineMultiChannelRegistrationFunctional< TMetricFunctionalType > &functional)
 Write file names and transformations from affine multi-channel registration functional.
template<class TMetricFunctionalType >
ClassStream & cmtk::operator>> (ClassStream &stream, AffineMultiChannelRegistrationFunctional< TMetricFunctionalType > &functional)
 Read file names and transformations from archive to multi-channel affine registration functional.
template<class TMetricFunctionalType >
ClassStream & cmtk::operator<< (ClassStream &stream, const SplineWarpMultiChannelRegistrationFunctional< TMetricFunctionalType > &functional)
 Write file names and transformations from spline warp multi-channel registration functional.
ClassStream & cmtk::operator<< (ClassStream &stream, const Xform &xform)
 Write transformation object.
ClassStream & cmtk::operator<< (ClassStream &stream, const GroupwiseRegistrationFunctionalBase &func)
ClassStream & cmtk::operator>> (ClassStream &stream, GroupwiseRegistrationFunctionalBase &func)
std::istream & cmtk::operator>> (std::istream &stream, SegmentationLabelMap &lblMap)
 Operator to read a list of label IDs from a C++ stream.
 cmtk::TypedStream::TypedStream (const char *filename, const TypedStreamMode mode)
 Open constructor.
 cmtk::TypedStream::TypedStream (const char *dir, const char *archive, const TypedStreamMode mode)
 Open constructor for separate path and archive names.
virtual cmtk::TypedStream::~TypedStream ()
 Destructor.
void cmtk::TypedStream::Open (const char *filename, const TypedStreamMode mode)
 Open another archive without constructing a new object.
void cmtk::TypedStream::Open (const char *dir, const char *archive, const TypedStreamMode mode)
 Open another archive in explicit directory.
void cmtk::TypedStream::Close ()
 Close an open archive.
TypedStreamCondition cmtk::TypedStream::Seek (const char *section, const bool forward=false)
 Move to a particular section in the open archive.
TypedStreamCondition cmtk::TypedStream::Rewind ()
 Rewind archive.
int cmtk::TypedStream::IsValid ()
 Return validity of archive.
TypedStreamStatus cmtk::TypedStream::GetStatus () const
 Return status of last operation.
TypedStreamCondition cmtk::TypedStream::Begin (const char *section=NULL)
 Begin a section.
TypedStreamCondition cmtk::TypedStream::End (const bool flush=false)
 End a section.
bool cmtk::TypedStream::ReadBool (const char *key, const bool defaultValue=false, const bool forward=false)
 Read boolean value from an open archive.
TypedStreamCondition cmtk::TypedStream::ReadBoolArray (const char *key, byte *const array, const int size, const bool forward=false)
 Read array of boole values from an open archive.
int cmtk::TypedStream::ReadInt (const char *key, const int defaultValue=0, const bool forward=false)
 Read integer value from an open archive.
TypedStreamCondition cmtk::TypedStream::ReadIntArray (const char *key, int *const array, const int size, const bool forward=false)
 Read array of integer values from an open archive.
float cmtk::TypedStream::ReadFloat (const char *key, const float defaultValue=0, const bool forward=false)
 Read single-precision value from an open archive.
TypedStreamCondition cmtk::TypedStream::ReadFloatArray (const char *key, float *const array, const int size, const bool forward=false)
 Read array of single-precision values from an open archive.
double cmtk::TypedStream::ReadDouble (const char *key, const double defaultValue=0, const bool forward=false)
 Read double-precision value from an open archive.
TypedStreamCondition cmtk::TypedStream::ReadDoubleArray (const char *key, double *const array, const int size, const bool forward=false)
 Read array of double-precision values from an open archive.
Types::Coordinate cmtk::TypedStream::ReadCoordinate (const char *key, const Types::Coordinate defaultValue=0, const bool forward=false)
 Read double- or single precision value from an open archive.
Types::DataItem cmtk::TypedStream::ReadItem (const char *key, const Types::DataItem defaultValue=0, const bool forward=false)
 Read double- or single precision value from an open archive.
TypedStreamCondition cmtk::TypedStream::ReadCoordinateArray (const char *key, Types::Coordinate *const array, const int size, const bool forward=false)
 Read array of double- or single precision values from an open archive.
TypedStreamCondition cmtk::TypedStream::ReadItemArray (const char *key, Types::DataItem *const array, const int size, const bool forward=false)
 Read array of double- or single precision values from an open archive.
char * cmtk::TypedStream::ReadString (const char *key, const char *defaultValue=NULL, const bool forward=false)
 Read null-terminated string from an open archive.
TypedStreamCondition cmtk::TypedStream::WriteBool (const char *key, const bool value)
 Write a boolean value to an open archive.
TypedStreamCondition cmtk::TypedStream::WriteInt (const char *key, const int value)
 Write an integer value to an open archive.
TypedStreamCondition cmtk::TypedStream::WriteFloat (const char *key, const float value)
 Write a float value to an open archive.
TypedStreamCondition cmtk::TypedStream::WriteDouble (const char *key, const double value)
 Write a double precision float value to an open archive.
TypedStreamCondition cmtk::TypedStream::WriteCoordinate (const char *key, const Types::Coordinate value)
 Write an Types::Coordinate value to an open archive.
TypedStreamCondition cmtk::TypedStream::WriteItem (const char *key, const Types::DataItem value)
 Write an Types::DataItem value to an open archive.
TypedStreamCondition cmtk::TypedStream::WriteString (const char *key, const char *value)
 Write a string to an open archive.
TypedStreamCondition cmtk::TypedStream::WriteString (const char *key, const std::string &value)
 Write a string to an open archive.
TypedStreamCondition cmtk::TypedStream::WriteComment (const char *fmt,...)
 Write a formated comment to an open archive.
TypedStreamCondition cmtk::TypedStream::WriteComment (const int argc, const char *argv[])
 Write string array as comment to an open archive.
TypedStreamCondition cmtk::TypedStream::WriteComment (int argc, char *argv[])
 Write string array as comment to an open archive.
TypedStreamCondition cmtk::TypedStream::WriteIntArray (const char *key, const int *array, const int size, const int valuesPerLine=10)
 Write array of integer values to an open archive.
TypedStreamCondition cmtk::TypedStream::WriteBoolArray (const char *key, const byte *array, const int size, const int valuesPerLine=10)
 Write array of binay encoded boole values to an open archive.
TypedStreamCondition cmtk::TypedStream::WriteFloatArray (const char *key, const float *array, const int size, const int valuesPerLine=10)
 Write array of single-precision values to an open archive.
TypedStreamCondition cmtk::TypedStream::WriteDoubleArray (const char *key, const double *array, const int size, const int valuesPerLine=10)
 Write array of double-precision values to an open archive.
TypedStreamCondition cmtk::TypedStream::WriteCoordinateArray (const char *key, const Types::Coordinate *array, const int size, const int valuesPerLine=10)
 Write array of double- or single precision values to an open archive.
TypedStreamCondition cmtk::TypedStream::WriteItemArray (const char *key, const Types::DataItem *array, const int size, const int valuesPerLine=10)
 Write array of double- or single precision values to an open archive.
void cmtk::TypedStream::SetDebugFlag (const TypedStreamDebugFlag debugFlag=TYPEDSTREAM_DEBUG_ON)
 Set debugging flag.
void cmtk::TypedStream::InitInternals ()
 Initialize internal data structures.
TypedStreamCondition cmtk::TypedStream::GenericReadArray (const char *key, const int type, void *const array, const int arraySize, const bool forward=false)
 Utility function: Read an array of arbitrary type.
TypedStreamToken cmtk::TypedStream::ReadLineToken ()
 Read the next archive line to the buffer.
static int cmtk::TypedStream::StringCmp (const char *s1, const char *s2)
 Compare two strings.
char * cmtk::TypedStream::StringSplit (char *s1) const
 Separate next token.
static const char * cmtk::TypedStream::GetTypedStreamIdent ()
 Return the identifier for the generated archive format (version).
void cmtk::TypedStream::DebugOutput (const char *format,...)
 Output diagnostic message if debug flag is set.
ClassStream & cmtk::ClassStream::operator<< (const LandmarkList *landmarkList)
 Write landmark list.
ClassStream & cmtk::ClassStream::operator>> (WarpXform::SmartPtr &warpXform)
 Read (spline or linear) warp transformation.
ClassStream & cmtk::ClassStream::operator>> (ParametricPlane *&parametricPlane)
 Read parametric plane.
ClassStream & cmtk::ClassStream::operator<< (const ParametricPlane *parametricPlane)
 Write parametric plane object.
static StudyList * cmtk::ClassStreamStudyList::Read (const char *path)
 Read studylist.
static StudyList * cmtk::ClassStreamStudyList::Merge (const StudyList &studyList, const char *path)
 Merge with duplicated studylist.
static StudyList * cmtk::ClassStreamStudyList::Merge (StudyList *const studyList, const char *path)
 Merge studylist in place.
static void cmtk::ClassStreamStudyList::Write (const char *path, const StudyList *studyList)
 Write studylist.
ClassStream & cmtk::ClassStream::operator<< (const WarpXform *warpXform)
 Write generic transformation object.
ClassStream & cmtk::ClassStream::PutWarp (const WarpXform *warpXform)
 Write actual warp transformation object.
ClassStream & cmtk::ClassStream::Get (WarpXform::SmartPtr &warpXform, const AffineXform *affineXform=NULL)
 Actually read warp transformation object.
ClassStream & cmtk::ClassStream::Get (WarpXform *&warpXform, const AffineXform *affineXform=NULL)
 Actually read warp transformation object.
ClassStream & cmtk::ClassStream::operator>> (WarpXform *&warpXform)
 Read (spline or linear) warp transformation.
static ScalarImage * cmtk::DICOM::Read (const char *path)
 Read ScalarImage from DICOM file.
static FileFormatID cmtk::FileFormat::Identify (const char *path, const bool decompress=true)
 Identify file or directory with given path.
static FileFormatID cmtk::FileFormat::GetID (const char *name)
 Return ID for given file format name.
static const char * cmtk::FileFormat::Describe (const FileFormatID id)
 Return textual description of identified file format.
static FileFormatID cmtk::FileFormat::IdentifyDirectory (const char *path)
 Identify directory with given path.
static FileFormatID cmtk::FileFormat::IdentifyFile (const char *path, const bool decompress=true)
 Identify regular file with given path.
static ScalarImage * cmtk::PGM::Read (const char *)
 Read image from PGM file directly.
static void cmtk::PGM::Write (const char *filename, const ScalarImage *image, const Types::DataItem greyFrom, const Types::DataItem greyTo)
 Write scalar image to PGM file.
static void cmtk::PGM::Write16bit (const char *filename, const ScalarImage *image, const Types::DataItem greyFrom=0, const Types::DataItem greyTo=65535)
 Write scalar image to 16bit PGM file.
void cmtk::ResourceFile::Read (const char *fileName)
 Read from resource file.
void cmtk::ResourceFile::Write (const char *fileName) const
 Write to resource file.
unsigned int cmtk::ResourceFile::AddUnique (const char *section, const char *entry, const unsigned int maxItems=0)
 Add a unique (non-duplicate) string to resource section.
static ScalarImage * cmtk::ScalarImageIO::ReadAnalyze (const char *)
 Read image from Analyze file.
static void cmtk::ScalarImageIO::WriteAnalyze (const char *filename, const ScalarImage *image)
 Write scalar image to Analyze file.
 cmtk::Study::Study ()
 Default constructor.
 cmtk::Study::Study (const char *fileSystemPath, const char *name=NULL)
 Constructor: Construct study from image file.
virtual void cmtk::Study::UpdateFromVolume ()
 Update from volume data, possibly after the data has been changed.
const char * cmtk::Study::SetMakeName (const char *name=NULL, const int suffix=0)
 Set study name; create name if no name given.
virtual cmtk::Study::~Study ()
 Destructor.
virtual bool cmtk::Study::ReadVolume (const bool reRead=false, const char *orientation=NULL)
 Read volume data.
static Study * cmtk::Study::Read (const char *path)
 Static study reader function.
virtual void cmtk::Study::CopyColormap (const Study *other)
 Copy colormap information from another study object.
const Study * cmtk::StudyList::GetStudy (const unsigned int studyIndex) const
 Get constant Study object by index.
Study::SmartPtr cmtk::StudyList::GetStudy (const unsigned int studyIndex)
 Get non-constant Study object by index.
const Study * cmtk::StudyList::FindStudyPath (const char *fileSystemPath) const
 Find constant Study object by file system path.
Study::SmartPtr cmtk::StudyList::FindStudyPath (const char *fileSystemPath, const bool create=false)
 Find non-constant Study object by file system path.
const Study * cmtk::StudyList::FindStudyName (const char *name) const
 Find constant Study object by file system path.
Study::SmartPtr cmtk::StudyList::FindStudyName (const char *name)
 Find non-constant Study object by file system path.
Study::SmartPtr cmtk::StudyList::AddStudy (const char *fileSystemPath)
 Add a new study entry.
void cmtk::StudyList::AddStudy (Study::SmartPtr &study)
 Add an existing study object.
void cmtk::StudyList::AddXform (const char *fromStudyPath, const char *toStudyPath, AffineXform::SmartPtr &affineXform, WarpXform::SmartPtr &warpXform=WarpXform::SmartPtr::Null)
 Add a coordinate transformation between two studies.
void cmtk::StudyList::AddXform (Study::SmartPtr &fromStudy, Study::SmartPtr &toStudy, AffineXform::SmartPtr &affineXform, WarpXform::SmartPtr &warpXform=WarpXform::SmartPtr::Null)
 Add a coordinate transformation between two studies.
void cmtk::StudyList::DeleteStudy (const Study *study)
 Remove and delete given study object.
 cmtk::TypedStream::TypedStream ()
 Default constructor.
 cmtk::TypedStreamStudylist::TypedStreamStudylist ()
 Default conctructor.
void cmtk::TypedStreamStudylist::Clear ()
 Initialize all internal data structures.
 cmtk::TypedStreamStudylist::~TypedStreamStudylist ()
 Destructor.
bool cmtk::TypedStreamStudylist::Read (const char *studylistpath)
 Read object from disk.
static void cmtk::TypedStreamStudylist::Write (const char *path, const char *referenceStudy, const char *floatingStudy, const Xform *xform)
 Create studylist archive.
static const
UniformVolume::SmartPtr 
cmtk::VolumeFromFile::Read (const char *filename)
 Read volume from file automatically.
static const
UniformVolume::SmartPtr 
cmtk::VolumeFromFile::ReadAnalyzeHdr (const char *pathHdr, const bool bigEndian=false, const bool readData=true)
 Read Analyze 7.5 file (separate header file).
static void cmtk::VolumeFromFile::WriteAnalyzeHdr (const char *pathHdr, const UniformVolume &volume, const bool verbose=false)
 Write Analyze 7.5 file (separate header file).
static const
UniformVolume::SmartPtr 
cmtk::VolumeFromFile::ReadBioRad (const char *path)
 Read BioRad PIC file (confocal microscopy image).
static void cmtk::VolumeFromFile::WriteMetaImage (const char *pathHdr, const UniformVolume &volume)
 Write MetaImage file.
static const
UniformVolume::SmartPtr 
cmtk::VolumeFromFile::ReadNifti (const char *pathHdr, const bool detached, const bool readData=true)
 Read Nifti file.
static void cmtk::VolumeFromFile::WriteNifti (const char *pathImg, const UniformVolume &volume, const bool verbose=false)
 Write Nifti file.
void cmtk::VolumeFromSlices::InitSequence (const ScalarImage *image, const unsigned int numberOfSlices)
 Start creation of new volume.
virtual char * cmtk::VolumeFromSlices::AllocDataArray (const int bytesperpixel, const int data_size) const
 Allocate memory for the 3D image data.
virtual TypedArray::SmartPtr cmtk::VolumeFromSlices::EncapDataArray (const ScalarDataType dtype, void *const data, const int data_size) const
 Put image data into a custom data structure.
const char * cmtk::VolumeFromSlices::FillPlane (unsigned int &plane, const ScalarImage *image)
 Copy one slice of data into field.
UniformVolume::SmartPtr cmtk::VolumeFromSlices::FinishVolume (Types::Coordinate &sliceOffset, int &sliceDirection)
 Finish volume creation and free temporary storage.
const char * cmtk::VolumeFromSlices::CheckImage (const int plane, const ScalarImage *image, const unsigned int frame=0)
 Check image consistency.
virtual UniformVolume::SmartPtr cmtk::VolumeFromSlices::ConstructVolume (const DataGrid::IndexType &Dims, const UniformVolume::CoordinateVectorType &Size, const Types::Coordinate *Points[3], TypedArray::SmartPtr &Data) const
 Construct Volume object.
static const
UniformVolume::SmartPtr 
cmtk::VolumeFromStudy::Read (const Study *study, const bool verbose=false)
 Read from generic Study object.
virtual const
UniformVolume::SmartPtr 
cmtk::VolumeFromStudy::AssembleVolume (const StudyImageSet *study, const bool verbose=false)
 Build volume from slice images.
static UniformVolume::SmartPtr cmtk::VolumeIO::Read (const char *path, const bool verbose=false)
 Read volume data from filesystem.
static UniformVolume::SmartPtr cmtk::VolumeIO::ReadGrid (const char *path, const bool verbose=false)
 Read grid only from filesystem.
static UniformVolume::SmartPtr cmtk::VolumeIO::ReadGridOriented (const char *path, const char *orientation, const bool verbose=false)
 Read grid only from filesystem and bring into standard "RAS" orientation.
static UniformVolume::SmartPtr cmtk::VolumeIO::ReadOriented (const char *path, const char *orientation, const bool verbose=false)
 Read image from filesystem and reorient to align anatomy with coordinate axes.
static void cmtk::VolumeIO::Write (const UniformVolume &volume, const char *pathAndFormat, const bool verbose=false)
 Write volume data to filesystem with automatic format parsing.
static void cmtk::VolumeIO::Write (const UniformVolume &volume, const FileFormatID format, const char *path, const bool verbose=false)
 Write volume data to filesystem.
 cmtk::VolumeIO::Initializer::Initializer ()
 Default constructor: initialize VolumeIO settings.
static Xform::SmartPtr cmtk::XformIO::Read (const char *path, const bool verbose=false)
 Read transformation from filesystem.
static void cmtk::XformIO::Write (const Xform *xform, const char *path, const bool verbose=false)
 Write transformation to filesystem.

Variables

const char * cmtk::FileFormatMagic::magicString
 Magic number as string of characters.
const size_t cmtk::FileFormatMagic::magicStringLength
 Length of magic number string (necessary due to Null characters).
const FileFormatMagic cmtk::FileFormatMagicNumbers []
 Magic number records for known file types.
const char * cmtk::FileFormatName []
 Table of file format ID names.
FILE * cmtk::TypedStream::File
 Pointer to the actual file.
gzFile cmtk::TypedStream::GzFile
 Pointer to the compressed file in decompression mode.
TypedStreamMode cmtk::TypedStream::Mode
 Mode the current archive was opened with.
TypedStreamStatus cmtk::TypedStream::Status
 Holds the status of the last operation.
int cmtk::TypedStream::PrecisionFloat
 Number of significant digits for "float" fields.
int cmtk::TypedStream::PrecisionDouble
 Number of significant digits for "double" fields.
char cmtk::TypedStream::Buffer [TYPEDSTREAM_LIMIT_BUFFER]
 Buffer for the current line read from the archive.
char * cmtk::TypedStream::BufferKey
 Pointer to the "key" part of the line currently in Buffer.
char * cmtk::TypedStream::BufferValue
 Pointer to the "value" part of the line currently in Buffer.
std::stack< int > cmtk::TypedStream::LevelStack
 Stack of open section levels.
char * cmtk::TypedStream::SplitPosition
 Internal position pointer for "StringSplit()".
TypedStreamDebugFlag cmtk::TypedStream::DebugFlag
 Debug flag.
unsigned short cmtk::FileHeaderBioRad::ny
short cmtk::FileHeaderBioRad::npic
short cmtk::FileHeaderBioRad::ramp1_min
short cmtk::FileHeaderBioRad::ramp1_max
int cmtk::FileHeaderBioRad::notes
short cmtk::FileHeaderBioRad::byte_format
unsigned short cmtk::FileHeaderBioRad::n
char cmtk::FileHeaderBioRad::name [32]
short cmtk::FileHeaderBioRad::merged
unsigned short cmtk::FileHeaderBioRad::color1
unsigned short cmtk::FileHeaderBioRad::file_id
short cmtk::FileHeaderBioRad::ramp2_min
short cmtk::FileHeaderBioRad::ramp2_max
unsigned short cmtk::FileHeaderBioRad::color2
short cmtk::FileHeaderBioRad::edited
short cmtk::FileHeaderBioRad::lens
float cmtk::FileHeaderBioRad::mag_factor
unsigned short cmtk::FileHeaderBioRad::dummy [3]
const char *const cmtk::CMTK_LEGACY_WRITE_IMAGES_RAS = "CMTK_LEGACY_WRITE_IMAGES_RAS"
 Environment variable that turns off writing output images in the array order of the input images.
static bool cmtk::VolumeIO::WriteCompressedOn = true
 Global setting: write compressed images.
static Initializer cmtk::VolumeIO::Initializer::Instance
 Instance of the initializer class.

TypedStream.h

enum  cmtk::TypedStreamMode { cmtk::TYPEDSTREAM_READ, cmtk::TYPEDSTREAM_WRITE, cmtk::TYPEDSTREAM_WRITE_ZLIB, cmtk::TYPEDSTREAM_APPEND }
 

Access modes for archives.

More...
enum  cmtk::TypedStreamCondition { cmtk::TYPEDSTREAM_ERROR, cmtk::TYPEDSTREAM_OK }
 

Condition upon function return.

More...
enum  cmtk::TypedStreamStatus {
  cmtk::TYPEDSTREAM_ERROR_NONE, cmtk::TYPEDSTREAM_ERROR_UNKNOWN, cmtk::TYPEDSTREAM_ERROR_SYSTEM, cmtk::TYPEDSTREAM_ERROR_FORMAT,
  cmtk::TYPEDSTREAM_ERROR_ARG, cmtk::TYPEDSTREAM_ERROR_MODE, cmtk::TYPEDSTREAM_ERROR_TYPE, cmtk::TYPEDSTREAM_ERROR_LIMIT,
  cmtk::TYPEDSTREAM_ERROR_LEVEL, cmtk::TYPEDSTREAM_ERROR_INVALID, cmtk::TYPEDSTREAM_ERROR_MAX
}
 

Classes of error conditions.

More...
enum  cmtk::TypedStreamType {
  cmtk::TYPEDSTREAM_TYPE_INT, cmtk::TYPEDSTREAM_TYPE_BOOL, cmtk::TYPEDSTREAM_TYPE_BINARYBOOL, cmtk::TYPEDSTREAM_TYPE_FLOAT,
  cmtk::TYPEDSTREAM_TYPE_DOUBLE, cmtk::TYPEDSTREAM_TYPE_STRING
}
 

Identifiers for supported primitive data types.

More...
enum  cmtk::TypedStreamToken {
  cmtk::TYPEDSTREAM_EOF, cmtk::TYPEDSTREAM_BEGIN, cmtk::TYPEDSTREAM_END, cmtk::TYPEDSTREAM_KEY,
  cmtk::TYPEDSTREAM_VALUE, cmtk::TYPEDSTREAM_COMMENT
}
 

Identifiers for tokens in archives.

More...
enum  cmtk::TypedStreamDebugFlag { cmtk::TYPEDSTREAM_DEBUG_OFF, cmtk::TYPEDSTREAM_DEBUG_ON }
 

Debug flag values.

More...
#define TYPEDSTREAM_LIMIT_BUFFER   1024
 Internal: Length of the read buffer for one archive line.
#define TYPEDSTREAM_FLUSH   true
 Constant for use with flush parameter of End() member function.
#define TYPEDSTREAM_NOFLUSH   false
 Constant for use with flush parameter of End() member function.

Detailed Description

This library provides classes for input and output of images, transformations, and other types of objects.


Define Documentation

#define TYPEDSTREAM_FLUSH   true

Constant for use with flush parameter of End() member function.

Definition at line 174 of file cmtkTypedStream.h.

#define TYPEDSTREAM_LIMIT_BUFFER   1024

Internal: Length of the read buffer for one archive line.

Definition at line 171 of file cmtkTypedStream.h.

Referenced by cmtk::TypedStream::Open(), and cmtk::TypedStream::ReadLineToken().

#define TYPEDSTREAM_NOFLUSH   false

Constant for use with flush parameter of End() member function.

Definition at line 177 of file cmtkTypedStream.h.


Typedef Documentation

typedef std::list<std::string> cmtk::ResourceSection

Resource file section is a list of strings.

Definition at line 49 of file cmtkResourceFile.h.

typedef std::map< Study::SmartPtr, StudyToXform > cmtk::StudyToStudyToXform

Definition at line 54 of file cmtkStudyList.h.

typedef std::multimap<Study::SmartPtr, Xform::SmartPtr> cmtk::StudyToXform

Definition at line 53 of file cmtkStudyList.h.


Enumeration Type Documentation

anonymous enum

Constants to identify color table.

Enumerator:
PALETTE_GRAY 

Grayscale color table.

PALETTE_RED 

Red color table.

PALETTE_GREEN 

Green color table.

PALETTE_BLUE 

Blue color table.

PALETTE_RAINBOW 

Rainbow color table.

PALETTE_LABELS 

Color table for labels.

Definition at line 57 of file cmtkStudy.h.

IDs for data types in Analyze image file.

Enumerator:
ANALYZE_TYPE_NONE 
ANALYZE_TYPE_BINARY 
ANALYZE_TYPE_UNSIGNED_CHAR 
ANALYZE_TYPE_SIGNED_SHORT 
ANALYZE_TYPE_SIGNED_INT 
ANALYZE_TYPE_FLOAT 
ANALYZE_TYPE_COMPLEX 
ANALYZE_TYPE_DOUBLE 
ANALYZE_TYPE_RGB 
ANALYZE_TYPE_USHORT 
ANALYZE_TYPE_UINT 
ANALYZE_TYPE_ALL 

Definition at line 45 of file cmtkAnalyze.h.

IDs for slice orientations in Analyze image file.

Enumerator:
ANALYZE_AXIAL 
ANALYZE_CORONAL 
ANALYZE_SAGITTAL 
ANALYZE_AXIAL_FLIP 
ANALYZE_CORONAL_FLIP 
ANALYZE_SAGITTAL_FLIP 
ANALYZE_UNKNOWN 

Definition at line 61 of file cmtkAnalyze.h.

ID codes for known file formats.

Enumerator:
FILEFORMAT_NEXIST 

File of this name does not exist.

FILEFORMAT_COMPRESSED_ARCHIVE 

File is a compressed archive file.

FILEFORMAT_STUDY 

Path is a typedstream study directory.

FILEFORMAT_STUDYLIST 

Path is a typedstream studylist directory.

FILEFORMAT_TYPEDSTREAM 

Path is a typedstream archive file.

FILEFORMAT_PGM 

Path is a PGM image.

FILEFORMAT_DICOM 

Path is a DICOM image.

FILEFORMAT_VANDERBILT 

Path is a Vanderbilt image description file.

FILEFORMAT_AMIRA 

Path is a Amira image file.

FILEFORMAT_RAW 

Path is some raw binary file (2-D).

FILEFORMAT_RAW3D 

Path is some raw binary file (3-D).

FILEFORMAT_BIORAD 

Path is a BioRad .PIC image file.

FILEFORMAT_NIFTI_DETACHED 

Path is a NRRD file.

FILEFORMAT_NIFTI_SINGLEFILE 

Path is a NRRD file.

FILEFORMAT_ANALYZE_AVW 

Path is an Analyze AVW file.

FILEFORMAT_METAIMAGE 

Path is a MetaImage file.

FILEFORMAT_NRRD 

Path is a NRRD file.

FILEFORMAT_ANALYZE_HDR 

Path is an Analyze header file in little endian.

FILEFORMAT_ANALYZE_HDR_BIGENDIAN 

Path is an Analyze header file in little endian.

FILEFORMAT_ITK_TFM 

Path is an ITK transformation file.

FILEFORMAT_UNKNOWN 

File type cannot be determined.

This ID always has to be the last one!

Definition at line 46 of file cmtkFileFormat.h.

Condition upon function return.

Enumerator:
TYPEDSTREAM_ERROR 

There was an error.

TYPEDSTREAM_OK 

No error encountered; operation completed successfully.

Definition at line 76 of file cmtkTypedStream.h.

Debug flag values.

Enumerator:
TYPEDSTREAM_DEBUG_OFF 

There was an error.

TYPEDSTREAM_DEBUG_ON 

No error encountered; operation completed successfully.

Definition at line 162 of file cmtkTypedStream.h.

Access modes for archives.

Enumerator:
TYPEDSTREAM_READ 

Read-only access.

TYPEDSTREAM_WRITE 

Write-only access.

TYPEDSTREAM_WRITE_ZLIB 

Write-only access piped through zlib/gzip compression.

TYPEDSTREAM_APPEND 

Open existing archive and append to it.

Definition at line 63 of file cmtkTypedStream.h.

Classes of error conditions.

Enumerator:
TYPEDSTREAM_ERROR_NONE 

No error.

TYPEDSTREAM_ERROR_UNKNOWN 

Unknown error.

TYPEDSTREAM_ERROR_SYSTEM 

A call to a system function returned an error condition.

To find out more details, "errno" may be consulted.

TYPEDSTREAM_ERROR_FORMAT 

Error in the format of the open archive.

TYPEDSTREAM_ERROR_ARG 

Wrong or invalid arguments given to a function.

TYPEDSTREAM_ERROR_MODE 

The requested operation is not available in the current stream mode.

This usually means that a write access was requested on a read-only archive or a Seek() operation on a write-only archive.

TYPEDSTREAM_ERROR_TYPE 

Error in a primitive data object.

A value in the archive does not have the correct syntax for the expected type.

TYPEDSTREAM_ERROR_LIMIT 

An internal limit was exhausted.

As we are now using a proper STL stack for keeping track of open levels, this condition should not occur any more.

TYPEDSTREAM_ERROR_LEVEL 

Close of a level was requested when none was open.

TYPEDSTREAM_ERROR_INVALID 

The current stream is invalid.

This condition is set when an access is tried without opening a file first.

TYPEDSTREAM_ERROR_MAX 

Definition at line 85 of file cmtkTypedStream.h.

Identifiers for tokens in archives.

Enumerator:
TYPEDSTREAM_EOF 

End-of-file.

TYPEDSTREAM_BEGIN 

Section beginning "{".

TYPEDSTREAM_END 

Section end "}".

TYPEDSTREAM_KEY 

Key (field name).

TYPEDSTREAM_VALUE 

Field value.

TYPEDSTREAM_COMMENT 

Comment.

Definition at line 145 of file cmtkTypedStream.h.

Identifiers for supported primitive data types.

Enumerator:
TYPEDSTREAM_TYPE_INT 

Interger.

TYPEDSTREAM_TYPE_BOOL 

Boolean (Yes/No).

TYPEDSTREAM_TYPE_BINARYBOOL 

Binary boolean (0/1).

TYPEDSTREAM_TYPE_FLOAT 

Single-precision float.

TYPEDSTREAM_TYPE_DOUBLE 

Double-precision float.

TYPEDSTREAM_TYPE_STRING 

String (char*).

Definition at line 128 of file cmtkTypedStream.h.


Function Documentation

Study::SmartPtr cmtk::StudyList::AddStudy ( const char *  fileSystemPath ) [inherited]

Add a new study entry.

Parameters:
fileSystemPathName of the study to add.

Definition at line 138 of file cmtkStudyList.cxx.

References NULL.

Referenced by cmtk::ClassStreamStudyList::Merge(), and cmtk::GroupwiseRegistrationOutput::WriteXformsSeparateArchives().

void cmtk::StudyList::AddStudy ( Study::SmartPtr study ) [inherited]

Add an existing study object.

Parameters:
studyExisting study object to add to the study list.

Definition at line 166 of file cmtkStudyList.cxx.

unsigned int cmtk::ResourceFile::AddUnique ( const char *  section,
const char *  entry,
const unsigned int  maxItems = 0 
) [inherited]

Add a unique (non-duplicate) string to resource section.

Returns:
Number of entries that are in the section after adding new entry.

Definition at line 117 of file cmtkResourceFile.cxx.

void cmtk::StudyList::AddXform ( const char *  fromStudyPath,
const char *  toStudyPath,
AffineXform::SmartPtr affineXform,
WarpXform::SmartPtr warpXform = WarpXform::SmartPtr::Null 
) [inherited]

Add a coordinate transformation between two studies.

Parameters:
fromStudyPathPath of the study that the transformation maps from.
toStudyPathPath of the study that the transformation maps to.
affineXformAffine coordinate transformation between the given studies.
warpXformOptional nonrigid transformation between the two given studies.

Definition at line 186 of file cmtkStudyList.cxx.

void cmtk::StudyList::AddXform ( Study::SmartPtr fromStudy,
Study::SmartPtr toStudy,
AffineXform::SmartPtr affineXform,
WarpXform::SmartPtr warpXform = WarpXform::SmartPtr::Null 
) [inherited]

Add a coordinate transformation between two studies.

Definition at line 196 of file cmtkStudyList.cxx.

Referenced by cmtk::ClassStreamStudyList::Merge(), and cmtk::GroupwiseRegistrationOutput::WriteXformsSeparateArchives().

char * cmtk::VolumeFromSlices::AllocDataArray ( const int  bytesperpixel,
const int  data_size 
) const [protected, virtual, inherited]

Allocate memory for the 3D image data.

Definition at line 92 of file cmtkVolumeFromSlices.cxx.

const UniformVolume::SmartPtr cmtk::VolumeFromStudy::AssembleVolume ( const StudyImageSet study,
const bool  verbose = false 
) [virtual, inherited]

Build volume from slice images.

See also:
VolumeFromSlices::AssembleVolume

Definition at line 82 of file cmtkVolumeFromStudy.cxx.

References cmtk::AXIS_Z, NULL, cmtk::Console::printf(), and cmtk::StdErr.

Referenced by cmtk::VolumeFromStudy::Read().

TypedStreamCondition cmtk::TypedStream::Begin ( const char *  section = NULL ) [inherited]
const char * cmtk::VolumeFromSlices::CheckImage ( const int  plane,
const ScalarImage image,
const unsigned int  frame = 0 
) [protected, inherited]

Check image consistency.

This function is used to verify that all images share the same matrix size, identical pixel calibrations, and the same primitive data type. Also, slices with zero distance and changing directions of the table position are detected and reported.

Parameters:
planeIndex of this image in the sequence.
imageA reference to a structure describing the next image.
frameIndex of frame within a multi-frame image.
Returns:
A pointer to an error message, of NULL if image was okay.

Definition at line 199 of file cmtkVolumeFromSlices.cxx.

References cmtk::AXIS_X, cmtk::AXIS_Y, CMTK_MAX_ANGLE_ERROR, CMTK_MAX_CALIB_ERROR, CMTK_MAX_LOCALIZE_ERROR, cmtk::ScalarImage::GetDims(), cmtk::ScalarImage::GetImageOrigin(), cmtk::FixedVector< NDIM, T >::MaxAbsValue(), NULL, cmtk::Console::printf(), and cmtk::StdErr.

void cmtk::TypedStreamStudylist::Clear (  ) [private, inherited]

Initialize all internal data structures.

Definition at line 59 of file cmtkTypedStreamStudylist.cxx.

References NULL.

void cmtk::TypedStream::Close (  ) [inherited]
UniformVolume::SmartPtr cmtk::VolumeFromSlices::ConstructVolume ( const DataGrid::IndexType Dims,
const UniformVolume::CoordinateVectorType Size,
const Types::Coordinate Points[3],
TypedArray::SmartPtr Data 
) const [protected, virtual, inherited]

Construct Volume object.

This function takes the geometry and data as read from the slice images. Its purpose is to compose an Volume object out of these components. By default, an instance of UniformVolume will be created for uniformly-spaced data, while an instance of igsRectilinearVolume is created for non-uniformly spaced images. Derived classes my override this function to create specialized volume classes derived from the aforementioned base classes.

Parameters:
DimsDimensions of the 3D data, ie. number of voxels in x-, y-, and z-direction.
SizeExtents of data in [mm] in x-, y-, and z-direction.
PointsPositions of the grid points (voxels) with respect to the three spatial coordinates. In case the points are uniformly spaced in all three dimensions, an instance of UniformVolume is created with grid spacing as defined by the uniform spacings in this array. Otherwise, an instance of igsRectilinearVolume is created with precisely this array as its "Points" field.
DataPixel data array for the new volume.
See also:
igsRectilinearVolume::Points
Returns:
The newly created instance of a class derived from Volume.
See also:
Volume

Definition at line 273 of file cmtkVolumeFromSlices.cxx.

References cmtk::StdErr.

void cmtk::Study::CopyColormap ( const Study other ) [virtual, inherited]

Copy colormap information from another study object.

Definition at line 235 of file cmtkStudy.cxx.

void cmtk::TypedStream::DebugOutput ( const char *  format,
  ... 
) [private, inherited]

Output diagnostic message if debug flag is set.

Parameters:
formatprintf-style format string for the remaining variable number of function arguments.

Definition at line 1554 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_DEBUG_ON.

void cmtk::StudyList::DeleteStudy ( const Study study ) [inherited]

Remove and delete given study object.

Parameters:
studyStudy object to delete from the list.

Definition at line 213 of file cmtkStudyList.cxx.

const char * cmtk::FileFormat::Describe ( const FileFormatID  id ) [static, inherited]
TypedArray::SmartPtr cmtk::VolumeFromSlices::EncapDataArray ( const ScalarDataType  dtype,
void *const   data,
const int  data_size 
) const [protected, virtual, inherited]

Put image data into a custom data structure.

By default, the image data is encapsulated into a newly created TypedArray object.

Definition at line 98 of file cmtkVolumeFromSlices.cxx.

TypedStreamCondition cmtk::TypedStream::End ( const bool  flush = false ) [inherited]
const char * cmtk::VolumeFromSlices::FillPlane ( unsigned int &  plane,
const ScalarImage image 
) [protected, inherited]

Copy one slice of data into field.

This function rearranges the bytes in the given 2D image so that after all slices have been copied to the 3D array, the xy-plane is always axial with respect to the patient.

Definition at line 106 of file cmtkVolumeFromSlices.cxx.

References NULL.

const Study * cmtk::StudyList::FindStudyName ( const char *  name ) const [inherited]

Find constant Study object by file system path.

Parameters:
nameName of the study to find.

Definition at line 106 of file cmtkStudyList.cxx.

References NULL.

Study::SmartPtr cmtk::StudyList::FindStudyName ( const char *  name ) [inherited]

Find non-constant Study object by file system path.

Parameters:
nameName of the study to find.

Definition at line 122 of file cmtkStudyList.cxx.

Study::SmartPtr cmtk::StudyList::FindStudyPath ( const char *  fileSystemPath,
const bool  create = false 
) [inherited]

Find non-constant Study object by file system path.

Parameters:
fileSystemPathPath of study to find in filesystem
createFlag whether to create a study that does not exist already

Definition at line 84 of file cmtkStudyList.cxx.

const Study * cmtk::StudyList::FindStudyPath ( const char *  fileSystemPath ) const [inherited]

Find constant Study object by file system path.

Definition at line 68 of file cmtkStudyList.cxx.

References NULL.

UniformVolume::SmartPtr cmtk::VolumeFromSlices::FinishVolume ( Types::Coordinate sliceOffset,
int &  sliceDirection 
) [protected, inherited]

Finish volume creation and free temporary storage.

Parameters:
sliceOffsetThis reference is set to the absolute slice coordinate of the original image that became the first plane in the resulting volume. This can be used to write images with precisely the same absolute positions later.
sliceDirectionThis reference is set to a flag indicating whether in the original images the slice positions increased (+1) or decreased (-1) with increasing slice index.
Returns:
The newly created volume object as returned by ConstructVolume().

Definition at line 128 of file cmtkVolumeFromSlices.cxx.

References cmtk::Memory::DeleteArray(), cmtk::META_IMAGE_ORIENTATION, cmtk::META_IMAGE_ORIENTATION_ORIGINAL, cmtk::META_SPACE, cmtk::META_SPACE_ORIGINAL, cmtk::META_SPACE_UNITS_STRING, and cmtk::SelectDataTypeInteger().

TypedStreamCondition cmtk::TypedStream::GenericReadArray ( const char *  key,
const int  type,
void *const   array,
const int  arraySize,
const bool  forward = false 
) [private, inherited]

Utility function: Read an array of arbitrary type.

This function is called by all reader functions. Internally, a "switch" statement selects the correct code for the effective data type to be read. Besides, common functions such as the skipping of inserted sections are implemented as shared code for all data types.

Parameters:
keyField key (name)
typeArray data type ID
arrayTarget storage space for read data
arraySizeNumber of array elements
forwardFlag: read forward from current position in stream (if false, reset to current section start)

Definition at line 1150 of file cmtkTypedStream.cxx.

References NULL, cmtk::TYPEDSTREAM_BEGIN, cmtk::TYPEDSTREAM_END, cmtk::TYPEDSTREAM_EOF, cmtk::TYPEDSTREAM_ERROR, cmtk::TYPEDSTREAM_ERROR_ARG, cmtk::TYPEDSTREAM_ERROR_NONE, cmtk::TYPEDSTREAM_ERROR_SYSTEM, cmtk::TYPEDSTREAM_ERROR_TYPE, cmtk::TYPEDSTREAM_KEY, cmtk::TYPEDSTREAM_OK, cmtk::TYPEDSTREAM_TYPE_BINARYBOOL, cmtk::TYPEDSTREAM_TYPE_BOOL, cmtk::TYPEDSTREAM_TYPE_DOUBLE, cmtk::TYPEDSTREAM_TYPE_FLOAT, cmtk::TYPEDSTREAM_TYPE_INT, and cmtk::TYPEDSTREAM_TYPE_STRING.

ClassStream & cmtk::ClassStream::Get ( WarpXform::SmartPtr warpXform,
const AffineXform affineXform = NULL 
) [inherited]

Actually read warp transformation object.

Definition at line 82 of file cmtkClassStreamWarpXform.cxx.

Referenced by cmtk::ClassStreamStudyList::Merge(), and cmtk::TypedStreamStudylist::Read().

ClassStream & cmtk::ClassStream::Get ( WarpXform *&  warpXform,
const AffineXform affineXform = NULL 
) [inherited]
FileFormatID cmtk::FileFormat::GetID ( const char *  name ) [static, inherited]

Return ID for given file format name.

Definition at line 156 of file cmtkFileFormat.cxx.

References cmtk::FILEFORMAT_UNKNOWN.

TypedStreamStatus cmtk::TypedStream::GetStatus (  ) const [inline, inherited]

Return status of last operation.

Definition at line 249 of file cmtkTypedStream.h.

const Study * cmtk::StudyList::GetStudy ( const unsigned int  studyIndex ) const [inherited]

Get constant Study object by index.

Definition at line 46 of file cmtkStudyList.cxx.

References NULL.

Study::SmartPtr cmtk::StudyList::GetStudy ( const unsigned int  studyIndex ) [inherited]

Get non-constant Study object by index.

Definition at line 57 of file cmtkStudyList.cxx.

static const char* cmtk::TypedStream::GetTypedStreamIdent (  ) [inline, static, private, inherited]

Return the identifier for the generated archive format (version).

Definition at line 637 of file cmtkTypedStream.h.

FileFormatID cmtk::FileFormat::Identify ( const char *  path,
const bool  decompress = true 
) [static, inherited]

Identify file or directory with given path.

Compressed files as supported by CompressedStream are handled. If both an uncompressed and a compressed file exist for the same path prefix, then the uncompressed file has precedence.

Parameters:
pathImage path.
decompressIf set, compressed files are decompressed before determining their file type.

Definition at line 141 of file cmtkFileFormat.cxx.

References cmtk::FILEFORMAT_NEXIST.

Referenced by cmtk::FileFormat::Describe().

FileFormatID cmtk::FileFormat::IdentifyDirectory ( const char *  path ) [static, private, inherited]

Identify directory with given path.

Definition at line 212 of file cmtkFileFormat.cxx.

References cmtk::FILEFORMAT_STUDY, cmtk::FILEFORMAT_STUDYLIST, and cmtk::FILEFORMAT_UNKNOWN.

FileFormatID cmtk::FileFormat::IdentifyFile ( const char *  path,
const bool  decompress = true 
) [static, private, inherited]

Identify regular file with given path.

Parameters:
pathImage path.
decompressIf set, compressed files are decompressed before determining their file type.

Definition at line 237 of file cmtkFileFormat.cxx.

References cmtk::FILEFORMAT_COMPRESSED_ARCHIVE, cmtk::FILEFORMAT_NEXIST, cmtk::FILEFORMAT_UNKNOWN, cmtk::CompressedStream::IsCompressed(), cmtk::CompressedStream::IsValid(), and cmtk::CompressedStream::Read().

cmtk::VolumeIO::Initializer::Initializer (  ) [private, inherited]

Default constructor: initialize VolumeIO settings.

Definition at line 419 of file cmtkVolumeIO.cxx.

void cmtk::TypedStream::InitInternals (  ) [private, inherited]

Initialize internal data structures.

This function is called from both constructors to initialize the internal data structures of this object.

Definition at line 86 of file cmtkTypedStream.cxx.

References NULL, cmtk::TYPEDSTREAM_DEBUG_OFF, and cmtk::TYPEDSTREAM_ERROR_NONE.

void cmtk::VolumeFromSlices::InitSequence ( const ScalarImage image,
const unsigned int  numberOfSlices 
) [protected, inherited]

Start creation of new volume.

Definition at line 54 of file cmtkVolumeFromSlices.cxx.

References cmtk::AXIS_X, cmtk::AXIS_Y, cmtk::ScalarImage::GetDims(), and cmtk::ScalarImage::GetImageOrigin().

int cmtk::TypedStream::IsValid (  ) [inline, inherited]
StudyList * cmtk::ClassStreamStudyList::Merge ( const StudyList studyList,
const char *  path 
) [static, inherited]

Merge with duplicated studylist.

Definition at line 56 of file cmtkClassStreamStudyList.cxx.

StudyList * cmtk::ClassStreamStudyList::Merge ( StudyList *const   studyList,
const char *  path 
) [static, inherited]
void cmtk::TypedStream::Open ( const char *  filename,
const TypedStreamMode  mode 
) [inherited]
void cmtk::TypedStream::Open ( const char *  dir,
const char *  archive,
const TypedStreamMode  mode 
) [inherited]

Open another archive in explicit directory.

Definition at line 110 of file cmtkTypedStream.cxx.

References NULL, cmtk::StdErr, cmtk::TYPEDSTREAM_APPEND, cmtk::TYPEDSTREAM_WRITE, and cmtk::TYPEDSTREAM_WRITE_ZLIB.

ClassStream & cmtk::operator<< ( ClassStream &  stream,
const GroupwiseRegistrationFunctionalBase &  func 
)
ClassStream & cmtk::ClassStream::operator<< ( const WarpXform warpXform ) [inherited]

Write generic transformation object.

This function determines the virtual type of the transformation object (spline or linear deformation) using a dynamic_cast. It then calls the appropriate specialized output function.

Definition at line 45 of file cmtkClassStreamWarpXform.cxx.

template<class TMetricFunctionalType >
ClassStream & cmtk::operator<< ( ClassStream &  stream,
const AffineMultiChannelRegistrationFunctional< TMetricFunctionalType > &  functional 
)

Write file names and transformations from affine multi-channel registration functional.

Definition at line 45 of file cmtkClassStreamMultiChannelRegistration.txx.

References cmtk::TypedStream::Begin(), cmtk::TypedStream::End(), cmtk::META_FS_PATH, cmtk::TypedStream::WriteInt(), and cmtk::TypedStream::WriteString().

template<class TMetricFunctionalType >
ClassStream & cmtk::operator<< ( ClassStream &  stream,
const SplineWarpMultiChannelRegistrationFunctional< TMetricFunctionalType > &  functional 
)

Write file names and transformations from spline warp multi-channel registration functional.

Definition at line 113 of file cmtkClassStreamMultiChannelRegistration.txx.

References cmtk::TypedStream::Begin(), cmtk::TypedStream::End(), cmtk::META_FS_PATH, cmtk::TypedStream::WriteInt(), and cmtk::TypedStream::WriteString().

ClassStream & cmtk::ClassStream::operator<< ( const ParametricPlane parametricPlane ) [inherited]
ClassStream & cmtk::operator<< ( ClassStream &  stream,
const AffineXform &  affineXform 
)
ClassStream& cmtk::operator<< ( ClassStream &  stream,
const Xform &  xform 
)

Write transformation object.

Definition at line 49 of file cmtkClassStreamXform.h.

ClassStream & cmtk::ClassStream::operator<< ( const LandmarkList landmarkList ) [inherited]

Write landmark list.

Definition at line 43 of file cmtkClassStreamLandmarkList.cxx.

ClassStream & cmtk::operator>> ( ClassStream &  stream,
AffineXform::SmartPtr &  affineXform 
)

Read affine transformation.

Definition at line 60 of file cmtkClassStreamAffineXform.cxx.

ClassStream & cmtk::ClassStream::operator>> ( WarpXform *&  warpXform ) [inherited]

Read (spline or linear) warp transformation.

Definition at line 212 of file cmtkClassStreamWarpXform.cxx.

ClassStream& cmtk::operator>> ( ClassStream &  stream,
GroupwiseRegistrationFunctionalBase &  func 
)
std::istream & cmtk::operator>> ( std::istream &  stream,
SegmentationLabelMap &  lblMap 
)

Operator to read a list of label IDs from a C++ stream.

Definition at line 46 of file cmtkSegmentationLabelIO.cxx.

template<class TMetricFunctionalType >
ClassStream & cmtk::operator>> ( ClassStream &  stream,
AffineMultiChannelRegistrationFunctional< TMetricFunctionalType > &  functional 
)

Read file names and transformations from archive to multi-channel affine registration functional.

Definition at line 69 of file cmtkClassStreamMultiChannelRegistration.txx.

References cmtk::TypedStream::End(), NULL, cmtk::TypedStream::ReadInt(), cmtk::TypedStream::ReadString(), cmtk::TypedStream::Seek(), and cmtk::StdErr.

ClassStream & cmtk::operator>> ( ClassStream &  stream,
AffineXform &  affineXform 
)
ClassStream & cmtk::ClassStream::operator>> ( WarpXform::SmartPtr warpXform ) [inherited]

Read (spline or linear) warp transformation.

Definition at line 61 of file cmtkClassStreamLandmarkList.cxx.

ClassStream & cmtk::ClassStream::operator>> ( ParametricPlane *&  parametricPlane ) [inherited]
ClassStream & cmtk::ClassStream::PutWarp ( const WarpXform warpXform ) [private, inherited]
StudyList * cmtk::ClassStreamStudyList::Read ( const char *  path ) [static, inherited]

Read studylist.

Definition at line 49 of file cmtkClassStreamStudyList.cxx.

Xform::SmartPtr cmtk::XformIO::Read ( const char *  path,
const bool  verbose = false 
) [static, inherited]
ScalarImage * cmtk::DICOM::Read ( const char *  path ) [static, inherited]
ScalarImage * cmtk::PGM::Read ( const char *  filename ) [static, inherited]
void cmtk::ResourceFile::Read ( const char *  fileName ) [inherited]

Read from resource file.

Definition at line 50 of file cmtkResourceFile.cxx.

References isspace, cmtk::Console::printf(), and cmtk::StdErr.

UniformVolume::SmartPtr cmtk::VolumeIO::Read ( const char *  path,
const bool  verbose = false 
) [static, inherited]
Study * cmtk::Study::Read ( const char *  path ) [static, inherited]

Static study reader function.

Definition at line 229 of file cmtkStudy.cxx.

References cmtk::Study::Study().

const UniformVolume::SmartPtr cmtk::VolumeFromStudy::Read ( const Study study,
const bool  verbose = false 
) [static, inherited]

Read from generic Study object.

Definition at line 66 of file cmtkVolumeFromStudy.cxx.

References cmtk::VolumeFromStudy::AssembleVolume(), and NULL.

bool cmtk::TypedStreamStudylist::Read ( const char *  studylistpath ) [inherited]
const UniformVolume::SmartPtr cmtk::VolumeFromFile::Read ( const char *  filename ) [static, inherited]
ScalarImage * cmtk::ScalarImageIO::ReadAnalyze ( const char *  pathHdr ) [static, inherited]
const UniformVolume::SmartPtr cmtk::VolumeFromFile::ReadAnalyzeHdr ( const char *  pathHdr,
const bool  bigEndian = false,
const bool  readData = true 
) [static, inherited]
const UniformVolume::SmartPtr cmtk::VolumeFromFile::ReadBioRad ( const char *  path ) [static, inherited]
bool cmtk::TypedStream::ReadBool ( const char *  key,
const bool  defaultValue = false,
const bool  forward = false 
) [inherited]

Read boolean value from an open archive.

This function recognizes both yes/no and 0/1 entries in the archive. First, "yes" and "no" is tried, if that doesn't work the function reads an integer value from the same key.

Returns:
If reading was succesful, the value from the archive is returned. Otherwise the value given as the "defaultValue" parameter is returned.
Parameters:
keyThe name of the boolean entry in the archive.
defaultValueDefault value returned if no valid entry can be read. This parameter can be omitted and defaults to false.
forwardFlag: read forward from current position in stream (if false, reset to current section start)

Definition at line 640 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_OK, cmtk::TYPEDSTREAM_TYPE_BOOL, and cmtk::TYPEDSTREAM_TYPE_INT.

TypedStreamCondition cmtk::TypedStream::ReadBoolArray ( const char *  key,
byte *const   array,
const int  size,
const bool  forward = false 
) [inherited]

Read array of boole values from an open archive.

For a description of parameters and return value see ReadBool.

Parameters:
keyThe name of the array in the archive.
arrayPointer to allocated storage for the array to be read into.
sizeSize of the array.
forwardFlag: read forward from current position in stream (if false, reset to current section start)

Definition at line 653 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_TYPE_BINARYBOOL.

Types::Coordinate cmtk::TypedStream::ReadCoordinate ( const char *  key,
const Types::Coordinate  defaultValue = 0,
const bool  forward = false 
) [inline, inherited]

Read double- or single precision value from an open archive.

Whether double- or single-precision data is read depends on the definition of the CMTK_COORDINATES_DOUBLE preprocessor symbol. This function is thus guaranteed to always match the Types::Coordinate type.

See also:
CMTK_COORDINATES_DOUBLE
Types::Coordinate
Parameters:
keyThe name of the field in the archive.
defaultValueDefault value if the field is not found.
forwardFlag: read forward from current position in stream (if false, reset to current section start)

Definition at line 343 of file cmtkTypedStream.h.

TypedStreamCondition cmtk::TypedStream::ReadCoordinateArray ( const char *  key,
Types::Coordinate *const   array,
const int  size,
const bool  forward = false 
) [inline, inherited]

Read array of double- or single precision values from an open archive.

Whether double- or single-precision data is read depends on the definition of the CMTK_COORDINATES_DOUBLE preprocessor symbol. This function is thus guaranteed to always match the Types::Coordinate type.

See also:
CMTK_COORDINATES_DOUBLE
Types::Coordinate
Parameters:
keyThe name of the array in the archive.
arrayPointer to allocated storage for the array to be read into.
sizeSize of the array.
forwardFlag: read forward from current position in stream (if false, reset to current section start)

Definition at line 379 of file cmtkTypedStream.h.

Referenced by cmtk::operator>>().

double cmtk::TypedStream::ReadDouble ( const char *  key,
const double  defaultValue = 0,
const bool  forward = false 
) [inherited]

Read double-precision value from an open archive.

For a description of parameters and return value see ReadBool.

Parameters:
keyThe name of the field in the archive.
defaultValueDefault value returned if the field is not found in the archive.
forwardFlag: read forward from current position in stream (if false, reset to current section start)

Definition at line 696 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_OK, and cmtk::TYPEDSTREAM_TYPE_DOUBLE.

TypedStreamCondition cmtk::TypedStream::ReadDoubleArray ( const char *  key,
double *const   array,
const int  size,
const bool  forward = false 
) [inherited]

Read array of double-precision values from an open archive.

For a description of parameters and return value see ReadBool.

Parameters:
keyThe name of the array in the archive.
arrayPointer to allocated storage for the array to be read into.
sizeSize of the array.
forwardFlag: read forward from current position in stream (if false, reset to current section start)

Definition at line 707 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_TYPE_DOUBLE.

float cmtk::TypedStream::ReadFloat ( const char *  key,
const float  defaultValue = 0,
const bool  forward = false 
) [inherited]

Read single-precision value from an open archive.

For a description of parameters and return value see ReadBool.

Parameters:
keyThe name of the field in the archive.
defaultValueDefault value returned if no valid entry can be read. This parameter can be omitted and defaults to zero.
forwardFlag: read forward from current position in stream (if false, reset to current section start)

Definition at line 678 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_OK, and cmtk::TYPEDSTREAM_TYPE_FLOAT.

TypedStreamCondition cmtk::TypedStream::ReadFloatArray ( const char *  key,
float *const   array,
const int  size,
const bool  forward = false 
) [inherited]

Read array of single-precision values from an open archive.

For a description of parameters and return value see ReadBool.

Parameters:
keyThe name of the array in the archive.
arrayPointer to allocated storage for the array to be read into.
sizeSize of the array.
forwardFlag: read forward from current position in stream (if false, reset to current section start)

Definition at line 689 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_TYPE_FLOAT.

UniformVolume::SmartPtr cmtk::VolumeIO::ReadGrid ( const char *  path,
const bool  verbose = false 
) [static, inherited]
UniformVolume::SmartPtr cmtk::VolumeIO::ReadGridOriented ( const char *  path,
const char *  orientation,
const bool  verbose = false 
) [static, inherited]

Read grid only from filesystem and bring into standard "RAS" orientation.

Definition at line 213 of file cmtkVolumeIO.cxx.

References cmtk::META_IMAGE_ORIENTATION, and cmtk::StdErr.

int cmtk::TypedStream::ReadInt ( const char *  key,
const int  defaultValue = 0,
const bool  forward = false 
) [inherited]

Read integer value from an open archive.

For a description of parameters and return value see ReadBool.

Parameters:
keyThe name of the field in the archive.
defaultValueDefault value returned if no valid entry can be read. This parameter can be omitted and defaults to zero.
forwardFlag: read forward from current position in stream (if false, reset to current section start)

Definition at line 660 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_OK, and cmtk::TYPEDSTREAM_TYPE_INT.

Referenced by cmtk::operator>>().

TypedStreamCondition cmtk::TypedStream::ReadIntArray ( const char *  key,
int *const   array,
const int  size,
const bool  forward = false 
) [inherited]

Read array of integer values from an open archive.

For a description of parameters and return value see ReadBool.

Parameters:
keyThe name of the array in the archive.
arrayPointer to allocated storage for the array to be read into.
sizeSize of the array.
forwardFlag: read forward from current position in stream (if false, reset to current section start)

Definition at line 671 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_TYPE_INT.

Referenced by cmtk::operator>>().

Types::DataItem cmtk::TypedStream::ReadItem ( const char *  key,
const Types::DataItem  defaultValue = 0,
const bool  forward = false 
) [inline, inherited]

Read double- or single precision value from an open archive.

Whether double- or single-precision data is read depends on the definition of the CMTK_DATA_DOUBLE preprocessor symbol. This function is thus guaranteed to always match the Types::DataItem type.

See also:
CMTK_DATA_DOUBLE
Types::DataItem
Parameters:
keyThe name of the field in the archive.
defaultValueDefault value returned if the field is not found in the archive.
forwardFlag: read forward from current position in stream (if false, reset to current section start)

Definition at line 361 of file cmtkTypedStream.h.

TypedStreamCondition cmtk::TypedStream::ReadItemArray ( const char *  key,
Types::DataItem *const   array,
const int  size,
const bool  forward = false 
) [inline, inherited]

Read array of double- or single precision values from an open archive.

Whether double- or single-precision data is read depends on the definition of the CMTK_DATA_DOUBLE preprocessor symbol. This function is thus guaranteed to always match the Types::DataItem type.

See also:
CMTK_DATA_DOUBLE
Types::DataItem
Parameters:
keyThe name of the array in the archive.
arrayPointer to allocated storage for the array to be read into.
sizeSize of the array.
forwardFlag: read forward from current position in stream (if false, reset to current section start)

Definition at line 398 of file cmtkTypedStream.h.

TypedStreamToken cmtk::TypedStream::ReadLineToken (  ) [private, inherited]
const UniformVolume::SmartPtr cmtk::VolumeFromFile::ReadNifti ( const char *  pathHdr,
const bool  detached,
const bool  readData = true 
) [static, inherited]
UniformVolume::SmartPtr cmtk::VolumeIO::ReadOriented ( const char *  path,
const char *  orientation,
const bool  verbose = false 
) [static, inherited]

Read image from filesystem and reorient to align anatomy with coordinate axes.

Parameters:
pathFilesystem path of the image to read.
orientationThree-character orientation code. The image will be brought into the orientation specified by this string. Default is "RAS", i.e., the returned image will be oriented so that the positive x axis is aligned with the anatomical L/R (left/right) direction, the y axis is aligned with the P/A (posterior/anterior) direction, and the y axis is aligned with the I/S (inferior/superior) direction.
verboseFlag for verbose operation: if true, write status information to standard error.

Definition at line 243 of file cmtkVolumeIO.cxx.

References cmtk::META_IMAGE_ORIENTATION, and cmtk::StdErr.

Referenced by cmtk::AffineRegistrationCommandLine::AffineRegistrationCommandLine(), cmtk::ImagePairAffineRegistrationCommandLine::ImagePairAffineRegistrationCommandLine(), cmtk::SimpleLevelsetCommandLineBase::Init(), cmtk::ImageOperationApplyMask::ReadMaskFile(), cmtk::Study::ReadVolume(), and cmtk::ImageSymmetryPlaneCommandLineBase::Run().

char * cmtk::TypedStream::ReadString ( const char *  key,
const char *  defaultValue = NULL,
const bool  forward = false 
) [inherited]

Read null-terminated string from an open archive.

The string returned is newly allocated by this function. So unless NULL is returner, the string must later be freed by the caller in order to avoid memory leaks.

Returns:
A pointer to a newly allocated string is returned if reading was succesful. If no valid entry could be read from the archive, a copy of the string given as "defaultValue" parameter is returned. If that parameter was NULL, the same value is also returned.
Parameters:
keyThe name of the field in the archive.
defaultValueDefault value returned if the field is not found in the archive.
forwardFlag: read forward from current position in stream (if false, reset to current section start)

Definition at line 714 of file cmtkTypedStream.cxx.

References NULL, cmtk::TYPEDSTREAM_OK, and cmtk::TYPEDSTREAM_TYPE_STRING.

Referenced by cmtk::AffineRegistrationCommandLine::AffineRegistrationCommandLine(), cmtk::ElasticRegistrationCommandLine::ElasticRegistrationCommandLine(), cmtk::ImagePairAffineRegistrationCommandLine::ImagePairAffineRegistrationCommandLine(), cmtk::ImagePairNonrigidRegistrationCommandLine::ImagePairNonrigidRegistrationCommandLine(), cmtk::ClassStreamStudyList::Merge(), cmtk::operator>>(), and cmtk::TypedStreamStudylist::Read().

bool cmtk::Study::ReadVolume ( const bool  reRead = false,
const char *  orientation = NULL 
) [virtual, inherited]

Read volume data.

Parameters:
reReadIf this is false, then the volume is only read if it has not been read before. Otherwise, it is re-read in any case.
orientationOptional three-letter anatomical image orientation.
Returns:
True if reading was successful; the "Volume" field has a pointer to the resulting image volume.

Definition at line 174 of file cmtkStudy.cxx.

References cmtk::AXIS_Z, cmtk::TypedArray::GetData(), cmtk::TypedArray::GetPercentile(), cmtk::TypedArray::GetRange(), cmtk::Study::m_Dims, cmtk::Types::Range< T >::m_LowerBound, cmtk::Types::Range< T >::m_UpperBound, NULL, cmtk::VolumeIO::Read(), and cmtk::VolumeIO::ReadOriented().

TypedStreamCondition cmtk::TypedStream::Rewind (  ) [inherited]

Rewind archive.

This function resets filepointer of an open archive to the beginning of the current section.

Definition at line 585 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_ERROR, cmtk::TYPEDSTREAM_ERROR_INVALID, cmtk::TYPEDSTREAM_ERROR_MODE, cmtk::TYPEDSTREAM_ERROR_SYSTEM, cmtk::TYPEDSTREAM_OK, and cmtk::TYPEDSTREAM_READ.

Referenced by cmtk::operator>>().

TypedStreamCondition cmtk::TypedStream::Seek ( const char *  section,
const bool  forward = false 
) [inherited]

Move to a particular section in the open archive.

The named section is found if it is either inside the currently open section or after it on the same level.

This function may only be called for read-only archive, ie. for such that were opened in TYPEDSTREAM_READONLY mode. For writeable archive, it will return an error.

Parameters:
sectionName of the section whose beginning stream pointer is moved to.
forwardFlag: read forward from current position in stream (if false, reset to current section start)

Definition at line 485 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_BEGIN, cmtk::TYPEDSTREAM_END, cmtk::TYPEDSTREAM_EOF, cmtk::TYPEDSTREAM_ERROR, cmtk::TYPEDSTREAM_ERROR_ARG, cmtk::TYPEDSTREAM_ERROR_INVALID, cmtk::TYPEDSTREAM_ERROR_LEVEL, cmtk::TYPEDSTREAM_ERROR_MODE, cmtk::TYPEDSTREAM_ERROR_NONE, cmtk::TYPEDSTREAM_OK, and cmtk::TYPEDSTREAM_READ.

Referenced by cmtk::AffineRegistrationCommandLine::AffineRegistrationCommandLine(), cmtk::ElasticRegistrationCommandLine::ElasticRegistrationCommandLine(), cmtk::ImagePairAffineRegistrationCommandLine::ImagePairAffineRegistrationCommandLine(), cmtk::ImagePairNonrigidRegistrationCommandLine::ImagePairNonrigidRegistrationCommandLine(), cmtk::ClassStreamStudyList::Merge(), cmtk::operator>>(), and cmtk::TypedStreamStudylist::Read().

void cmtk::TypedStream::SetDebugFlag ( const TypedStreamDebugFlag  debugFlag = TYPEDSTREAM_DEBUG_ON ) [inline, inherited]

Set debugging flag.

Parameters:
debugFlagSet the debug flag to this value.

Definition at line 545 of file cmtkTypedStream.h.

const char * cmtk::Study::SetMakeName ( const char *  name = NULL,
const int  suffix = 0 
) [inherited]

Set study name; create name if no name given.

This function sets the name of this study. If no name is given (name parameter is NULL pointer), then a name is constructed from the file system path of this study.

Parameters:
nameNew study name
suffixUnique numerical suffix to be added to study name if other studies with the same name exist.

Definition at line 115 of file cmtkStudy.cxx.

Referenced by cmtk::Study::Study().

int cmtk::TypedStream::StringCmp ( const char *  s1,
const char *  s2 
) [static, private, inherited]

Compare two strings.

Other than the standard library's strcmp() function, this implementation ignores upper and lowercase. Also, strings are terminated by either NULL characters or any white space or newline.

Returns:
0 for identical strings (up to upper-/lowercase), 1 for non-identical strings.

Definition at line 1464 of file cmtkTypedStream.cxx.

char * cmtk::TypedStream::StringSplit ( char *  s1 ) const [private, inherited]

Separate next token.

This function identifies the next token in the given string, sets a NULL character to mark its end and returns a pointer to the token's first character. The state between calls is saved in the "SplitPosition" field. Calling the function with NULL as a parameter resets the internal state.

Parameters:
s1String to split into tokens.

Definition at line 1497 of file cmtkTypedStream.cxx.

References NULL.

cmtk::Study::Study ( const char *  fileSystemPath,
const char *  name = NULL 
) [inherited]

Constructor: Construct study from image file.

Definition at line 64 of file cmtkStudy.cxx.

References cmtk::FileFormat::Describe(), and cmtk::Study::SetMakeName().

cmtk::Study::Study (  ) [inherited]

Default constructor.

Definition at line 49 of file cmtkStudy.cxx.

Referenced by cmtk::Study::Read().

cmtk::TypedStream::TypedStream ( const char *  dir,
const char *  archive,
const TypedStreamMode  mode 
) [inherited]

Open constructor for separate path and archive names.

Parameters:
dirDirectory to open archive in.
archiveName of the archive to open.
modeAccess mode, ie. read-only, write-only, etc.

Definition at line 78 of file cmtkTypedStream.cxx.

cmtk::TypedStream::TypedStream (  ) [inherited]

Default constructor.

Definition at line 63 of file cmtkTypedStream.cxx.

cmtk::TypedStream::TypedStream ( const char *  filename,
const TypedStreamMode  mode 
) [inherited]

Open constructor.

Parameters:
filenameName of the archive to open.
modeAccess mode, ie. read-only, write-only, etc.

Definition at line 70 of file cmtkTypedStream.cxx.

cmtk::TypedStreamStudylist::TypedStreamStudylist (  ) [inherited]

Default conctructor.

Definition at line 54 of file cmtkTypedStreamStudylist.cxx.

void cmtk::Study::UpdateFromVolume (  ) [virtual, inherited]

Update from volume data, possibly after the data has been changed.

Definition at line 97 of file cmtkStudy.cxx.

References cmtk::TypedArray::GetData(), cmtk::TypedArray::GetPercentile(), cmtk::TypedArray::GetRange(), cmtk::Types::Range< T >::m_LowerBound, and cmtk::Types::Range< T >::m_UpperBound.

void cmtk::VolumeIO::Write ( const UniformVolume volume,
const FileFormatID  format,
const char *  path,
const bool  verbose = false 
) [static, inherited]
void cmtk::TypedStreamStudylist::Write ( const char *  path,
const char *  referenceStudy,
const char *  floatingStudy,
const Xform xform 
) [static, inherited]
void cmtk::PGM::Write ( const char *  filename,
const ScalarImage image,
const Types::DataItem  greyFrom,
const Types::DataItem  greyTo 
) [static, inherited]

Write scalar image to PGM file.

Definition at line 144 of file cmtkPGM.cxx.

References cmtk::Memory::DeleteArray(), cmtk::ScalarImage::GetDims(), and cmtk::ScalarImage::GetNumberOfPixels().

void cmtk::ResourceFile::Write ( const char *  fileName ) const [inherited]

Write to resource file.

Definition at line 91 of file cmtkResourceFile.cxx.

References cmtk::Console::printf(), and cmtk::StdErr.

void cmtk::ClassStreamStudyList::Write ( const char *  path,
const StudyList studyList 
) [static, inherited]
void cmtk::VolumeIO::Write ( const UniformVolume volume,
const char *  pathAndFormat,
const bool  verbose = false 
) [static, inherited]

Write volume data to filesystem with automatic format parsing.

The output file format is determined automatically from the output name suffix.

Note:
Note that using ".hdr" will write a deprecated Analyze 7.5 hdr/img format pair with private extensions and questionable assumptions regarding the anatomical orientation of the image. To write a NIFTI hdr/img pair that avoids these problems, use the filename suffix ".img" (or write a single-file NIFTI using the ".nii" suffix).
Parameters:
volumeImage object that is written to disk.
pathAndFormatFilesystem path of the image to write.
verboseFlag for verbose operation: if true, write status information to standard error.

Definition at line 272 of file cmtkVolumeIO.cxx.

References cmtk::FILEFORMAT_ANALYZE_HDR, cmtk::FILEFORMAT_METAIMAGE, cmtk::FILEFORMAT_NIFTI_DETACHED, cmtk::FILEFORMAT_NIFTI_SINGLEFILE, cmtk::FILEFORMAT_NRRD, cmtk::FILEFORMAT_UNKNOWN, cmtk::FileUtils::GetAbsolutePath(), NULL, and cmtk::StdErr.

void cmtk::XformIO::Write ( const Xform xform,
const char *  path,
const bool  verbose = false 
) [static, inherited]
void cmtk::PGM::Write16bit ( const char *  filename,
const ScalarImage image,
const Types::DataItem  greyFrom = 0,
const Types::DataItem  greyTo = 65535 
) [static, inherited]

Write scalar image to 16bit PGM file.

Definition at line 186 of file cmtkPGM.cxx.

References cmtk::Memory::DeleteArray(), cmtk::TypedArray::Get(), cmtk::ScalarImage::GetDims(), and cmtk::ScalarImage::GetNumberOfPixels().

void cmtk::ScalarImageIO::WriteAnalyze ( const char *  filename,
const ScalarImage image 
) [static, inherited]
void cmtk::VolumeFromFile::WriteAnalyzeHdr ( const char *  pathHdr,
const UniformVolume volume,
const bool  verbose = false 
) [static, inherited]
TypedStreamCondition cmtk::TypedStream::WriteBool ( const char *  key,
const bool  value 
) [inherited]

Write a boolean value to an open archive.

Parameters:
keyThe name of the field under which to write this value in the archive.
valueValue to write to the archive under the given key.

Definition at line 730 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_OK.

Referenced by cmtk::AffineRegistrationCommandLine::OutputResultList(), cmtk::ImagePairNonrigidRegistrationCommandLine::OutputWarp(), cmtk::ElasticRegistrationCommandLine::OutputWarp(), cmtk::VoxelRegistration::ImagePreprocessor::WriteSettings(), and cmtk::ImagePairRegistration::ImagePreprocessor::WriteSettings().

TypedStreamCondition cmtk::TypedStream::WriteBoolArray ( const char *  key,
const byte array,
const int  size,
const int  valuesPerLine = 10 
) [inherited]

Write array of binay encoded boole values to an open archive.

Parameters:
keyThe name of the field under which to write this array in the archive.
arrayPointer to the array to be written.
sizeNumber of values in the array. This is the number of values written to the archive.
valuesPerLineOptional number of values per line of text written to the archive. This improves readability of the resulting archive as a text.

Definition at line 985 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_ERROR, cmtk::TYPEDSTREAM_ERROR_ARG, and cmtk::TYPEDSTREAM_OK.

TypedStreamCondition cmtk::TypedStream::WriteComment ( const char *  fmt,
  ... 
) [inherited]

Write a formated comment to an open archive.

Parameters:
fmtprintf-style format string for the remaining variable number of parameters

Definition at line 867 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_ERROR, cmtk::TYPEDSTREAM_ERROR_MODE, cmtk::TYPEDSTREAM_OK, and cmtk::TYPEDSTREAM_WRITE.

TypedStreamCondition cmtk::TypedStream::WriteComment ( const int  argc,
const char *  argv[] 
) [inherited]

Write string array as comment to an open archive.

Parameters:
argcNumber of strings in the array.
argvArray of string pointers.

Definition at line 899 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_ERROR, cmtk::TYPEDSTREAM_ERROR_MODE, cmtk::TYPEDSTREAM_OK, and cmtk::TYPEDSTREAM_WRITE.

TypedStreamCondition cmtk::TypedStream::WriteComment ( int  argc,
char *  argv[] 
) [inherited]

Write string array as comment to an open archive.

Parameters:
argcNumber of strings in the array.
argvArray of string pointers.

Definition at line 892 of file cmtkTypedStream.cxx.

TypedStreamCondition cmtk::TypedStream::WriteCoordinate ( const char *  key,
const Types::Coordinate  value 
) [inline, inherited]

Write an Types::Coordinate value to an open archive.

Parameters:
keyThe name of the field under which to write this value in the archive.
valueValue to write to the archive under the given key.

Definition at line 440 of file cmtkTypedStream.h.

TypedStreamCondition cmtk::TypedStream::WriteCoordinateArray ( const char *  key,
const Types::Coordinate array,
const int  size,
const int  valuesPerLine = 10 
) [inline, inherited]

Write array of double- or single precision values to an open archive.

Whether double- or single-precision data is written depends on the definition of the CMTK_COORDINATES_DOUBLE preprocessor symbol. This function is thus guaranteed to always match the Types::Coordinate type.

See also:
CMTK_COORDINATES_DOUBLE
Types::Coordinate
Parameters:
keyThe name of the field under which to write this array in the archive.
arrayPointer to the array to be written.
sizeNumber of values in the array. This is the number of values written to the archive.
valuesPerLineOptional number of values per line of text written to the archive. This improves readability of the resulting archive as a text.

Definition at line 513 of file cmtkTypedStream.h.

Referenced by cmtk::operator<<().

TypedStreamCondition cmtk::TypedStream::WriteDouble ( const char *  key,
const double  value 
) [inherited]

Write a double precision float value to an open archive.

Parameters:
keyThe name of the field under which to write this value in the archive.
valueValue to write to the archive under the given key.

Definition at line 790 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_OK.

Referenced by cmtk::ImagePairAffineRegistrationCommandLine::OutputResultList(), cmtk::AffineRegistrationCommandLine::OutputResultList(), cmtk::ImagePairNonrigidRegistrationCommandLine::OutputWarp(), cmtk::ElasticRegistrationCommandLine::OutputWarp(), cmtk::VoxelRegistration::ImagePreprocessor::WriteSettings(), and cmtk::ImagePairRegistration::ImagePreprocessor::WriteSettings().

TypedStreamCondition cmtk::TypedStream::WriteDoubleArray ( const char *  key,
const double *  array,
const int  size,
const int  valuesPerLine = 10 
) [inherited]

Write array of double-precision values to an open archive.

Parameters:
keyThe name of the field under which to write this array in the archive.
arrayPointer to the array to be written.
sizeNumber of values in the array. This is the number of values written to the archive.
valuesPerLineOptional number of values per line of text written to the archive. This improves readability of the resulting archive as a text.

Definition at line 1095 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_ERROR, cmtk::TYPEDSTREAM_ERROR_ARG, and cmtk::TYPEDSTREAM_OK.

TypedStreamCondition cmtk::TypedStream::WriteFloat ( const char *  key,
const float  value 
) [inherited]

Write a float value to an open archive.

Parameters:
keyThe name of the field under which to write this value in the archive.
valueValue to write to the archive under the given key.

Definition at line 770 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_OK.

TypedStreamCondition cmtk::TypedStream::WriteFloatArray ( const char *  key,
const float *  array,
const int  size,
const int  valuesPerLine = 10 
) [inherited]

Write array of single-precision values to an open archive.

Parameters:
keyThe name of the field under which to write this array in the archive.
arrayPointer to the array to be written.
sizeNumber of values in the array. This is the number of values written to the archive.
valuesPerLineOptional number of values per line of text written to the archive. This improves readability of the resulting archive as a text.

Definition at line 1040 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_ERROR, cmtk::TYPEDSTREAM_ERROR_ARG, and cmtk::TYPEDSTREAM_OK.

TypedStreamCondition cmtk::TypedStream::WriteInt ( const char *  key,
const int  value 
) [inherited]
TypedStreamCondition cmtk::TypedStream::WriteIntArray ( const char *  key,
const int *  array,
const int  size,
const int  valuesPerLine = 10 
) [inherited]

Write array of integer values to an open archive.

Parameters:
keyThe name of the field under which to write this array in the archive.
arrayPointer to the array to be written.
sizeNumber of values in the array. This is the number of values written to the archive.
valuesPerLineOptional number of values per line of text written to the archive. This improves readability of the resulting archive as a text.

Definition at line 930 of file cmtkTypedStream.cxx.

References cmtk::TYPEDSTREAM_ERROR, cmtk::TYPEDSTREAM_ERROR_ARG, and cmtk::TYPEDSTREAM_OK.

Referenced by cmtk::operator<<().

TypedStreamCondition cmtk::TypedStream::WriteItem ( const char *  key,
const Types::DataItem  value 
) [inline, inherited]

Write an Types::DataItem value to an open archive.

Parameters:
keyThe name of the field under which to write this value in the archive.
valueValue to write to the archive under the given key.

Definition at line 451 of file cmtkTypedStream.h.

TypedStreamCondition cmtk::TypedStream::WriteItemArray ( const char *  key,
const Types::DataItem array,
const int  size,
const int  valuesPerLine = 10 
) [inline, inherited]

Write array of double- or single precision values to an open archive.

Whether double- or single-precision data is written depends on the definition of the CMTK_DATA_DOUBLE preprocessor symbol. This function is thus guaranteed to always match the Types::DataItem type.

See also:
CMTK_DATA_DOUBLE
Types::DataItem
Parameters:
keyThe name of the field under which to write this array in the archive.
arrayPointer to the array to be written.
sizeNumber of values in the array. This is the number of values written to the archive.
valuesPerLineOptional number of values per line of text written to the archive. This improves readability of the resulting archive as a text.

Definition at line 532 of file cmtkTypedStream.h.

void cmtk::VolumeFromFile::WriteMetaImage ( const char *  pathHdr,
const UniformVolume volume 
) [static, inherited]
void cmtk::VolumeFromFile::WriteNifti ( const char *  pathImg,
const UniformVolume volume,
const bool  verbose = false 
) [static, inherited]
TypedStreamCondition cmtk::TypedStream::WriteString ( const char *  key,
const char *  value 
) [inherited]
TypedStreamCondition cmtk::TypedStream::WriteString ( const char *  key,
const std::string &  value 
) [inherited]

Write a string to an open archive.

Parameters:
keyThe name of the field under which to write this string in the archive.
valueString to write to the archive under the given key.

Definition at line 810 of file cmtkTypedStream.cxx.

cmtk::Study::~Study (  ) [virtual, inherited]

Destructor.

Definition at line 166 of file cmtkStudy.cxx.

cmtk::TypedStream::~TypedStream (  ) [virtual, inherited]

Destructor.

Close() is called to close a possibly open archive.

Definition at line 101 of file cmtkTypedStream.cxx.

cmtk::TypedStreamStudylist::~TypedStreamStudylist (  ) [inherited]

Destructor.

Definition at line 67 of file cmtkTypedStreamStudylist.cxx.


Variable Documentation

char cmtk::TypedStream::Buffer[TYPEDSTREAM_LIMIT_BUFFER] [private, inherited]

Buffer for the current line read from the archive.

Definition at line 587 of file cmtkTypedStream.h.

char* cmtk::TypedStream::BufferKey [private, inherited]

Pointer to the "key" part of the line currently in Buffer.

Definition at line 590 of file cmtkTypedStream.h.

char* cmtk::TypedStream::BufferValue [private, inherited]

Pointer to the "value" part of the line currently in Buffer.

Definition at line 593 of file cmtkTypedStream.h.

Definition at line 57 of file cmtkVolumeFromFileBioRad.cxx.

Referenced by cmtk::VolumeFromFile::ReadBioRad().

const char* const cmtk::CMTK_LEGACY_WRITE_IMAGES_RAS = "CMTK_LEGACY_WRITE_IMAGES_RAS"

Environment variable that turns off writing output images in the array order of the input images.

Definition at line 67 of file cmtkVolumeIO.cxx.

unsigned short cmtk::FileHeaderBioRad::color1 [inherited]

Definition at line 61 of file cmtkVolumeFromFileBioRad.cxx.

unsigned short cmtk::FileHeaderBioRad::color2 [inherited]

Definition at line 65 of file cmtkVolumeFromFileBioRad.cxx.

TypedStreamDebugFlag cmtk::TypedStream::DebugFlag [private, inherited]

Debug flag.

Definition at line 643 of file cmtkTypedStream.h.

unsigned short cmtk::FileHeaderBioRad::dummy[3] [inherited]

Definition at line 69 of file cmtkVolumeFromFileBioRad.cxx.

short cmtk::FileHeaderBioRad::edited [inherited]

Definition at line 66 of file cmtkVolumeFromFileBioRad.cxx.

FILE* cmtk::TypedStream::File [private, inherited]

Pointer to the actual file.

Definition at line 558 of file cmtkTypedStream.h.

unsigned short cmtk::FileHeaderBioRad::file_id [inherited]

Definition at line 62 of file cmtkVolumeFromFileBioRad.cxx.

Referenced by cmtk::VolumeFromFile::ReadBioRad().

const FileFormatMagic cmtk::FileFormatMagicNumbers[]
Initial value:
 {
  { 0, NULL, 0 }, 
  { 0, NULL, 0 }, 
  { 0, NULL, 0 }, 
  { 0, NULL, 0 }, 
  { 0, "! TYPEDSTREAM", 13 }, 
  { 0, "P5", 2 }, 
  { 128, "DICM", 4 }, 
  { 0, "Modality :=", 11 }, 
  { 0, "# AmiraMesh 3D", 14 },
  { 0, NULL, 0 }, 
  { 0, NULL, 0 }, 
  { 54, "\x39\x30", 2 }, 
  { 344, "ni1\x00", 4 }, 
  { 344, "n+1\x00", 4 }, 
  { 0, "AVW_ImageFile", 13 }, 
  { 0, NULL, 0 }, 
  { 0, "NRRD", 4 }, 
  { 0, "\x5C\x01\x00\x00", 4 }, 
  { 0, "\x00\x00\x01\x5C", 4 }, 
  { 0, "#Insight Transform File V1.0", 28 }, 
  { 0, NULL, 0 }  
}

Magic number records for known file types.

Definition at line 70 of file cmtkFileFormat.cxx.

const char * cmtk::FileFormatName

Table of file format ID names.

Definition at line 94 of file cmtkFileFormat.cxx.

gzFile cmtk::TypedStream::GzFile [private, inherited]

Pointer to the compressed file in decompression mode.

Definition at line 561 of file cmtkTypedStream.h.

VolumeIO::Initializer cmtk::VolumeIO::Initializer::Instance [static, private, inherited]

Instance of the initializer class.

Definition at line 169 of file cmtkVolumeIO.h.

short cmtk::FileHeaderBioRad::lens [inherited]

Definition at line 67 of file cmtkVolumeFromFileBioRad.cxx.

std::stack<int> cmtk::TypedStream::LevelStack [private, inherited]

Stack of open section levels.

This stack holds the starting positions of all currently open sections. The entries are byte positions relative to the beginning of the file.

Definition at line 599 of file cmtkTypedStream.h.

Definition at line 68 of file cmtkVolumeFromFileBioRad.cxx.

const char* cmtk::FileFormatMagic::magicString [inherited]

Magic number as string of characters.

Definition at line 64 of file cmtkFileFormat.cxx.

const size_t cmtk::FileFormatMagic::magicStringLength [inherited]

Length of magic number string (necessary due to Null characters).

Definition at line 66 of file cmtkFileFormat.cxx.

short cmtk::FileHeaderBioRad::merged [inherited]

Definition at line 60 of file cmtkVolumeFromFileBioRad.cxx.

TypedStreamMode cmtk::TypedStream::Mode [private, inherited]

Mode the current archive was opened with.

Definition at line 564 of file cmtkTypedStream.h.

unsigned short cmtk::FileHeaderBioRad::n [inherited]

Definition at line 58 of file cmtkVolumeFromFileBioRad.cxx.

char cmtk::FileHeaderBioRad::name[32] [inherited]

Definition at line 59 of file cmtkVolumeFromFileBioRad.cxx.

Definition at line 56 of file cmtkVolumeFromFileBioRad.cxx.

Referenced by cmtk::VolumeFromFile::ReadBioRad().

short cmtk::FileHeaderBioRad::npic [inherited]

Definition at line 53 of file cmtkVolumeFromFileBioRad.cxx.

Referenced by cmtk::VolumeFromFile::ReadBioRad().

unsigned short cmtk::FileHeaderBioRad::ny [inherited]

Definition at line 52 of file cmtkVolumeFromFileBioRad.cxx.

Referenced by cmtk::VolumeFromFile::ReadBioRad().

int cmtk::TypedStream::PrecisionDouble [private, inherited]

Number of significant digits for "double" fields.

As all float numbers are written to the archive as strings, part of the native resolution is lost. This field determines, how many significant digits are preserved when converting double precision float numbers to strings.

Definition at line 584 of file cmtkTypedStream.h.

int cmtk::TypedStream::PrecisionFloat [private, inherited]

Number of significant digits for "float" fields.

As all float numbers are written to the archive as strings, part of the native resolution is lost. This field determines, how many significant digits are preserved when converting single precision float numbers to strings.

Definition at line 576 of file cmtkTypedStream.h.

Definition at line 55 of file cmtkVolumeFromFileBioRad.cxx.

Definition at line 54 of file cmtkVolumeFromFileBioRad.cxx.

Definition at line 64 of file cmtkVolumeFromFileBioRad.cxx.

Definition at line 63 of file cmtkVolumeFromFileBioRad.cxx.

char* cmtk::TypedStream::SplitPosition [mutable, private, inherited]

Internal position pointer for "StringSplit()".

Definition at line 634 of file cmtkTypedStream.h.

TypedStreamStatus cmtk::TypedStream::Status [private, inherited]

Holds the status of the last operation.

Definition at line 568 of file cmtkTypedStream.h.

bool cmtk::VolumeIO::WriteCompressedOn = true [static, private, inherited]

Global setting: write compressed images.

Static global flag: when true, files are written compressed whenever possible.

Definition at line 155 of file cmtkVolumeIO.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines