creaImageIO_lib
creaImageIO::ImageExtent Class Reference

Class used to represent the actual state of the image selected and to perform comparisons on its values. More...

Public Member Functions

 ImageExtent (const std::string &x, const std::string &y, const std::string &z, const std::string &t)
 
void Clear ()
 Clears the extent. More...
 
bool IsCompatible (const ImageExtent &)
 Returns true if the two extents are compatible. More...
 
void Add (const ImageExtent &)
 Adds the extent passed as a parameter to the current extent. More...
 
int Get (int i)
 Returns the ieth position of the extent. More...
 
void SetDimension (int dim)
 Returns the dimension of the current image. More...
 
int GetDimension ()
 Returns the dimension of the current image. More...
 

Private Attributes

int mExtent [4]
 
int mDim
 

Detailed Description

Class used to represent the actual state of the image selected and to perform comparisons on its values.

Definition at line 58 of file creaImageIOGimmickView.cpp.

Constructor & Destructor Documentation

creaImageIO::ImageExtent::ImageExtent ( const std::string &  x,
const std::string &  y,
const std::string &  z,
const std::string &  t 
)
inline

Definition at line 61 of file creaImageIOGimmickView.cpp.

References mDim, and mExtent.

62  {
63  sscanf(x.c_str(),"%d",&mExtent[0]);
64  sscanf(y.c_str(),"%d",&mExtent[1]);
65  sscanf(z.c_str(),"%d",&mExtent[2]);
66  sscanf(t.c_str(),"%d",&mExtent[3]);
67  if(x==""){mExtent[0]=1;}
68  if(y==""){mExtent[1]=1;}
69  if(z==""){mExtent[2]=1;}
70  if(t==""){mExtent[3]=1;}
71 
72  if (mExtent[3]>1) mDim=4;
73  else if (mExtent[2]>1) mDim=3;
74  else if (mExtent[1]>1) mDim=2;
75  else if (mExtent[0]>1) mDim=1;
76  else mDim=0;
77  }

Member Function Documentation

void creaImageIO::ImageExtent::Add ( const ImageExtent ie)

Adds the extent passed as a parameter to the current extent.

Definition at line 215 of file creaImageIOGimmickView.cpp.

References mExtent, and SetDimension().

216  {
217  ImageExtent * extent= (ImageExtent*)&ie;
218  mExtent[2]+=(*extent).Get(2);
219  if(mExtent[2]>1)
220  {
221  SetDimension(3);
222  }
223  }

Here is the call graph for this function:

void creaImageIO::ImageExtent::Clear ( )
inline

Clears the extent.

Definition at line 81 of file creaImageIOGimmickView.cpp.

References mExtent.

81 { mExtent[0] = mExtent[1] = mExtent[2] = mExtent[3] = 1; }
int creaImageIO::ImageExtent::Get ( int  i)
inline

Returns the ieth position of the extent.

Definition at line 90 of file creaImageIOGimmickView.cpp.

References mExtent.

Referenced by IsCompatible().

90 { return mExtent[i]; }

Here is the caller graph for this function:

int creaImageIO::ImageExtent::GetDimension ( )
inline

Returns the dimension of the current image.

Definition at line 96 of file creaImageIOGimmickView.cpp.

References mDim.

96 { return mDim; }
bool creaImageIO::ImageExtent::IsCompatible ( const ImageExtent ie)

Returns true if the two extents are compatible.

Definition at line 200 of file creaImageIOGimmickView.cpp.

References Get().

201  {
202  bool compatible=true;
203  ImageExtent * extent= (ImageExtent*)&ie;
204  if((*extent).Get(0)!=Get(0)
205  || (*extent).Get(1)!=Get(1))
206  {
207  compatible=false;
208  }
209  return compatible;
210  }

Here is the call graph for this function:

void creaImageIO::ImageExtent::SetDimension ( int  dim)
inline

Returns the dimension of the current image.

Definition at line 93 of file creaImageIOGimmickView.cpp.

References mDim.

Referenced by Add().

93 { mDim=dim; }

Here is the caller graph for this function:

Member Data Documentation

int creaImageIO::ImageExtent::mDim
private

Definition at line 100 of file creaImageIOGimmickView.cpp.

Referenced by GetDimension(), ImageExtent(), and SetDimension().

int creaImageIO::ImageExtent::mExtent[4]
private

Definition at line 99 of file creaImageIOGimmickView.cpp.

Referenced by Add(), Clear(), Get(), and ImageExtent().


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