ISIS Core Library 0.7.2 (api 3.0.0)
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes

isis::data::Image Class Reference

Main class for generic 4D-images. More...

#include <image.hpp>

Inheritance diagram for isis::data::Image:
isis::data::_internal::NDimensional< 4 > isis::util::PropertyMap isis::data::TypedImage< T > isis::data::MemImage< T >

Public Types

typedef
_internal::ImageIteratorTemplate
< const Chunk
const_iterator
typedef const_iterator::reference const_reference
typedef
_internal::ImageIteratorTemplate
< Chunk
iterator
enum  orientation {
  axial, reversed_axial, sagittal, reversed_sagittal,
  coronal, reversed_coronal
}
typedef iterator::reference reference

Public Member Functions

iterator begin ()
const_iterator begin () const
bool checkMakeClean ()
size_t compare (const Image &comp) const
 Compares the voxel-values of this image to the given.
bool convertToType (short unsigned int ID, isis::data::autoscaleOption scaleopt=autoscale)
 Ensure, the image has the type with the requested ID.
template<typename T >
MemChunk< T > copyAsMemChunk () const
 Copy all voxel data into a new MemChunk.
template<typename T >
ValueArray< T > copyAsValueArray () const
 Copy all voxel data into a new ValueArray.
Image copyByID (unsigned short ID=0, scaling_pair scaling=scaling_pair()) const
 Create a new Image of consisting of deep copied chunks.
std::vector< isis::data::ChunkcopyChunksToVector (bool copy_metadata=true) const
 Get a sorted list of the chunks of the image.
template<typename T >
void copyToMem (T *dst, size_t len, scaling_pair scaling=scaling_pair()) const
 Copy all voxel data of the image into memory.
void copyToValueArray (data::ValueArrayBase &dst, scaling_pair scaling=scaling_pair()) const
 Copy all voxel data of the image into an existing ValueArray using its type.
iterator end ()
const_iterator end () const
size_t foreachChunk (ChunkOp &op, bool copyMetaData=false)
 Run a functor with the base ChunkOp on every cunk in the image.
template<typename TYPE >
size_t foreachVoxel (VoxelOp< TYPE > &op)
 Run a functor with the base VoxelOp on every chunk in the image.
const Chunk getChunk (size_t first, size_t second=0, size_t third=0, size_t fourth=0, bool copy_metadata=true) const
 Get the chunk that contains the voxel at the given coordinates.
Chunk getChunk (size_t first, size_t second=0, size_t third=0, size_t fourth=0, bool copy_metadata=true)
 Get the chunk that contains the voxel at the given coordinates.
template<typename TYPE >
Chunk getChunkAs (size_t first, size_t second=0, size_t third=0, size_t fourth=0, bool copy_metadata=true) const
 Get the chunk that contains the voxel at the given coordinates in the given type.
template<typename TYPE >
Chunk getChunkAs (const scaling_pair &scaling, size_t first, size_t second=0, size_t third=0, size_t fourth=0, bool copy_metadata=true) const
 Get the chunk that contains the voxel at the given coordinates in the given type (fast version).
Chunk getChunkAt (size_t at, bool copy_metadata=true) const
 Get a chunk via index (and the lookup table).
std::list< util::PropertyValuegetChunksProperties (const util::PropertyMap::KeyType &key, bool unique=false) const
 Get a list of the properties of the chunks for the given key.
util::fvector3 getFoV () const
util::ivector4 getIndexFromPhysicalCoords (const util::fvector3 &physicalCoords) const
 Computes the voxel index of the given physical coordinates (coordinates in scanner space) This function does not perform any test if the physical coordinates are inside the image.
orientation getMainOrientation () const
unsigned short getMajorTypeID () const
 Get the type of the chunk with "biggest" type.
std::string getMajorTypeName () const
size_t getMaxBytesPerVoxel () const
 Get the size (in bytes) for the voxels in the image.
std::pair
< util::ValueReference,
util::ValueReference
getMinMax () const
 Get the maximum and the minimum voxel value of the image as a pair of ValueReference-objects.
template<typename T >
std::pair< T, T > getMinMaxAs () const
 Get the maximum and the minimum voxel value of the image.
size_t getNrOfColumns () const
size_t getNrOfRows () const
size_t getNrOfSlices () const
size_t getNrOfTimesteps () const
util::fvector3 getPhysicalCoordsFromIndex (const util::ivector4 &index) const
 Computes the physical coordinates (in scanner space) of the given voxel index.
scaling_pair getScalingTo (unsigned short typeID, autoscaleOption scaleopt=autoscale) const
 for each chunk get the scaling (and offset) which would be used in an conversion to the given type
const util::ValueReference getVoxelValue (size_t nrOfColumns, size_t nrOfRows=0, size_t nrOfSlices=0, size_t nrOfTimesteps=0) const
std::string identify (bool withpath=true) const
 Generate a string identifying the image The identifier is made of

  • sequenceNumber
  • sequenceDescription if available
  • the common path of all chunk-sources (or the source file, if there is only one) if withpath is true
  • sequenceStart if available.

 Image (const Image &ref)
 Copy constructor.
template<typename T >
 Image (std::vector< T > &chunks, dimensions min_dim=rowDim)
 Create image from a vector of Chunks or objects with the base Chunk.
 Image (const Chunk &chunk, dimensions min_dim=rowDim)
 Create image from a single chunk.
template<typename T >
 Image (std::list< T > &chunks, dimensions min_dim=rowDim)
 Create image from a list of Chunks or objects with the base Chunk.
bool insertChunk (const Chunk &chunk)
 Insert a Chunk into the Image.
template<typename T >
size_t insertChunksFromList (std::list< T > &chunks)
 Insert Chunks or objects with the base Chunk from a sequence container into the Image.
bool isClean () const
bool isEmpty () const
dimensions mapScannerAxisToImageDimension (scannerAxis scannerAxes)
 Maps the given scanner Axis to the dimension with the minimal angle.
Imageoperator= (const Image &ref)
 Copy operator.
bool reIndex ()
 (Re)computes the image layout and metadata.
void setIndexingDim (dimensions d=rowDim)
 Enforce indexing to start at a given dimension.
void setVoxelValue (const util::ValueReference &val, size_t nrOfColumns, size_t nrOfRows=0, size_t nrOfSlices=0, size_t nrOfTimesteps=0)
size_t spliceDownTo (dimensions dim)
 Automatically splice the given dimension and all dimensions above.
bool transformCoords (boost::numeric::ublas::matrix< float > transform_matrix, bool transformCenterIsImageCenter=false)
 Transforms the image coordinate system into an other system by multiplying the orientation matrix with a user defined transformation matrix.
bool updateOrientationMatrices ()
template<typename T >
const T & voxel (size_t first, size_t second=0, size_t third=0, size_t fourth=0) const
 Get a const reference to the voxel value at the given coordinates.
template<typename T >
T & voxel (size_t first, size_t second=0, size_t third=0, size_t fourth=0)
 This method returns a reference to the voxel value at the given coordinates.

Static Public Attributes

static const char * neededProperties

Protected Member Functions

ChunkchunkAt (size_t at)
 Access a chunk via index (and the lookup table) The Chunk will only have metadata which are unique to it - so it might be invalid (run join on it using the image as parameter to insert all non-unique-metadata).
size_t getChunkStride (size_t base_stride=1)
 Search for a dimensional break in all stored chunks.
 Image ()
 Creates an empty Image object.

Protected Attributes

bool clean
std::vector< boost::shared_ptr
< Chunk > > 
lookup
util::fvector3 m_ColumnVec
util::fvector3 m_ColumnVecInv
util::fvector3 m_Offset
util::fvector3 m_RowVec
util::fvector3 m_RowVecInv
util::fvector3 m_SliceVec
util::fvector3 m_SliceVecInv
_internal::SortedChunkList set

Static Protected Attributes

static const char * defaultChunkEqualitySet

Detailed Description

Main class for generic 4D-images.

Definition at line 186 of file image.hpp.


Member Typedef Documentation

Reimplemented in isis::data::TypedImage< T >.

Definition at line 205 of file image.hpp.

typedef const_iterator::reference isis::data::Image::const_reference

Reimplemented in isis::data::TypedImage< T >.

Definition at line 207 of file image.hpp.

Reimplemented in isis::data::TypedImage< T >.

Definition at line 204 of file image.hpp.

typedef iterator::reference isis::data::Image::reference

Reimplemented in isis::data::TypedImage< T >.

Definition at line 206 of file image.hpp.


Member Enumeration Documentation

Enumerator:
axial 
reversed_axial 
sagittal 
reversed_sagittal 
coronal 
reversed_coronal 

Definition at line 202 of file image.hpp.


Constructor & Destructor Documentation

isis::data::Image::Image ( ) [protected]

Creates an empty Image object.

Definition at line 36 of file image.cpp.

isis::data::Image::Image ( const Image ref)

Copy constructor.

Copies all elements, only the voxel-data (in the chunks) are referenced.

Definition at line 56 of file image.cpp.

template<typename T >
isis::data::Image::Image ( std::list< T > &  chunks,
dimensions  min_dim = rowDim 
) [inline]

Create image from a list of Chunks or objects with the base Chunk.

Removes used chunks from the given list. So afterwards the list consists of the rejected chunks.

Definition at line 299 of file image.hpp.

template<typename T >
isis::data::Image::Image ( std::vector< T > &  chunks,
dimensions  min_dim = rowDim 
) [inline]

Create image from a vector of Chunks or objects with the base Chunk.

Removes used chunks from the given list. So afterwards the list consists of the rejected chunks.

Definition at line 311 of file image.hpp.

isis::data::Image::Image ( const Chunk chunk,
dimensions  min_dim = rowDim 
)

Create image from a single chunk.

Definition at line 42 of file image.cpp.


Member Function Documentation

Image::iterator isis::data::Image::begin ( )

Reimplemented in isis::data::TypedImage< T >.

Definition at line 1048 of file image.cpp.

Image::const_iterator isis::data::Image::begin ( ) const

Reimplemented in isis::data::TypedImage< T >.

Definition at line 1062 of file image.cpp.

bool isis::data::Image::checkMakeClean ( )

Definition at line 84 of file image.cpp.

Chunk & isis::data::Image::chunkAt ( size_t  at) [protected]

Access a chunk via index (and the lookup table) The Chunk will only have metadata which are unique to it - so it might be invalid (run join on it using the image as parameter to insert all non-unique-metadata).

Definition at line 570 of file image.cpp.

size_t isis::data::Image::compare ( const Image comp) const

Compares the voxel-values of this image to the given.

Returns:
the amount of the different voxels

Definition at line 797 of file image.cpp.

bool isis::data::Image::convertToType ( short unsigned int  ID,
isis::data::autoscaleOption  scaleopt = autoscale 
)

Ensure, the image has the type with the requested ID.

If the typeID of any chunk is not equal to the requested ID, the data of the chunk is replaced by an converted version. The conversion is done using the value range of the image.

Returns:
false if there was an error

Definition at line 911 of file image.cpp.

template<typename T >
MemChunk<T> isis::data::Image::copyAsMemChunk ( ) const [inline]

Copy all voxel data into a new MemChunk.

This creates a MemChunk of the requested type and the same size as the Image and then copies all voxeldata of the image into that Chunk.

If neccessary a conversion into T is done using min/max of the image.

Also the properties of the first chunk are join-ed with those of the image and copied.

Note:
This is a deep copy, no data will be shared between the Image and the MemChunk. It will waste a lot of memory, use it wisely.
Returns:
a MemChunk containing the voxeldata and the properties of the Image

Definition at line 667 of file image.hpp.

template<typename T >
ValueArray<T> isis::data::Image::copyAsValueArray ( ) const [inline]

Copy all voxel data into a new ValueArray.

This creates a ValueArray of the requested type and the same length as the images volume and then copies all voxeldata of the image into that ValueArray.

If neccessary a conversion into T is done using min/max of the image.

Note:
This is a deep copy, no data will be shared between the Image and the ValueArray. It will waste a lot of memory, use it wisely.
Returns:
a ValueArray containing the voxeldata of the Image (but not its Properties)

Definition at line 683 of file image.hpp.

Image isis::data::Image::copyByID ( unsigned short  ID = 0,
scaling_pair  scaling = scaling_pair() 
) const

Create a new Image of consisting of deep copied chunks.

If neccessary a conversion into the requested type is done using the given scale.

Parameters:
IDthe ID of the requested type (type of the respective source chunk is used if not given)
scalingthe scaling to be used when converting the data (will be determined automatically if not given)
Returns:
a new deep copied Image of the same size
std::vector< Chunk > isis::data::Image::copyChunksToVector ( bool  copy_metadata = true) const

Get a sorted list of the chunks of the image.

Parameters:
copy_metadataset to false to prevent the metadata of the image to be copied into the results. This will improve performance, but the chunks may lack important properties.
Note:
These chunks will be cheap copies, so changing their voxels will change the voxels of the image. But you can for example use
 std::vector< data::Chunk > cheapchunks=img.copyChunksToVector(); //this is a cheap copy
 std::vector< data::MemChunk<float> > memchunks(cheapchunks.begin(),cheapchunks.end()); // this is not not
to get deep copies.

Definition at line 650 of file image.cpp.

template<typename T >
void isis::data::Image::copyToMem ( T *  dst,
size_t  len,
scaling_pair  scaling = scaling_pair() 
) const [inline]

Copy all voxel data of the image into memory.

If neccessary a conversion into T is done using min/max of the image.

Parameters:
dstc-pointer for the memory to copy into
lenthe allocated size of that memory in elements
scalingthe scaling to be used when converting the data (will be determined automatically if not given)

Definition at line 629 of file image.hpp.

void isis::data::Image::copyToValueArray ( data::ValueArrayBase dst,
scaling_pair  scaling = scaling_pair() 
) const

Copy all voxel data of the image into an existing ValueArray using its type.

If neccessary a conversion into the datatype of the target is done using min/max of the image.

Parameters:
dstValueArray to copy into
scalingthe scaling to be used when converting the data (will be determined automatically if not given)

Definition at line 584 of file image.cpp.

Image::const_iterator isis::data::Image::end ( ) const

Reimplemented in isis::data::TypedImage< T >.

Definition at line 1075 of file image.cpp.

Image::iterator isis::data::Image::end ( )

Reimplemented in isis::data::TypedImage< T >.

Definition at line 1061 of file image.cpp.

size_t isis::data::Image::foreachChunk ( ChunkOp op,
bool  copyMetaData = false 
)

Run a functor with the base ChunkOp on every cunk in the image.

This does not check the types of the images. So if your functor needs a specific type, use TypedImage.

Parameters:
opa functor object which inherits ChunkOP
copyMetaDataif true the metadata of the image are copied into the chunks before calling the functor

Definition at line 991 of file image.cpp.

template<typename TYPE >
size_t isis::data::Image::foreachVoxel ( VoxelOp< TYPE > &  op) [inline]

Run a functor with the base VoxelOp on every chunk in the image.

If any chunk does not have the requested type it will be converted. So the result is equivalent to TypedImage<TYPE>. If these conversion failes no operation is done, and false is returned.

Parameters:
opa functor object which inherits ChunkOp

Definition at line 746 of file image.hpp.

const Chunk isis::data::Image::getChunk ( size_t  first,
size_t  second = 0,
size_t  third = 0,
size_t  fourth = 0,
bool  copy_metadata = true 
) const

Get the chunk that contains the voxel at the given coordinates.

If the image is not clean, behaviour is undefined. (See Image::commonGet).

Parameters:
firstThe first coordinate in voxel space. Usually the x value / the read-encoded position.
secondThe second coordinate in voxel space. Usually the y value / the column-encoded position.
thirdThe third coordinate in voxel space. Ususally the z value / the slice-encoded position.
fourthThe fourth coordinate in voxel space. Usually the time value.
copy_metadataif true the metadata of the image are merged into the returned chunk
Returns:
a copy of the chunk that contains the voxel at the given coordinates. (Reminder: Chunk-copies are cheap, so the image data are NOT copied but referenced)

Definition at line 579 of file image.cpp.

Chunk isis::data::Image::getChunk ( size_t  first,
size_t  second = 0,
size_t  third = 0,
size_t  fourth = 0,
bool  copy_metadata = true 
)

Get the chunk that contains the voxel at the given coordinates.

If the image is not clean Image::reIndex() will be run.

Parameters:
firstThe first coordinate in voxel space. Usually the x value.
secondThe second coordinate in voxel space. Usually the y value.
thirdThe third coordinate in voxel space. Ususally the z value.
fourthThe fourth coordinate in voxel space. Usually the time value.
copy_metadataif true the metadata of the image are merged into the returned chunk
Returns:
a copy of the chunk that contains the voxel at the given coordinates. (Reminder: Chunk-copies are cheap, so the image data are NOT copied but referenced)

Definition at line 574 of file image.cpp.

template<typename TYPE >
Chunk isis::data::Image::getChunkAs ( size_t  first,
size_t  second = 0,
size_t  third = 0,
size_t  fourth = 0,
bool  copy_metadata = true 
) const [inline]

Get the chunk that contains the voxel at the given coordinates in the given type.

If the accordant chunk has type T a cheap copy is returned. Otherwise a MemChunk-copy of the requested type is created from it. In this case the minimum and maximum values of the image are computed and used for the MemChunk constructor.

Parameters:
firstThe first coordinate in voxel space. Usually the x value.
secondThe second coordinate in voxel space. Usually the y value.
thirdThe third coordinate in voxel space. Ususally the z value.
fourthThe fourth coordinate in voxel space. Usually the time value.
copy_metadataif true the metadata of the image are merged into the returned chunk
Returns:
a (maybe converted) chunk containing the voxel value at the given coordinates.

Definition at line 483 of file image.hpp.

template<typename TYPE >
Chunk isis::data::Image::getChunkAs ( const scaling_pair &  scaling,
size_t  first,
size_t  second = 0,
size_t  third = 0,
size_t  fourth = 0,
bool  copy_metadata = true 
) const [inline]

Get the chunk that contains the voxel at the given coordinates in the given type (fast version).

If the accordant chunk has type T a cheap copy is returned. Otherwise a MemChunk-copy of the requested type is created from it. In this case the minimum and maximum values of the image are computed and used for the MemChunk constructor.

Parameters:
firstThe first coordinate in voxel space. Usually the x value.
secondThe second coordinate in voxel space. Usually the y value.
thirdThe third coordinate in voxel space. Ususally the z value.
fourthThe fourth coordinate in voxel space. Usually the time value.
copy_metadataif true the metadata of the image are merged into the returned chunk
Returns:
a (maybe converted) chunk containing the voxel value at the given coordinates.
This version does not compute the scaling, and thus is much faster.

Parameters:
scalingthe scaling (scale and offset) to be used if a conversion to the requested type is neccessary.
firstThe first coordinate in voxel space. Usually the x value.
secondThe second coordinate in voxel space. Usually the y value.
thirdThe third coordinate in voxel space. Ususally the z value.
fourthThe fourth coordinate in voxel space. Usually the time value.
copy_metadataif true the metadata of the image are merged into the returned chunk
Returns:
a (maybe converted) chunk containing the voxel value at the given coordinates.

Definition at line 498 of file image.hpp.

Chunk isis::data::Image::getChunkAt ( size_t  at,
bool  copy_metadata = true 
) const

Get a chunk via index (and the lookup table).

The returned chunk will be a cheap copy of the original chunk. If copy_metadata is true the metadata of the image is copied into the chunk.

Definition at line 563 of file image.cpp.

std::list< util::PropertyValue > isis::data::Image::getChunksProperties ( const util::PropertyMap::KeyType key,
bool  unique = false 
) const

Get a list of the properties of the chunks for the given key.

Parameters:
keythe name of the property to search for
uniquewhen true empty or consecutive duplicates wont be added

Definition at line 723 of file image.cpp.

size_t isis::data::Image::getChunkStride ( size_t  base_stride = 1) [protected]

Search for a dimensional break in all stored chunks.

This function searches for two chunks whose (geometrical) distance is more than twice the distance between the first and the second chunk. It wll assume a dimensional break at this position.

Normally chunks are beneath each other (like characters in a text) so their distance is more or less constant. But if there is a dimensional break (analogous to the linebreak in a text) the distance between this particular chunks/characters is bigger than twice the normal distance

For example for an image of 2D-chunks (slices) getChunkStride(1) will get the number of slices (size of third dim) and getChunkStride(slices) will get the number of timesteps

Parameters:
base_stridethe base_stride for the iteration between chunks (1 for the first dimension, one "line" for the second and soon...)
Returns:
the length of this chunk-"line" / the stride

Definition at line 666 of file image.cpp.

util::fvector3 isis::data::Image::getFoV ( ) const

Definition at line 1028 of file image.cpp.

util::ivector4 isis::data::Image::getIndexFromPhysicalCoords ( const util::fvector3 physicalCoords) const

Computes the voxel index of the given physical coordinates (coordinates in scanner space) This function does not perform any test if the physical coordinates are inside the image.

See getPhysicalCoordsFromIndex for vice versa purpose.

Parameters:
physicalCoordsthe physical coords from which you want to get the voxel index.
Returns:
voxel index associated with the given physicalCoords

Definition at line 190 of file image.cpp.

Image::orientation isis::data::Image::getMainOrientation ( ) const

Definition at line 830 of file image.cpp.

unsigned short isis::data::Image::getMajorTypeID ( ) const

Get the type of the chunk with "biggest" type.

Determines the minimum and maximum of the image, (and with that the types of these limits). If they are not the same, the type which can store the other type is selected. E.g. if min is "-5(int8_t)" and max is "1000(int16_t)" "int16_t" is selected. Warning1: this will fail if min is "-5(int8_t)" and max is "70000(uint16_t)" Warning2: the cost of this is O(n) while Chunk::getTypeID is O(1) - so do not use it in loops Warning3: the result is not exact - so never use it to determine the type for Image::voxel (Use TypedImage to get an image with an guaranteed type)

Returns:
a number which is equal to the ValueArray::staticID of the selected type.

Definition at line 876 of file image.cpp.

std::string isis::data::Image::getMajorTypeName ( ) const
Returns:
the typename correspondig to the result of typeID

Definition at line 907 of file image.cpp.

size_t isis::data::Image::getMaxBytesPerVoxel ( ) const

Get the size (in bytes) for the voxels in the image.

Warning:
As each Chunk of the image can have a different type (and thus bytesize), this does not neccesarly return the correct size for all voxels in the image. It will rather return the biggest size.
Note:
The easiest (and most expensive) way to make sure you have the same bytesize accross the whole Image, is to run:
 image.convertToType(image.getMajorTypeID());
assuming "image" is your image.
Returns:
Get the biggest size (in bytes) accross all voxels in the image.

Definition at line 745 of file image.cpp.

std::pair< util::ValueReference, util::ValueReference > isis::data::Image::getMinMax ( ) const

Get the maximum and the minimum voxel value of the image as a pair of ValueReference-objects.

Definition at line 758 of file image.cpp.

template<typename T >
std::pair<T, T> isis::data::Image::getMinMaxAs ( ) const [inline]

Get the maximum and the minimum voxel value of the image.

The results are converted to T. If they dont fit an error ist send.

Returns:
a pair of T storing the minimum and maximum values of the image.

Definition at line 553 of file image.hpp.

size_t isis::data::Image::getNrOfColumns ( ) const
Returns:
the number of columns of the image

Definition at line 1014 of file image.cpp.

size_t isis::data::Image::getNrOfRows ( ) const
Returns:
the number of rows of the image

Definition at line 1018 of file image.cpp.

size_t isis::data::Image::getNrOfSlices ( ) const
Returns:
the number of slices of the image

Definition at line 1021 of file image.cpp.

size_t isis::data::Image::getNrOfTimesteps ( ) const
Returns:
the number of timesteps of the image

Definition at line 1024 of file image.cpp.

util::fvector3 isis::data::Image::getPhysicalCoordsFromIndex ( const util::ivector4 index) const

Computes the physical coordinates (in scanner space) of the given voxel index.

This function does not perform any test if the voxel index is inside the image. See getIndexFromPhysicalCoords for vice versa purpose.

Parameters:
indexthe voxel index from which you want to get the physical coordinates
Returns:
physical coordinates associated with the given voxel index

Definition at line 179 of file image.cpp.

scaling_pair isis::data::Image::getScalingTo ( unsigned short  typeID,
autoscaleOption  scaleopt = autoscale 
) const

for each chunk get the scaling (and offset) which would be used in an conversion to the given type

const util::ValueReference isis::data::Image::getVoxelValue ( size_t  nrOfColumns,
size_t  nrOfRows = 0,
size_t  nrOfSlices = 0,
size_t  nrOfTimesteps = 0 
) const

Definition at line 1077 of file image.cpp.

std::string isis::data::Image::identify ( bool  withpath = true) const

Generate a string identifying the image The identifier is made of

  • sequenceNumber
  • sequenceDescription if available
  • the common path of all chunk-sources (or the source file, if there is only one) if withpath is true
  • sequenceStart if available.

Parameters:
withpathadd the common path of all sources to the identifying string

Definition at line 1090 of file image.cpp.

bool isis::data::Image::insertChunk ( const Chunk chunk)

Insert a Chunk into the Image.

The insertion is sorted and unique. So the Chunk will be inserted behind a geometrically "lower" Chunk if there is one. If there is allready a Chunk at the proposed position this Chunk wont be inserted.

Parameters:
chunkThe Chunk to be inserted
Returns:
true if the Chunk was inserted, false otherwise.

Definition at line 131 of file image.cpp.

template<typename T >
size_t isis::data::Image::insertChunksFromList ( std::list< T > &  chunks) [inline]

Insert Chunks or objects with the base Chunk from a sequence container into the Image.

Removes used chunks from the given sequence container. So afterwards the container consists of the rejected chunks.

Returns:
amount of successfully inserted chunks

Definition at line 327 of file image.hpp.

bool isis::data::Image::isClean ( ) const

Definition at line 96 of file image.cpp.

bool isis::data::Image::isEmpty ( ) const
Returns:
true if there is no chunk in the image

Reimplemented from isis::util::PropertyMap.

Definition at line 551 of file image.cpp.

dimensions isis::data::Image::mapScannerAxisToImageDimension ( scannerAxis  scannerAxes)

Maps the given scanner Axis to the dimension with the minimal angle.

This is done by latching the orientation of the image by setting the biggest absolute value of each orientation vector to 1 and the others to 0. Example: (-0.8) (1) ( 0.2) -> (0) (this is done for the rowVec, columnVec and sliceVec) (-0.1) (0)

This latched orientation is used to map from the scanner axes to the dimension.

Parameters:
scannerAxesthe axes of the scanner you want to map to dimension of the image.
Returns:
the mapped image dimension

Definition at line 307 of file image.cpp.

Image & isis::data::Image::operator= ( const Image ref)

Copy operator.

Copies all elements, only the voxel-data (in the chunks) are referenced.

Reimplemented in isis::data::TypedImage< T >, and isis::data::MemImage< T >.

Definition at line 62 of file image.cpp.

bool isis::data::Image::reIndex ( )

(Re)computes the image layout and metadata.

The image will be "clean" on success.

Returns:
true if the image was successfully reindexed and is valid, false otherwise.

Definition at line 326 of file image.cpp.

void isis::data::Image::setIndexingDim ( dimensions  d = rowDim)

Enforce indexing to start at a given dimension.

Normally indexing starts at the dimensionality of the inserted chunks. So, an Image of 2D-Chunks (slices) will start indexing at the 3rd dimension. If the dimension given here is bigger than the dimensionality of the chunks reindexing will override that and start indexing at the given dimension. E.g. setIndexingDim(timeDim) will enforce indexing of a Image of 10 30x30-slices at the time dimension resulting in an 30x30x1x10 image instead of an 30x30x10x1 image. If the indexing dimension is set after the Image was indexed it will be indexed again.

Parameters:
dthe minimal indexing dimension to be used

Definition at line 169 of file image.cpp.

void isis::data::Image::setVoxelValue ( const util::ValueReference val,
size_t  nrOfColumns,
size_t  nrOfRows = 0,
size_t  nrOfSlices = 0,
size_t  nrOfTimesteps = 0 
)

Definition at line 1083 of file image.cpp.

size_t isis::data::Image::spliceDownTo ( dimensions  dim)

Automatically splice the given dimension and all dimensions above.

e.g. spliceDownTo(sliceDim) will result in an image made of slices (aka 2d-chunks).

Definition at line 932 of file image.cpp.

bool isis::data::Image::transformCoords ( boost::numeric::ublas::matrix< float >  transform_matrix,
bool  transformCenterIsImageCenter = false 
)

Transforms the image coordinate system into an other system by multiplying the orientation matrix with a user defined transformation matrix.

Additionally, the index origin will be transformed into the new coordinate system. This function only changes the orientation information (rowVec, columnVec, sliceVec, indexOrigin) of the image but will not change the image itself.

Warning:
If you call this function with a matrix other than the identidy matrix, it's not guaranteed that the image is still in ISIS space according to the DICOM conventions. Eventuelly some ISIS algorithms that depend on correct image orientations won't work as expected. Use this method with caution!
Parameters:
transform_matrixthe transformation matrix can be any type of rigid and affine transformation
transformCenterIsImageCenterif this parameter is true, the center of the image will be translated to the isocenter of the scanner prior applying the transform_matrix. Eventually, it will be translated to its initial position. For example this is the way SPM flips its images when converting from DICOM to nifti.
Returns:
returns if the transformation was successfuly

Definition at line 260 of file image.cpp.

bool isis::data::Image::updateOrientationMatrices ( )

Definition at line 206 of file image.cpp.

template<typename T >
T& isis::data::Image::voxel ( size_t  first,
size_t  second = 0,
size_t  third = 0,
size_t  fourth = 0 
) [inline]

This method returns a reference to the voxel value at the given coordinates.

The voxel reference provides reading and writing access to the refered value.

If the image is not clean, reIndex will be run. If the requested voxel is not of type T, an error will be raised.

Parameters:
firstThe first coordinate in voxel space. Usually the x value / the read-encoded position..
secondThe second coordinate in voxel space. Usually the y value / the column-encoded position.
thirdThe third coordinate in voxel space. Ususally the z value / the time-encoded position.
fourthThe fourth coordinate in voxel space. Usually the time value.
Returns:
A reference to the addressed voxel value. Reading and writing access is provided.

Definition at line 387 of file image.hpp.

template<typename T >
const T& isis::data::Image::voxel ( size_t  first,
size_t  second = 0,
size_t  third = 0,
size_t  fourth = 0 
) const [inline]

Get a const reference to the voxel value at the given coordinates.

Parameters:
firstThe first coordinate in voxel space. Usually the x value / the read-encoded position..
secondThe second coordinate in voxel space. Usually the y value / the column-encoded position.
thirdThe third coordinate in voxel space. Ususally the z value / the time-encoded position.
fourthThe fourth coordinate in voxel space. Usually the time value.

If the requested voxel is not of type T, an error will be raised.

Returns:
A reference to the addressed voxel value. Only reading access is provided

Definition at line 406 of file image.hpp.


Field Documentation

bool isis::data::Image::clean [protected]

Definition at line 249 of file image.hpp.

const char* isis::data::Image::defaultChunkEqualitySet [static, protected]

Definition at line 250 of file image.hpp.

std::vector<boost::shared_ptr<Chunk> > isis::data::Image::lookup [protected]

Definition at line 211 of file image.hpp.

Definition at line 282 of file image.hpp.

Definition at line 283 of file image.hpp.

Definition at line 286 of file image.hpp.

Definition at line 280 of file image.hpp.

Definition at line 281 of file image.hpp.

Definition at line 284 of file image.hpp.

Definition at line 285 of file image.hpp.

Definition at line 208 of file image.hpp.

_internal::SortedChunkList isis::data::Image::set [protected]

Definition at line 210 of file image.hpp.


The documentation for this class was generated from the following files: