i3dlib

Documentation

i3d Namespace Reference

namespace designed for Image 3D library More...


Classes

struct  BINARY
struct  RGB
struct  RGB16
class  LibException
class  IOException
class  InternalException
struct  Buffer
class  ObjectInfo
 Object in an image. More...
struct  Filter
struct  HistInfo
 Histogram shape description. More...
class  HRCA_Histogram
 Histogram class. More...
class  HRCA_LUT
 class implements operations with LUT for unsigned numerical types (unsigned char and unsigned short) More...
class  Resolution
class  Image3d
 The main template class which stores and manipulates the image data. More...
class  VectField3d
struct  ImgFormatsTable
struct  ImageFileHeader
class  ImageReader
class  ImageWriter
class  SequenceReader
class  SequenceWriter
class  I3DReader
class  I3DWriter
class  ICSReader
class  ICSWriter
class  JPEGReader
class  JPEGWriter
struct  METAIOHeader
class  METAIOReader
class  METAIOWriter
class  TGAReader
class  TGAWriter
class  TIFFReader
class  TIFFWriter
class  PDESolverFunction
 This class is together with class PDESolver the root abstract class for wide family of classes which implements segmentation methods and image preprocessing filters. All these offsprings of this base class have one common feature. The key idea of those methods or filters is described by partial differential equation, which is evolving in time. This class serves to compute the difference between two timesteps. More...
class  ExplicitSchemeFunction
 This class is together with class ExplicitSchemeFunction the abstract class for segmentation methods and image preproccessing filters, which compute the solution of underlying PDE on the whole domain (i.e. whole image). The explicit scheme in time is implemented in these two sister classes. The finite difference solver implemented in these two "sister" classes computes the update to the solution and the "ideal" (possible maximal) time step in every iteration. The computed update is then added to the solution. These two "sister" classes implements only the solver, the user should instantiate some offspring to get the full functional filter or segmentation method. More...
class  MCFFilterFunction
 This class implements together with class MCFFilter the Curvature Flow anisotropic diffusion filter, which was published by Alvarez, Lions and Morel. As the other anisotropic filters, this filter smooths the image in the relatively continuos region and do not smooth the significante edges. Moreover it generates the so called morphological scale space. In the typical output image is suppresed the noise and the edges remain sharp and well localised. The diffused image is the solution of the equation $ u_t = \mathrm{div} ( \nabla u / |\nabla u|) |\nabla u|$. The particular implemantion is based on explicit finite difference solver and therefore there exist some limitations to the time step. There is no need to instantiate this class in the user program. This class is instantiated automatically in the MCFFilter class. More...
class  GradientMagnitudeEstimator
 This class implements simple Estimator of the gradient magnitude. The Gradient is estimated by simple central differences in the direction of each axe. The Magnitude is computed as the square root of the sum of individual derivatives. More...
class  SpatialDerivatives
 This class implements spatial derivatives operator neede for optical flow comp. Documentation TBA. More...
class  PMFilterFunction
 This class implements together with class PMFilter the Perona-Malik anisotropic diffusion filter, which was published by Perona and Malik. This filter was historical first published anisotropic diffusion filter and therefore is fundamental. As the other anisotropic filters, this filter smooths the image in the relatively continuos region and do not smooth the significante edges. In the typical output image is suppresed the noise and the edges remain sharp and well localised. The diffused image is the solution of the equation $ u_t = \mathrm{div} (g(|\nabla u|) \nabla u)$ There is no need to instantiate this class in the user program. This class is instantiated automatically in the PMFilter class. More...
class  MCDEFilterFunction
 This class implements together with class MCDEFilter the Modified Curvature Diffusion Flow anisotropic diffusion filter, which was published by Whitaker and Xue. As the other anisotropic filters, this filter smooths the image in the relatively continuos region and do not smooth the significante edges. Moreover it generates the so called morphological scale space. In the typical output image is suppresed the noise and the edges remain sharp and well localised. The diffused image is the solution of the equation $ u_t = |\nabla u| \cdot \mathrm{div} \left( g(| \nabla u|)\frac{ \nabla u }{ |\nabla u|} \right) $. The particular implementation is based on explicit finite difference solver and therefore there exist some limitations to the time step. There is no need to instantiate this class in the user program. This class is instantiated automatically in the MCDEFilter class. More...
class  PDESolver
 This class is together with class PDESolverFunction the root abstract class for wide family of classes which implements segmentation methods and image preprocessing filters. All these offsprings of this base class have one common feature. The key idea of those methods or filters is described by partial differential equation. The execution of the methods or application of the filters has in the background the solution of the underlying PDE. More...
class  ExplicitScheme
 This class is together with class ExplicitSchemeFunction the abstract class for segmentation methods and image preproccessing filters, which compute the solution of underlying PDE on the whole domain (i.e. whole image). The explicit scheme in time is implemented in these two sister classes. The finite difference solver implemented in these two "sister" classes computes the update to the solution and the "ideal" (possible maximal) time step in every iteration. The computed update is then added to the solution. These two "sister" classes implements only the solver, the user should instantiate some offspring to get the full functional filter or segmentation method. More...
class  ImplicitAOSScheme
 This class is root abstract class for wide family of nonlinear diffusion filters. This class implements the skeleton of numerical semi-implicit AOS scheme. Instances of this class will not produce any usable output. To obtain fully functional nonlinear diffusion filter try to instantiate some offspring of this class. More...
class  AOSCLMCFilter
 This class implements the nonlinear diffusion filter, which was published by Catte, Lions, Morel and Coll. As the other nonlinear filters, this filter smooths the image in the relatively continuos region and do not smooth the significante edges. In the typical output image is suppresed the noise and the edges remain sharp and well localised. The diffused image is the solution of the equation $ u_t = \mathrm{div} (g(|\nabla u_{\sigma}|^2) \nabla u)$. More...
class  AOSTVFilter
 This class implements the Total Variations nonlinear diffusion filter and the Ballanced Forward Backward filter, which were published by Andreu et al. and Keeling et al. As the other nonlinear filters, these filter smooths the image in the relatively continuos region and do not smooth the significante edges. In the typical output image is suppresed the noise and the edges remain sharp and well localised. The diffused image is the solution of the equation $ u_t = \mathrm{div}(\frac{\nabla u}{|\nabla u|}) $. More...
class  AOSPMFilter
 This class implements the Perona-Malik anisotropic diffusion filter, which was published by Perona and Malik. This filter was historical first published nonlinear diffusion filter and therefore is fundamental. As the other anisotropic filters, this filter smooths the image in the relatively continuos region and do not smooth the significante edges. In the typical output image is suppresed the noise and the edges remain sharp and well localised. The diffused image is the solution of the equation $ u_t = \mathrm{div} (g(|\nabla u|) \nabla u)$. More...
class  ImplicitLODScheme
 This class is root abstract class for filters, which can be computed by simple LOD numerical scheme. This class implements the skeleton of numerical semi-implicit LOD (locally one dimensional) scheme. Instances of this class will not produce any usable output. To obtain fully functional filter try to instantiate some offspring of this class. As an example can serve the LODGaussianBlur class. More...
class  LODGaussianBlur
 This class implements the classical Gaussian Blur filter by solving the following PDE $ u_t = \Delta u = (u_{xx} + u_{yy}) $. The main advantage is the constant speed of computation for any size of standard deviation $ \sigma $. The speed is comparable to the speed of Fourier transform based filters. The second advantage is that this filter preserve the average grey value of the blurred image. More...
class  MCFFilter
 This class implements together with class MCFFilterFunction the Curvature Flow anisotropic diffusion filter, which was published by Alvarez, Lions and Morel. As the other anisotropic filters, this filter smooths the image in the relatively continuos region and do not smooth the significante edges. Moreover it generates the so called morphological scaale space. In the typical output image is suppresed the noise and the edges remain sharp and well localised. The diffused image is the solution of the equation $ u_t = \mathrm{div} ( \nabla u / |\nabla u|) |\nabla u|$. The particular implemantion is based on explicit finite difference solver and therefore there exist some limitations to the time step. More...
class  PMFilter
 This class implements together with class PMFilterFunction the Perona-Malik anisotropic diffusion filter, which was published by Perona and Malik. This filter was historical first published anisotropic diffusion filter and therefore is fundamental. As the other anisotropic filters, this filter smooths the image in the relatively continuos region and do not smooth the significante edges. In the typical output image is suppresed the noise and the edges remain sharp and well localised. The diffused image is the solution of the equation $ u_t = \mathrm{div} (g(|\nabla u|) \nabla u)$. The particular implemantion is based on explicit finite difference solver and therefore there exist some limitations to the time step. If you want to use the schema with no timestep limitation take a look to the documentation of AOSPMFilter. More...
class  MCDEFilter
 This class implements together with class MCDEFilterFunction the Modified Curvature Diffusion Flow anisotropic diffusion filter, which was published by Whitaker and Xue. As the other anisotropic filters, this filter smooths the image in the relatively continuos region and do not smooth the significante edges. Moreover it generates the so called morphological scale space. In the typical output image is suppresed the noise and the edges remain sharp and well localised. The diffused image is the solution of the equation $ u_t = |\nabla u| \cdot \mathrm{div} \left( g(| \nabla u|)\frac{ \nabla u }{ |\nabla u|} \right) $. The particular implementation is based on explicit finite difference solver and therefore there exist some limitations to the time step. More...
class  KMeansLS
 This class implements simple the Kmeans segmentation algorithm for two means. Documentation TBA. More...
class  ThresholdActiveContours
 This class implements the threshold dynamics approximation of the Chan-Vese functional. Documentation TBA. More...
struct  Neighbourhood
class  LabeledImage3d
class  ComponentToRemove
struct  components_distance_matrix
struct  PrincipalAxes
class  Shape
class  HistFinder
struct  Vector3d
struct  VOI

Typedefs

typedef byte GRAY8
typedef unsigned short GRAY16
typedef std::valarray< unsigned
long > 
Histogram
 Histogram definition.
typedef std::vector< i3d::Vector3d<
size_t > > 
SeedPointsVector
typedef vector< Vector3d<
size_t > > 
Boundary
 Set of voxels forming the boundary.
typedef Vector3d< float > Offset
 data type representing real coordinates (with floating point)
typedef Vector3d< int > Coords
 data type representing coordinates without floating point

Enumerations

enum  Axis
enum  ImgVoxelType
enum  FileFormat {
  IMG_UNKNOWN, IMG_TARGA, IMG_I3D, IMG_JPEG,
  IMG_TIFF, IMG_METAIO, IMG_ICS
}
enum  METAIOType

Functions

template<class T>
void ExtractImpPoints (const Image3d< T > &img, std::vector< Point3d< double > > &p, std::vector< T > &w, T min_w)
ImgVoxelType StringToVoxelType (const string &s)
template<class T>
void BinFillHoles (Image3d< T > &img, size_t x, size_t y, size_t z)
void BinUnambiguous (Image3d< BINARY > &img)
void BinPartialConvex (Image3d< BINARY > &img, size_t Range)
void BinConvexHull (Image3d< BINARY > &img)
void BinSeparateObjects (Image3d< BINARY > &img)
void FindGenes (const Image3d< GRAY8 > &in, std::list< Gene > &genes, const Vector3d< float > &center, const Boundary &bdr, const Image3d< BINARY > &mask, const Vector3d< int > &displacement, double minGeneDist, GRAY8 step, double strength)
I3D_DLLEXPORT void SegmentNuclei (const Image3d< GRAY8 > &i, std::list< Nucleus > &nuclei, byte globalThreshold, int nucLimit, double maxRoundness)
template<class VOXEL>
void MarchingSquaresOneSlice (i3d::Image3d< VOXEL > &ImgIn, VOXEL Value, Direction Axis, std::vector< Point3d< float > > &Lines, size_t SliceNumber)
template<class VOXELIN, class VOXELOUT>
void MarchingSquares (i3d::Image3d< VOXELIN > &ImgIn, i3d::Image3d< VOXELOUT > &ImgOut, VOXELIN Value, Direction Axis, VOXELOUT Colour)
template<typename T>
void EDM (Image3d< T > &Obraz, byte kvalita=0, T Image_background=0, bool odmocnina=false)
 Computes the distance transform for binary images.
template<typename T>
void HybridSaito (Image3d< T > &Obraz, byte kvalita=0, T Image_background=0, bool odmocnina=false)
 Computes the distance transform for binary images.
template<typename T>
void SlowSaito (Image3d< T > &Obraz, T Image_background=0, bool odmocnina=false)
 Computes the distance transform for binary images.
template<typename T>
void FastSaito (Image3d< T > &Obraz, T Image_background=0, bool odmocnina=false)
 Computes the distance transform for binary images.
template<class T>
void DrawCube (Image3d< T > &img, const VOI< size_t > &voi, T color)
template<class T>
void DrawLines (Image3d< T > &img, const std::vector< Offset > &pnts, T color)
template<class T>
void DrawLine (Image3d< T > &img, const Offset &p1, const Offset &p2, T color)
template<class T>
void DrawLine (Image3d< T > &img, Vector3d< size_t > p1, Vector3d< size_t > p2, T color)
template<class T>
I3D_DLLEXPORT void DrawLineBres (Image3d< T > &img, Vector3d< size_t > p1, Vector3d< size_t > p2, T color)
I3D_DLLEXPORT void DrawLineBres (list< Vector3d< int >;class I3D_DLLEXPORT StoreToMem{list< Vector3d< int >> *_ll)
void StorePoint (Vector3d< int >P) const
 add point to the buffer
template<class VOXEL>
void Robinson3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void CompassSobel3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void Prewitt3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void Kirsch3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void ShenCastan3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, double p, int WinHalfSize)
template<class VOXEL>
void ShenCastan2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, double p, int WinHalfSize)
template<class VOXEL>
void MarrHildreth3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, double sigma1, double sigma2)
template<class VOXEL>
void MarrHildreth2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, double sigma1, double sigma2)
template<class VOXEL>
void Laplace3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void Roberts3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void EstimateGradient1_3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, bool clamp)
template<class VOXEL>
void EstimateGradient2_3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, bool clamp)
template<class VOXEL>
void Sobel3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void hystThres3D (Image3d< VOXEL > &data, unsigned short lowThreshold, unsigned short highThreshold)
template<class VOXEL>
void Canny3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, float sigma, float scale)
template<class VOXEL>
void hystThres2D (Image3d< VOXEL > &data, unsigned short lowThreshold, unsigned short highThreshold)
template<class VOXEL>
void Canny2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, float sigma, float scale)
template<class VOXEL>
void Sobel2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void Laplace2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void Kirsch2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void Prewitt2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void Robinson2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void CompassSobel2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void Roberts2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void EstimateGradient1_2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, bool clamp)
template<class VOXEL>
void EstimateGradient2_2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, bool clamp)
template<class VOXEL>
void SimpleGauss (Image3d< VOXEL > &img, double sigma, bool exact)
template<class NUMBER, class NUMBER2>
void Convert (Filter< NUMBER > &out, const Filter< NUMBER2 > &in)
Filter< double > MakeGaussFilter1D (double sigma, double widthFactor)
template<class VOXEL>
void Gauss (Image3d< VOXEL > &img, double sigmax, double sigmay, double sigmaz, double widthFactor, bool exact)
template<class VOXEL>
void Sobel (Image3d< VOXEL > &img, bool do_vertical, bool do_horizontal)
template<class VOXEL>
void SigmaFilter (const Image3d< VOXEL > &in, Image3d< VOXEL > &out, const Neighbourhood &neib, const Neighbourhood &neib1, VOXEL sigma, int tres)
 This non-linear filter is designed to supress high frequencies in input image and not to blur the sharp and significant edges in the image.
template<class NUMBER>
void Convert (Filter< NUMBER > &out, const Filter< NUMBER > &in)
template<class VOXEL>
I3D_DLLEXPORT void ApplyGauss1D (VOXEL *data, const std::slice &slc, Filter< double > &filter, Buffer &buf, bool divide=true)
void IntensityHist (const Image3d< RGB > &img, Histogram &hist, int channel)
template<class T>
void IntensityHist (const Image3d< T > &img, Histogram &hist)
template<class T>
void IntensityHist (const Image3d< T > &img, Histogram &hist, const std::gslice &slc)
void ComputeHistInfo (const Histogram &hist, HistInfo &hi, double thres_factor)
void SmoothHist (const Histogram &in, Histogram &out)
void SmoothHist (const Histogram &in, Histogram &out, size_t diff)
void RecDilHist (const Histogram &mask, Histogram &out)
void RecEroHist (const Histogram &mask, Histogram &out)
template<class T>
void MapLevels (const Histogram &h, std::vector< T > &map_func, int thres)
template<class T>
void MapPermileLevels (const Histogram &h, std::vector< T > &map_func, int perm)
size_t FindUnimodalThreshold (const Histogram &hist)
size_t FindOtsuThreshold (const Histogram &hist)
int HistMax (const Histogram &h)
int HistMin (const Histogram &h)
int HistFirstNonZero (const Histogram &h)
size_t HistLastNonZero (const Histogram &h)
void RegMaxHist (const Histogram &in, Histogram &out)
ImageReaderCreateReader (const char *fname, VOI< size_t > *voi, bool is_regex)
ImageWriterCreateWriter (const char *fname, FileFormat ft, Vector3d< size_t > sz)
void DestroyWriter (ImageWriter *iw)
void DestroyReader (ImageReader *ir)
template<class FULL_COLOR, class GRAY_CHANNEL>
bool CopyChannel (Image3d< FULL_COLOR > &rgb, Image3d< GRAY_CHANNEL > &gray, int channel)
template<class VOXEL>
void GenerateDummyVoxels (const Image3d< VOXEL > &ImgIn, Image3d< VOXEL > &ImgOut, VOXEL Value, size_t width)
Vector3d< float > MicronsToPixels (const Vector3d< float > &v, const Resolution &r)
Vector3d< float > PixelsToMicrons (const Vector3d< float > &v, const Resolution &r)
template<class FULL_COLOR, class COLOR_CHANNEL>
I3D_DLLEXPORT void RGBtoGray (Image3d< FULL_COLOR > &, Image3d< COLOR_CHANNEL > &red, Image3d< COLOR_CHANNEL > &green, Image3d< COLOR_CHANNEL > &blue)
template<class COLOR_CHANNEL, class FULL_COLOR>
I3D_DLLEXPORT void GrayToRGB (const Image3d< COLOR_CHANNEL > &red, const Image3d< COLOR_CHANNEL > &green, const Image3d< COLOR_CHANNEL > &blue, Image3d< FULL_COLOR > &rgb)
FileFormat GuessFileFormat (const char *fname)
ImgVoxelType ReadImageType (const char *fname, FileFormat ft)
FileFormat StringToFileFormat (const string &s)
string FileFormatToString (const FileFormat ff)
FileFormat ExtensionToFileFormat (const string &s)
string FileFormatToExtension (const FileFormat ff)
size_t GetDimensionality (const FileFormat ff)
bool ReadConfig (const char *fname, map< string, string > &items, const char sep)
bool SaveConfig (const char *fname, const map< string, string > &items, const char sep='=')
template<class VOXELIN, class VOXELOUT>
void SpeedFunctionStandard (Image3d< VOXELIN > &ImgIn, Image3d< VOXELOUT > &SpeedImg, double sigmax=1.2, double sigmay=1.2, double sigmaz=1.2, double width=1.5)
 Computes the speed of the moving interface on whole input image.
template<class VOXELIN, class VOXELOUT>
void SpeedFunctionExponential (Image3d< VOXELIN > &ImgIn, Image3d< VOXELOUT > &SpeedImg, double sigmax=1.0, double sigmay=1.0, double sigmaz=1.0, double width=1.5, double alpha=0.02)
 Computes the speed of the moving interface on whole input image.
template<class VOXELIN, class VOXELOUT>
void FastMarchingMethod (i3d::Image3d< VOXELIN > &SpeedImg, i3d::Image3d< VOXELOUT > &ImgOut, SeedPointsVector &SeedPoints)
 This function computes Fast Marching method, which can be used for image segmentation.
template<class VOXELIN, class VOXELOUT>
void GeodesicDistance (Image3d< VOXELIN > &ImgIn, Image3d< VOXELOUT > &ImgOut, SeedPointsVector &SeedPoints)
 This function computes shortest Geodesic Distances in the mask object from seed points.
template<class VOXELIN, class VOXELOUT>
void LocalRadius (Image3d< VOXELIN > &ImgIn, Image3d< VOXELOUT > &ImgOut, SeedPointsVector &SeedPoints)
 This function computes Local Radius of the pixels in the mask object from seed point.
template<class VOXELIN, class VOXELOUT>
void FastMarchingSignedDistance (VOXELIN Speed, Image3d< VOXELOUT > &ImgOut, std::vector< size_t > &indexes, std::vector< VOXELOUT > &values)
template<class VOXEL>
void FindContourLevel (Image3d< VOXEL > &Img, VOXEL &value, size_t Start=3, VOXEL Threshold=2.0, size_t Bins=100, size_t Step=1, double Sigma=1.0, double Radius=3.0)
 Computes the right arrival time of the moving contour. This value should correct separate the image to interior and exterior region.
template<class T>
void Erosion (const Image3d< T > &in, Image3d< T > &out, const Neighbourhood &neib)
template<class T>
void Dilation (const Image3d< T > &in, Image3d< T > &out, const Neighbourhood &neib)
template<class T>
void Opening (Image3d< T > &in, const Neighbourhood &neib)
template<class T>
void Closing (Image3d< T > &in, const Neighbourhood &neib)
template<class T>
void Reconstruction_by_dilation (const Image3d< T > &marker, const Image3d< T > &mask, Image3d< T > &out, const Neighbourhood &neib)
 Mask image must be larger than or equal to the marker image.
template<class T>
void Reconstruction_by_erosion (const Image3d< T > &marker, const Image3d< T > &mask, Image3d< T > &out, const Neighbourhood &neib)
 Marker image must be larger than or equal to the mask image.
template<class T>
void Reconstruction_by_dilation (const Image3d< T > &marker, const Image3d< T > &mask, Image3d< T > &out)
 Mask image must be larger than or equal to the marker image.
template<class T>
void Reconstruction_by_erosion (const Image3d< T > &marker, const Image3d< T > &mask, Image3d< T > &out)
 Marker image must be larger than or equal to the mask image.
template<class T>
void TopHat (Image3d< T > &in, const Neighbourhood &neib)
void Split (const Neighbourhood &n, Neighbourhood &n_back, Neighbourhood &n_forw)
template<class T1, class T2, class Pred>
void DiscreteDistance (const Image3d< T1 > &in, Image3d< T2 > &out, const Neighbourhood &neib, Pred p)
template<class T>
bool Correspond (vector< T * > &b, vector< T * > &w)
 returns true if color of all points in neighbourhoods corresponds to image
template<class T>
void HitOrMiss (const Image3d< T > &in, Image3d< T > &out, const Neighbourhood &nb, const Neighbourhood &n_w)
template<class T>
void Thinning (const Image3d< T > &in, Image3d< T > &out, const Neighbourhood &b1_par, const Neighbourhood &b2)
template<class T>
void Thicking (const Image3d< T > &in, Image3d< T > &out, const Neighbourhood &b1_par, const Neighbourhood &b2)
template<class T>
void Geodesic_dilation (const Image3d< T > &marker, const Image3d< T > &mask, Image3d< T > &out, const Neighbourhood &neib)
 Mask image must be larger than or equal to the marker image.
template<class T>
void Geodesic_erosion (const Image3d< T > &marker, const Image3d< T > &mask, Image3d< T > &out, const Neighbourhood &neib)
 Marker image must be larger than or equal to the mask image.
template<class T, class F, class G>
void Reconstruction_by_DilEro (const Image3d< T > &marker, const Image3d< T > &mask, Image3d< T > &out, const Neighbourhood &neib, F func_f, G func_g)
template<class T, class F, class G>
void Reconstruction_by_DilEro (const Image3d< T > &marker, const Image3d< T > &mask, Image3d< T > &out, F func_f, G func_g)
template<class T>
void r_Max (const Image3d< T > &img, Image3d< T > &out, const Neighbourhood &neib, const T minVal)
template<class T>
void e_Max (const Image3d< T > &img, T h, Image3d< T > &out, const Neighbourhood &neib)
template<class S, class T>
void CopyImage (const Image3d< S > &from, Image3d< T > &to)
 Copy all pixels from first image to the second and unify their sizes.
template<class T>
void Frequency_distribution (const Image3d< T > &img, vector< int > &v)
void Cumulative_freqdist (const vector< int > &u, vector< int > &v)
template<class T>
void Sort_to_vector (const Image3d< T > &img, vector< int > &u, vector< int > &v)
template<class T>
void Watershed (const Image3d< T > &in, Image3d< T > &out, const Neighbourhood &neib)
template<class T>
I3D_DLLEXPORT void h_Max (const Image3d< T > &img, T h, Image3d< T > &out, const Neighbourhood &neib)
template<class T>
size_t GetFullWindow (Image3d< T > &img, size_t x, size_t y, size_t z, const Neighbourhood &nb, std::vector< T * > &valid)
template<class T>
size_t GetNbh (const Image3d< T > &img, size_t x, size_t y, size_t z, const Neighbourhood &nb, Neighbourhood &rnb)
std::ostream & operator<< (std::ostream &out, const Neighbourhood &n)
void ConstructBoxNeighbourhood (Neighbourhood &nb, double r1, double r2, double r3)
template<class T>
I3D_DLLEXPORT size_t GetWindow (Image3d< T > &img, size_t x, size_t y, size_t z, const Neighbourhood &nb, std::vector< T * > &valid)
template<class T>
I3D_DLLEXPORT void MakeWindow (Image3d< T > &img, size_t x, size_t y, size_t z, const Neighbourhood &nb, std::vector< T * > &valid)
template<class T>
GetMedian (const std::vector< const T * > &win)
template<class T>
void MoveFullWindow (std::vector< T * > &v)
template<class T>
void MoveWindow (std::vector< T * > &v)
 I3D_DLLEXPORT_DATA (extern const Neighbourhood) nb2D_4
template<class ORIGVOXEL, class LABEL, class VOXEL>
bool WeightedCenter (const Image3d< ORIGVOXEL > &img, const LabeledImage3d< LABEL, VOXEL > &labels, LABEL lbl, Vector3d< float > &center)
template<class LABEL, class VOXEL>
bool Center (const LabeledImage3d< LABEL, VOXEL > &labels, LABEL lbl, Vector3d< float > &center)
template<class LABEL, class VOXEL>
double Surface (const LabeledImage3d< LABEL, VOXEL > &limg, LABEL label, size_t &volume)
template<class LABEL, class VOXEL>
double Roundness (const LabeledImage3d< LABEL, VOXEL > &limg, LABEL label)
template<class LABEL, class VOXEL>
Boundary GetComponentBoundary (const LabeledImage3d< LABEL, VOXEL > &limg, LABEL label)
template<class LABEL, class VOXEL>
void Radius (const LabeledImage3d< LABEL, VOXEL > &limg, LABEL label, const Vector3d< float > &center, float &min, float &max, float &mean)
template<class ORIGVOXEL, class LABEL, class VOXEL>
void IntensityHist (const Image3d< ORIGVOXEL > &img, const LabeledImage3d< LABEL, VOXEL > &limg, LABEL label, Histogram &hist)
template<class ORIGVOXEL, class LABEL, class VOXEL>
void MinMaxComponentValue (const Image3d< ORIGVOXEL > &img, const LabeledImage3d< LABEL, VOXEL > &limg, LABEL label, ORIGVOXEL &min, ORIGVOXEL &max)
template<class ORIGVOXEL, class LABEL, class VOXEL, class Predicate>
void RemoveComponents (Image3d< ORIGVOXEL > &img, const LabeledImage3d< LABEL, VOXEL > &limg, Predicate &pred)
bool HasIntersection (const VOI< size_t > &img_voi, const VOI< size_t > &obj_voi, bool bdr_x, bool bdr_y, bool bdr_z)
template<class LABEL, class VOXEL>
void bbox_init_and_copy (Image3d< LABEL > &tmp, const LabeledImage3d< LABEL, VOXEL > &limg, const VOI< size_t > &bbox, const LABEL pvalue)
template<class LABEL, class VOXEL>
components_distance_matrixCreateDistMatrix (const LabeledImage3d< LABEL, VOXEL > &limgA, const LabeledImage3d< LABEL, VOXEL > &limgB, const double max_dist)
template<class T>
void Threshold (Image3d< T > &img, T t1, T t2)
template<class VOXELIN, class VOXELOUT>
void Threshold (const Image3d< VOXELIN > &imgin, Image3d< VOXELOUT > &imgout, VOXELIN t1, VOXELIN t2)
void InitDivisionPoints (vector< size_t > &div, size_t sz, size_t n)
template<class VOXELIN, class VOXELOUT>
void SemiThreshold (const Image3d< VOXELIN > &imgin, Image3d< VOXELOUT > &imgout, VOXELIN t)
template<class T, class OUTVOXEL, class TF>
void LocalThreshold (const Image3d< T > &in, Image3d< OUTVOXEL > &out, size_t nx, size_t ny, size_t nz, const TF &ThresholdFinder)
string itos (int n)
bool StrToInt (const string &s, int &i)
bool StrToFloat (const string &s, float &f)
void SetBadIOException (ios &io)
unsigned long LSBFirstReadLong (istream &file)
void LSBFirstWriteLong (ostream &file, unsigned long value)
unsigned long LSBFirstToLong (byte buf[4])
void LongToLSBFirst (byte buf[4], unsigned long value)
unsigned short LSBFirstReadShort (istream &file)
void LSBFirstWriteShort (ostream &file, unsigned short value)
unsigned short LSBFirstToShort (byte buf[2])
void ShortToLSBFirst (byte buf[2], unsigned short value)
string Trim (const string &s)
string BeforeLast (const string &s, char sep)
string AfterLast (const string &s, char sep)
size_t GetPath (const string &fn, string &path)
size_t GetExtension (const string &fn, string &ext)
void SplitFilename (const string &fn, string &path, string &name, string &ext)
int num_digits (int s, int base)
int cmp_nocase (const string &s1, const string &s2)
 no case string comparison
string GetDir ()
 Get current working directory.
void SetDir (const char *dir)
 Set working directory.
int ScanDir (const char *dir, const char *fnames, vector< string > &namelist, int regflags)
int MaskExpand (const char *mask, vector< string > &namelist, bool expand)
template<typename ITERATOR>
void normalize (ITERATOR first, ITERATOR last)
 a simple template function for arrays/lists/... normalization
template<typename ITERATOR>
void normalize (ITERATOR first, const long int count)
 a simple template function for arrays/lists/... normalization
template<class NUMBER>
void allocate (NUMBER *&address, unsigned long int count, const char *var_name, const char *function_name)
 function for memory allocation including memory check
template<class WHATEVER>
void single_allocate (WHATEVER *&address, const char *var_name, const char *function_name)
 function for memory allocation including memory check
template<class VOXEL>
void RemapIntensities (Image3d< VOXEL > &img, std::vector< VOXEL > &map_fun)
template<class T>
void Resample (const Image3d< T > &src, Image3d< T > &dest, size_t new_x, size_t new_y, size_t new_z, SamplingMode m)
template<class T>
void Resize (const Image3d< T > &src, Image3d< T > &dest, size_t new_x, size_t new_y, size_t new_z, SamplingMode m)
template<class T>
I3D_DLLEXPORT void CopySlice (const Image3d< T > &slc, Image3d< T > &img, size_t z)
template<class VOXEL>
void Get_AF_XY (const Image3d< VOXEL > &src, Image3d< VOXEL > &dest)
template<class VOXEL>
void Get_AF_XZ (const Image3d< VOXEL > &src, Image3d< VOXEL > &dest)
template<class VOXEL>
void Get_AF_YZ (const Image3d< VOXEL > &src, Image3d< VOXEL > &dest)
template<class VOXEL>
void CopyToImage (const i3d::Image3d< VOXEL > &src, i3d::Image3d< VOXEL > &dst)
template<class VOXEL>
I3D_DLLEXPORT void GetResampledSubimage (const Image3d< VOXEL > &src, Image3d< VOXEL > &dest, const VOI< size_t > &ivoi, const Vector3d< size_t > &size)
void AffineTransform (Image3d< GRAY8 > &img, const double matrix[4][4], const Vector3d< double > &origin, int degree, GRAY8 bgcol, bool use_resolution)
template<class T1, class T2>
void MapColor (const Image3d< T1 > &Iselect, const Image3d< T2 > &Imask, Image3d< RGB > &Iout, const vector< RGB > &rgb_map)
template<class T>
void ReverseColors (size_t width, size_t height, T *data)
template<class T>
void SwapVert (size_t width, size_t height, T *data)
template<class T>
void SwapHoriz (size_t width, size_t height, T *data)
template<class T>
Norm (const Vector3d< T > &v)
 Euclidean norm:.
template<class T>
Vector3d< T > max (const Vector3d< T > &v1, const Vector3d< T > &v2)
 minimum
template<class T>
Vector3d< T > min (const Vector3d< T > &v1, const Vector3d< T > &v2)
 maximum
template<class T>
bool le (const Vector3d< T > &v1, const Vector3d< T > &v2)
 Element-by-element partial ordering:.
template<class T>
bool StrToVector3d (const char *from, Vector3d< T > &v)

Variables

I3D_DLLEXPORT BINARY
const BINARY MaxValue (1)
const BINARY MinValue (0)
const ImgFormatsTable ImgFormat []
const METAIOTypeToImgVoxelTypeTable TypeConv []
const METAIOTypeNameToEnum METAIONameToTypeConv []
const int TGA_ATTRIB_ABITS = 0x0f
 Targa attribue.
const int TGA_ATTRIB_HORIZONTAL = 0x10
 Targa attribue - horizontal orientation.
const int TGA_ATTRIB_VERTICAL = 0x20
 Targa attribue - vertical orientation.
template class I3D_DLLEXPORT Vector3d< int >

Detailed Description

namespace designed for Image 3D library

FILE: i3dio.cc

input/output manipulation routines for variaous image formats

David Svoboda <svoboda@fi.muni.cz> 2005


Typedef Documentation

typedef unsigned short i3d::GRAY16

Type of voxel for grayscale (16bit) images

typedef byte i3d::GRAY8

Type of voxel for grayscale (8bit) images


Enumeration Type Documentation

enum i3d::Axis

Axes:

Image voxel types:

enum with definition of METAIO types


Function Documentation

I3D_DLLEXPORT void i3d::AffineTransform ( Image3d< GRAY8 > &  img,
const double  matrix[4][4],
const Vector3d< double > &  origin,
int  degree = 0,
GRAY8  bgcol = 0,
bool  use_resolution = false 
)

Perform affine transformation of image img using the matrix matrix origin is with respect to the first voxel of the image degree is the interpolation degree (Note: in my tests only 0 and 1 worked well. PEM) if use_resolution = true, the the resolution of the input image is taken into account Implementation uses source code from Philippe Thevenaz (see affine.h) It uses two float arrays with the size equal to the number of voxels of img => it's relatively memory consuming operation.

I3D_DLLEXPORT string i3d::AfterLast ( const string &  s,
char  sep 
)

Returns string after last occurence of sep. If sep is not found, "" is returned

template<class VOXEL>
I3D_DLLEXPORT void i3d::ApplyGauss1D ( VOXEL *  data,
const std::slice &  slc,
Filter< double > &  filter,
Buffer &  buf,
bool  divide = true 
)

Apply a 1D Gaussian filter a vector selected from data using slc. The filter is given as one of the parameters, as well as a buffer, which has to be of the same size as the filter window ( = filter.Size() * sizeof(VOXEL) ). If the optional parameter divide is false, then the result of the scalar product with the filter window is not divided by the sum of the window, which means that the function computes just a convolution with the filter window. The range of each result is checked and an exception is raised if it exceeds numeric_limits<VOXEL>::max().

template<class LABEL, class VOXEL>
void i3d::bbox_init_and_copy ( Image3d< LABEL > &  tmp,
const LabeledImage3d< LABEL, VOXEL > &  limg,
const VOI< size_t > &  bbox,
const LABEL  pvalue 
)

Copy content of bbox from limg into tmp, the "tmp_box" will be one voxel wider at each side. In the case (bbox.size.z == 1) is true, i.e. bbox is 2D, the two dimensionality when widering is preserved which means no "layer" below and above is added. Added voxels (by widering) as well as voxels from original limg, which are not equal to pvalue parameter, are set to 0 -- this actually extracts exactly component labelled with pvalue from given bbox.

I3D_DLLEXPORT string i3d::BeforeLast ( const string &  s,
char  sep 
)

Returns string before last occurence of sep. If sep is not found, "" is returned

I3D_DLLEXPORT void i3d::BinConvexHull ( Image3d< BINARY > &  img  ) 

not implemented

template<class T>
I3D_DLLEXPORT void i3d::BinFillHoles ( Image3d< T > &  img,
size_t  x = 0,
size_t  y = 0,
size_t  z = 0 
)

Function which fills the black holes in the binary image. The coordinates (x,y,z) are supposed to be a voxels belonging to the background encapsulating the whole image.

I3D_DLLEXPORT void i3d::BinPartialConvex ( Image3d< BINARY > &  img,
size_t  Range 
)

BinPartialConvex creates convex hull for each 2D crosssection separately.

I3D_DLLEXPORT void i3d::BinSeparateObjects ( Image3d< BINARY > &  img  ) 

not implemented

I3D_DLLEXPORT void i3d::BinUnambiguous ( Image3d< BINARY > &  img  ) 

BinUnambiguous make the image so that this can be represented by the Freeman code

template<class LABEL, class VOXEL>
I3D_DLLEXPORT bool i3d::Center ( const LabeledImage3d< LABEL, VOXEL > &  labels,
LABEL  label,
Vector3d< float > &  center 
)

Center computes the center (in microns) of a component with label lbl. Coordinates of the center are given in coordinates of the (grayscale) image from which the labeled image has been formed (displacement in voxels from the original image can be obtained by labels.GetDisplacement()). The function returns false if the component is empty. Otherwise it returns true and the center is returned in center.

I3D_DLLEXPORT void i3d::ConstructBoxNeighbourhood ( Neighbourhood &  nb,
double  r1,
double  r2,
double  r3 
)

This function will construct a boxed neighbourhood in 2 or 3 dimensions Examples: ConstructBoxNeighbourhood(nb,1.0,1.0,0.0) will give classic 8-neighbourhood in 2 dimensions ConstructBoxNeighbourhood(nb,1.0,1.0,1.0) will give classic 26-neighbourhood in 3 dimensions ConstructBoxNeighbourhood(nb,2.0,2.0,2.0) will give classic 48-neighbourhood in 3 dimensions

template<class NUMBER>
void i3d::Convert ( Filter< NUMBER > &  out,
const Filter< NUMBER > &  in 
)

"Conversion" to the same filter type - just a deep copy:

template<class NUMBER, class NUMBER2>
I3D_DLLEXPORT void i3d::Convert ( Filter< NUMBER > &  out,
const Filter< NUMBER2 > &  in 
)

Filter conversion (to another arithmetic type):

template<class FULL_COLOR, class GRAY_CHANNEL>
I3D_DLLEXPORT bool i3d::CopyChannel ( Image3d< FULL_COLOR > &  rgb,
Image3d< GRAY_CHANNEL > &  gray,
int  channel 
)

Copy channel (red... 0, green...1, blue...2) from RGB image into grayscale images return false if channel is not 0, 1, or 2

template<class T>
I3D_DLLEXPORT void i3d::CopySlice ( const Image3d< T > &  slc,
Image3d< T > &  img,
size_t  z 
)

Copy 2D slice slc to 3D image img at level z. It is expected img and slc have the same x and y size. InternalException is raised if this is not satisfied

template<class VOXEL>
I3D_DLLEXPORT void i3d::CopyToImage ( const Image3d< VOXEL > &  src,
Image3d< VOXEL > &  dest 
)

Copy content of image src to image dest. Both offset and resolution are taken into accout. Only voxels from src overlapping with image dest are copied. Voxels in dest that don't overlap with src are untouched. Currently only nearest neighbour interpolation is implemented.

template<class LABEL, class VOXEL>
I3D_DLLEXPORT components_distance_matrix * i3d::CreateDistMatrix ( const LabeledImage3d< LABEL, VOXEL > &  limgA,
const LabeledImage3d< LABEL, VOXEL > &  limgB,
const double  max_dist = DMAX 
)

Creates and fills the structure representing the matrix of distances, returns pointer to this structure. In matrix, row axis contains components from limgA, column axis contains comp. from limgB, row/column index of given component is its label. If the distance of bounding boxes of respective components is above max_dist parameter (which defaults to DMAX constant) the distance is claimed to be DMAX_FAR_AWAY. max_dist parameter is in microns units. It is also expected that upper left corner of both images is the same point in 3d space, i.e. images are aligned.

void i3d::Cumulative_freqdist ( const vector< int > &  u,
vector< int > &  v 
) [inline]

Computes cumulative frequency distribution for vector u and put it into v, where u is a vector with frequency distibution

I3D_DLLEXPORT FileFormat i3d::ExtensionToFileFormat ( const string &  s  ) 

conversion from file extension to file format note: extensions are without dot, e.g. "tga" for IMG_TARGA

template<class T>
I3D_DLLEXPORT void i3d::ExtractImpPoints ( const Image3d< T > &  img,
std::vector< Point3d< double > > &  p,
std::vector< T > &  w,
min_w 
)

in p return coordinates of all points (in micrometers) which itensity is greater than min_w. Intensity of such a point is also pushed into vector v. Number of new elements of both vectors is same .

template<class VOXELIN, class VOXELOUT>
I3D_DLLEXPORT void i3d::FastMarchingSignedDistance ( VOXELIN  Speed,
Image3d< VOXELOUT > &  ImgOut,
std::vector< size_t > &  indexes,
std::vector< VOXELOUT > &  values 
)

Decide if we should make 2D or 3D fast Marching method and select proper FMroutines class and call the FastMarchingMethodComp function

I3D_DLLEXPORT string i3d::FileFormatToExtension ( const FileFormat  ff  ) 

conversion from file format to file extension

I3D_DLLEXPORT string i3d::FileFormatToString ( const FileFormat  ff  ) 

conversion from file format to string

I3D_DLLEXPORT void i3d::FindGenes ( const Image3d< GRAY8 > &  in,
std::list< Gene > &  genes,
const Vector3d< float > &  center,
const Boundary &  bdr,
const Image3d< BINARY > &  mask,
const Vector3d< int > &  displacement,
double  minGeneDist,
GRAY8  step,
double  strength = STD_SIGMA 
)

Search for genes (dots) in a control object (nucleus, chromosome) in input image (in). The control object is given by its voxels (mask) and boundary. displacement is the offset of mask with respect to the "in" image. The offset can be negative - in this case outside voxels of the mask are ignored. minGeneDist is the minimum distance of gene centers in microns. step is the step for gradual thresholding. strength is the strength of the Gauss filter applied to the image before searching for dots. genes is the output list of dots found in the control object.

Parameters center and boundary describe the control object in which dots are searched and are needed for computing dot parameters. center and boundary describe location of the control object in img.

template<class T>
I3D_DLLEXPORT void i3d::Frequency_distribution ( const Image3d< T > &  img,
vector< int > &  v 
)

Frequency_distribution determines the frequency distibution of each image gray level

template<class VOXEL>
I3D_DLLEXPORT void i3d::Gauss ( Image3d< VOXEL > &  ,
double  sigmax,
double  sigmay = 0.0,
double  sigmaz = 0.0,
double  widthFactor = 3.0,
bool  exact = true 
)

Gauss applies a 1-3D Gaussian filter to an image. If some of sigmax, sigmay, or sigmaz are zero, then the image is not filtered in the corresponding axis. For instance, the image is filtered only in the z axis by calling Gauss(image, 0, 0, sigma).

widthFactor influences the size of the filter window: the Gauss filter is implemented by consecutive application of a 1D Gauss filter with window size of 2*[sigma*widthFactor], where [x] means the lowest integer larger than x.

2D and 3D filters are computed by a consecutive application of two or three 1D Gaussian filters produced by MakeGaussFilter1D. The widthFactor parameter has the same meaning as in MakeGaussFilter1D.

If the optional parameter exact is false, the computation is done in situ, however some rounding errors can occur. Otherwise, a temporary buffer is allocated for storing the intermediate results. The size of the buffer can be up to four times of the size of the image, depending on the voxel type.

template<class VOXEL>
I3D_DLLEXPORT void i3d::GenerateDummyVoxels ( const Image3d< VOXEL > &  ImgIn,
Image3d< VOXEL > &  ImgOut,
VOXEL  Value,
size_t  width 
)

Add a boundary to the image. The width of the boundar yis defined by the parameter 'width'

template<class VOXEL>
I3D_DLLEXPORT void i3d::Get_AF_XY ( const Image3d< VOXEL > &  src,
Image3d< VOXEL > &  dest 
)

Compute xy maximum projection dest of image src. The function resizes image dest to have the same xy size as src. Its depth (z-size) is set to 1. x and y offset and esolution are copied from src. z offset is set to 0.

template<class VOXEL>
I3D_DLLEXPORT void i3d::Get_AF_XZ ( const Image3d< VOXEL > &  src,
Image3d< VOXEL > &  dest 
)

Compute xz maximum projection dest of image src. The function resizes image dest to have the same xz size as src. Its height (y-size) is set to 1. Resolution and x and z offset are copied from src. y offset is set to 0.

template<class VOXEL>
I3D_DLLEXPORT void i3d::Get_AF_YZ ( const Image3d< VOXEL > &  src,
Image3d< VOXEL > &  dest 
)

Compute yz maximum projection dest of image src. The function resizes image dest to have the same yz size as src. Its width (x-size) is set to 1. Resolution and y and z offset are copied from src. x offset is set to 0

template<class LABEL, class VOXEL>
I3D_DLLEXPORT Boundary i3d::GetComponentBoundary ( const LabeledImage3d< LABEL, VOXEL > &  limg,
LABEL  label 
)

Function returns the boundary voxels of a component with label lbl. It uses neighbourhood nb2D_4 for 2D and neighbourhood nb3D_6 for 3D images.

I3D_DLLEXPORT size_t i3d::GetDimensionality ( const FileFormat  ff  ) 

evaluate the dimensionality of the image format

I3D_DLLEXPORT size_t i3d::GetExtension ( const string &  fn,
string &  ext 
)

returns position of last dot in string fn and sets ext to the string after this dot. if there is no dot, length of fn is returned and ext==""

template<class T>
I3D_DLLEXPORT size_t i3d::GetFullWindow ( Image3d< T > &  img,
size_t  x,
size_t  y,
size_t  z,
const Neighbourhood &  nb,
std::vector< T * > &  valid 
)

GetFullWindow acts like GetWindow, except that it produces a pointer for *each* neighbourhood point. If a point is out of the image, the corresponding pointer is 0.

template<class T>
T i3d::GetMedian ( const std::vector< const T * > &  win  ) 

returns median of intensities in specified window

template<class T>
I3D_DLLEXPORT size_t i3d::GetNbh ( const Image3d< T > &  img,
size_t  x,
size_t  y,
size_t  z,
const Neighbourhood &  nb,
Neighbourhood &  rnb 
)

GetNbh computes valid neighbours of point [x,y,z], which must be inside the image img (otherwise, the InternalException is raised). The function returns how long computed neigbourhood will be valid, if you will go through voxels using ++i (i = index[x,y,z] ie. like in GetWindow).

One version of the overloaded GetNbh() function stores the resulting valid neigbourhood points in an output neighbourhood (rnb), the other version produces tags stored in the boolean array isvalid, in which isvalid[i] == true <=> nb.offset[i] + [x,y,z] is inside the image img.

I3D_DLLEXPORT size_t i3d::GetPath ( const string &  fn,
string &  path 
)

Returns position of the last slash (for _DOS, WIN31 and WIN32 '\' is used, '/' otherwise) in the string fn and sets path to the string before this slash. if there is no slash, 0 is returned and path==""

template<class VOXEL>
I3D_DLLEXPORT void i3d::GetResampledSubimage ( const Image3d< VOXEL > &  src,
Image3d< VOXEL > &  dest,
const VOI< size_t > &  ivoi,
const Vector3d< size_t > &  size 
)

Create image dest from image src. Only voxels inside ivoi (in pixels) are used as an input. The output image is resampled to have requested size (in pixels). Nearest neighbour method is used. Offset and resolution is appropriately set.

template<class T>
I3D_DLLEXPORT size_t i3d::GetWindow ( Image3d< T > &  img,
size_t  x,
size_t  y,
size_t  z,
const Neighbourhood &  nb,
std::vector< T * > &  valid 
)

GetWindow computes vector of pointers to valid neighbours of point [x,y,z] Vector of pointers can be viewed like a window to the Image3d. The function returns an integer value giving the a distance, how far one can move the window (i.e use ++ for each pointer in computed vector) without recomputation of valid neigbours (i.e new call of GetWindow). Vector valid will not be larger than nb.size() => you can use valid.reserve(nb.size()).

template<class COLOR_CHANNEL, class FULL_COLOR>
I3D_DLLEXPORT void i3d::GrayToRGB ( const Image3d< COLOR_CHANNEL > &  red,
const Image3d< COLOR_CHANNEL > &  green,
const Image3d< COLOR_CHANNEL > &  blue,
Image3d< FULL_COLOR > &  rgb 
)

Convert a tripple of grayscale images into a RGB image :

I3D_DLLEXPORT FileFormat i3d::GuessFileFormat ( const char *  fname  ) 

Tries to recognize image file format

I3D_DLLEXPORT bool i3d::HasIntersection ( const VOI< size_t > &  img_voi,
const VOI< size_t > &  obj_voi,
bool  bdr_x,
bool  bdr_y,
bool  bdr_z 
)

Function returns true if the object represented as its voi touchs the voi of the image. Intersections are computed only for given border (third, fourth and fifth parameter). If no border is given function returns false.

i3d::I3D_DLLEXPORT_DATA ( extern const   Neighbourhood  ) 

We define following 2D neighbourhoods of point P=[x,y,z] nb2D_4: (1, 0, 0), (0, 1, 0), (-1, 0, 0), (0, -1, 0) i.e: ___ __ /_ /__ /__/_ /_ /| | /__/| || | _| ||__|/ |__/

I3D_DLLEXPORT void i3d::InitDivisionPoints ( vector< size_t > &  div,
size_t  sz,
size_t  n 
)

Set intensities of voxels whose intesities are >=t1 and <=t2 to maximum and the others to 0

template<class ORIGVOXEL, class LABEL, class VOXEL>
I3D_DLLEXPORT void i3d::IntensityHist ( const Image3d< ORIGVOXEL > &  img,
const LabeledImage3d< LABEL, VOXEL > &  limg,
LABEL  label,
Histogram &  hist 
)

Function computes histogram of a component with the label lbl. The intensity values are given from original image.

template<class T>
I3D_DLLEXPORT void i3d::IntensityHist ( const Image3d< T > &  img,
Histogram &  hist 
)

Computes intensity histogram of image img. Output is stored to the vector hist

I3D_DLLEXPORT string i3d::itos ( int  n  ) 

Int to string:

I3D_DLLEXPORT void i3d::LongToLSBFirst ( byte  buf[4],
unsigned long  value 
)

Convert a long int into 4 bytes in least-significant byte first order:

I3D_DLLEXPORT unsigned long i3d::LSBFirstReadLong ( istream &  file  ) 

Read 4 bytes in least-significant byte first order into a long:

I3D_DLLEXPORT unsigned short i3d::LSBFirstReadShort ( istream &  file  ) 

Read 2 bytes in least-significant byte first order into a short int:

I3D_DLLEXPORT unsigned long i3d::LSBFirstToLong ( byte  buf[4]  ) 

Convert 4 bytes in least-significant byte first order into a long int:

I3D_DLLEXPORT unsigned short i3d::LSBFirstToShort ( byte  buf[2]  ) 

Convert 2 bytes in least-significant byte first order into a short int:

I3D_DLLEXPORT void i3d::LSBFirstWriteLong ( ostream &  file,
unsigned long  value 
)

Write a long value as 4 bytes in the least-significant byte first order:

I3D_DLLEXPORT void i3d::LSBFirstWriteShort ( ostream &  file,
unsigned short  value 
)

Write a short int as 2 bytes in least-significant byte first order:

I3D_DLLEXPORT Filter< double > i3d::MakeGaussFilter1D ( double  sigma,
double  widthFactor = 3.0 
)

MakeGaussFilter1D computes a window for a 1D Gaussian filter given by the standard deviation (sigma) and a factor influencing the size of the window (widthFactor). The size of the window is 2*[sigma*widthFactor], where [x] means the lowest integer larger than x. The filter is multiplied by a constant to get 1 on both ends of the window. The value of sigma must be in the range [0.01, 32], otherwise InternalException is thrown.

template<class T>
I3D_DLLEXPORT void i3d::MakeWindow ( Image3d< T > &  img,
size_t  x,
size_t  y,
size_t  z,
const Neighbourhood &  nb,
std::vector< T * > &  valid 
)

MakeWindow computes vector of pointers to img's voxels, i.e. window to image. Neighbourhood nb MUST be computed by GetNbh to avoid invalid pointers.

template<class T1, class T2>
I3D_DLLEXPORT void i3d::MapColor ( const Image3d< T1 > &  Iselect,
const Image3d< T2 > &  Imask,
Image3d< RGB > &  Iout,
const vector< RGB > &  rgb_map 
)

Added by Vladimir Ulman (xulman@fi.muni.cz), 3.12.2004

template<class VOXELIN, class VOXELOUT>
I3D_DLLEXPORT void i3d::MarchingSquares ( i3d::Image3d< VOXELIN > &  ImgIn,
i3d::Image3d< VOXELOUT > &  ImgOut,
VOXELIN  Value,
Direction  Axis = AXIS_Z,
VOXELOUT  Colour = std::numeric_limits< VOXELOUT >::max() 
)

Draws isolines of "Value" computed from "Image3d ImgIn" on the 2d slices of the "Image3d ImgOut" with colour "colour". The slice plane direction (xy, xz, yz) depends on the variable Axis, where the name of the axis is orthogonal to the slice plane. So AXIS_Z means that the isolines will be drawn in the xy slices.

template<class VOXEL>
I3D_DLLEXPORT void i3d::MarchingSquaresOneSlice ( i3d::Image3d< VOXEL > &  ImgIn,
VOXEL  Value,
Direction  Axis,
std::vector< Point3d< float > > &  Lines,
size_t  SliceNumber 
)

This functions finds isolines ofthe "VOXEL Value" in the "Image3d ImgIn" on the "size_t SliceNumber"-th slice orthogonal to the "Directin Axis". The isolines are saved in the referenced vector of Point3d<float>. There is no error detection (if the number of the slice is not out of the range, or if the vector of Point3d is initialized.) There should be some space reserved in the "stdvector<Point3d>& Lines" before calling this function. For example Lines.reserve(500)

I3D_DLLEXPORT int i3d::MaskExpand ( const char *  mask,
vector< string > &  namelist,
bool  expand = true 
)

Vector3d<float> i3d::MicronsToPixels ( const Vector3d< float > &  v,
const Resolution &  r 
) [inline]

convert vector in microns to vector in pixels considering resolution if resolution is not defined default resolution is used

template<class ORIGVOXEL, class LABEL, class VOXEL>
I3D_DLLEXPORT void i3d::MinMaxComponentValue ( const Image3d< ORIGVOXEL > &  img,
const LabeledImage3d< LABEL, VOXEL > &  limg,
LABEL  label,
ORIGVOXEL &  min,
ORIGVOXEL &  max 
)

Function computes minimal and maximal intensity value of a component with the label lbl. The intensity values are given from original image.

template<class T>
void i3d::MoveFullWindow ( std::vector< T * > &  v  )  [inline]

use this function to move window computed by GetFullWindow to the next voxel.

template<class T>
void i3d::MoveWindow ( std::vector< T * > &  v  )  [inline]

use this function to move window computed by GetWindow or MakeWindow to the next voxel.

I3D_DLLEXPORT int i3d::num_digits ( int  number,
int  base = 10 
)

Returns number of digits of number in specified base if number==0 then 1 is returned

std::ostream& i3d::operator<< ( std::ostream &  out,
const Neighbourhood &  n 
)

Vector3d<float> i3d::PixelsToMicrons ( const Vector3d< float > &  v,
const Resolution &  r 
) [inline]

convert vector in pixels to vector in microns considering resolution if resolution is not defined default resolution is used

template<class LABEL, class VOXEL>
I3D_DLLEXPORT void i3d::Radius ( const LabeledImage3d< LABEL, VOXEL > &  limg,
LABEL  label,
const Vector3d< float > &  center,
float &  min,
float &  max,
float &  mean 
)

Function computes minimal, maximal and mean radius of a component with the label lbl. Radius is computed from the component center of mass in micrometers. Results are in micrometers. Euclidean metric is used.

bool i3d::ReadConfig ( const char *  fname,
map< string, string > &  items,
const char  sep 
)

Reads text config file fname and returns map of configuration options (i.e. pairs <key>, <val>):

Blank lines are skipped. From each non-blank line in file fn the pair <key>,<val> is constructed as follows:

  • string before the first occurence of <sep> is trimmed and supposed to be <key>
  • string after the first occurence of <sep> is trimmed and supposed to be <val>

IOException is thrown if there is no non-blank character before <sep> (i.e. unspecified keyword)

if the same keyword is used more then ones in the config file, the last value is set.

I3D_DLLEXPORT ImgVoxelType i3d::ReadImageType ( const char *  fname,
FileFormat  ft = IMG_UNKNOWN 
)

Returns the pixel type of a 2D image stored in fname or a voxel type of a 3D image referenced by fname. File format is guessed from extension of fname if ft == IMG_UNKNOWN

template<class T>
I3D_DLLEXPORT void i3d::Reconstruction_by_dilation ( const Image3d< T > &  marker,
const Image3d< T > &  mask,
Image3d< T > &  out,
const Neighbourhood &  neib 
)

Mask image must be larger than or equal to the marker image.

This implementation does not work! Please use the versions without Neighbourhood instead

template<class T, class F, class G>
I3D_DLLEXPORT void i3d::Reconstruction_by_DilEro ( const Image3d< T > &  marker,
const Image3d< T > &  mask,
Image3d< T > &  out,
func_f,
func_g 
) [inline]

General geodesic reconstruction function

template<class T, class F, class G>
I3D_DLLEXPORT void i3d::Reconstruction_by_DilEro ( const Image3d< T > &  marker,
const Image3d< T > &  mask,
Image3d< T > &  out,
const Neighbourhood &  neib,
func_f,
func_g 
) [inline]

This implementation does not work! Please use the versions without Neighbourhood instead

template<class T>
I3D_DLLEXPORT void i3d::Reconstruction_by_erosion ( const Image3d< T > &  marker,
const Image3d< T > &  mask,
Image3d< T > &  out,
const Neighbourhood &  neib 
)

Marker image must be larger than or equal to the mask image.

This implementation does not work! Please use the versions without Neighbourhood instead

template<class VOXEL>
I3D_DLLEXPORT void i3d::RemapIntensities ( Image3d< VOXEL > &  img,
std::vector< VOXEL > &  map_fun 
)

RemapIntensities maps all voxels according to vector map_fun size of the vector must be higher than the max intensity in image

template<class ORIGVOXEL, class LABEL, class VOXEL, class Predicate>
I3D_DLLEXPORT void i3d::RemoveComponents ( Image3d< ORIGVOXEL > &  img,
const LabeledImage3d< LABEL, VOXEL > &  limg,
Predicate &  pred 
)

Remove all components from the original image for which the predicate is true. The new value of voxels of these components is toggled from original value using ColorInversion function.

template<class T>
I3D_DLLEXPORT void i3d::Resample ( const Image3d< T > &  src,
Image3d< T > &  dest,
size_t  new_x,
size_t  new_y,
size_t  new_z,
SamplingMode  m = NEAREST_NEIGHBOUR 
)

src's image data is resapled so that it has size (new_x, new_y, new_z) or size and new image dest is returned (resolution of dest is recomputed, so that the both images have same size in microns) Only NEAREST_NIEGHBOUR is implemented

template<class T>
I3D_DLLEXPORT void i3d::Resize ( const Image3d< T > &  src,
Image3d< T > &  dest,
size_t  new_x,
size_t  new_y,
size_t  new_z,
SamplingMode  m = NEAREST_NEIGHBOUR 
)

src's image data is resized so that it has size (new_x, new_y, new_z) or v and new image dest is returned. new size is in pixels (size_t variants) or in microns (float variants) Only NEAREST_NIEGHBOUR is implemented

template<class T>
I3D_DLLEXPORT void i3d::ReverseColors ( size_t  width,
size_t  height,
T *  data 
)

Reversing colors in image

template<class FULL_COLOR, class COLOR_CHANNEL>
I3D_DLLEXPORT void i3d::RGBtoGray ( Image3d< FULL_COLOR > &  ,
Image3d< COLOR_CHANNEL > &  red,
Image3d< COLOR_CHANNEL > &  green,
Image3d< COLOR_CHANNEL > &  blue 
)

Convert a RGB image into a tripple of grayscale images:

template<class LABEL, class VOXEL>
I3D_DLLEXPORT double i3d::Roundness ( const LabeledImage3d< LABEL, VOXEL > &  limg,
LABEL  label 
)

Function Roundness computes the roundness of a component with the label lbl. The value of roundness is based on ratio between volume and surface (area and perimeter for 2D). It is normalized to be in range (0,1]. 1 stands for circle (ball). The less compact is the component the lower is its roundness.

bool i3d::SaveConfig ( const char *  fname,
const map< string, string > &  items,
const char  sep = '=' 
)

Saves map into config file fname each pair on one line in form <key><sep><val>

I3D_DLLEXPORT int i3d::ScanDir ( const char *  dir,
const char *  fnames,
vector< string > &  namelist,
int  regflags = REG_EXTENDED|REG_NOSUB 
)

Scan directory dir for files matching regular expression fnames Filenames are returned in vector namelist and can be unsorted. Type of regular experssion is specified by regflags (see regcomp(3) for more info) Function returns number of matching files on success and it can throw IOException if regular expression cannot be parsed or directory scanned.

I3D_DLLEXPORT void i3d::SegmentNuclei ( const Image3d< GRAY8 > &  i,
std::list< Nucleus > &  nuclei,
byte  globalThreshold,
int  nucLimit,
double  maxRoundness 
)

Nuclei segmentation. The procedure returns a list of nuclei description together with their binary images. Each binary image contains exactly one nucleus and voxels of this nucleus are "black" (=BINARY(1)). Segmentation parameters: globalThreshold - initial threshold value nucLimit - minimal volume of nucleus maxRoundness - maximal roundness of nucleus

I3D_DLLEXPORT void i3d::SetBadIOException ( ios &  io  ) 

Set a stream to throw ios::failure after an unsuccessful IO operation:

I3D_DLLEXPORT void i3d::ShortToLSBFirst ( byte  buf[2],
unsigned short  value 
)

Convert a short int into 2 bytes in least-significant byte first order:

template<class VOXEL>
void i3d::SimpleGauss ( Image3d< VOXEL > &  img,
double  sigma = STD_SIGMA,
bool  exact = true 
)

SimpleGauss: applies a simple Gauss filter (1,x,1), where x increases with decreasing sigma, in all available dimensions of the image. The function supposes that if the image has z-dimension then is has also y-dimension and if it has y-dimension then is has also x-dimension. With sigma == STD_SIGMA we get filter window (1,2,1)*1/4. The parameter exact has the same meaning as in the Gauss() function.

template<class VOXEL>
I3D_DLLEXPORT void i3d::Sobel ( Image3d< VOXEL > &  ,
bool  do_vertical = true,
bool  do_horizontal = true 
)

Sobel applies a Sobel (2D edge detector) filter to each slice of an image. only vertical or only horizontal filtering can be called. if both vertical and horizontal filtering is demanded then the resultant voxel is computed as a length of vector (vertical_result, horizontal_result)

template<class T>
I3D_DLLEXPORT void i3d::Sort_to_vector ( const Image3d< T > &  img,
vector< int > &  u,
vector< int > &  v 
)

Sorts the pixels of input image img and put pointers to them into v by cumulative frequency distribution in u

I3D_DLLEXPORT void i3d::Split ( const Neighbourhood &  n,
Neighbourhood &  n_back,
Neighbourhood &  n_forw 
)

I3D_DLLEXPORT void i3d::SplitFilename ( const string &  fn,
string &  path,
string &  name,
string &  ext 
)

Splits filename fn using functions above, name is string between last dot and last slash

I3D_DLLEXPORT FileFormat i3d::StringToFileFormat ( const string &  s  ) 

conversion from string to file format

I3D_DLLEXPORT ImgVoxelType i3d::StringToVoxelType ( const string &  s  ) 

Useful conversion functions

I3D_DLLEXPORT bool i3d::StrToFloat ( const string &  s,
float &  f 
)

String to Int

I3D_DLLEXPORT bool i3d::StrToInt ( const string &  s,
int &  i 
)

String to int

template<class T>
bool i3d::StrToVector3d ( const char *  from,
Vector3d< T > &  v 
) [inline]

Convert char * to Vector3d, returns true on success

template<class LABEL, class VOXEL>
I3D_DLLEXPORT double i3d::Surface ( const LabeledImage3d< LABEL, VOXEL > &  limg,
LABEL  label,
size_t &  volume 
)

Estimate surface (or perimeter for 2D) for a component with the given label. Computes also volume of the component in voxels.

template<class T>
I3D_DLLEXPORT void i3d::SwapHoriz ( size_t  width,
size_t  height,
T *  data 
)

Changing image orienation - horizontally

template<class T>
I3D_DLLEXPORT void i3d::SwapVert ( size_t  width,
size_t  height,
T *  data 
)

Changing image orienation - vertically

I3D_DLLEXPORT string i3d::Trim ( const string &  s  ) 

Returns string without leading and tailing whitespaces

template<class ORIGVOXEL, class LABEL, class VOXEL>
I3D_DLLEXPORT bool i3d::WeightedCenter ( const Image3d< ORIGVOXEL > &  img,
const LabeledImage3d< LABEL, VOXEL > &  labels,
LABEL  label,
Vector3d< float > &  center 
)

WeightedCenter computes the center (in microns) of a component with label lbl weighted by intensities in image img (img is the original

  • usually grayscale - image, from which the indexed image limg was formed). Coordinates of the center are given with respect to image img (the labeled image can be shifted with respect to img). The function returns false if the component is empty or contains only zero voxels. Otherwise it returns true and the center is returned in center. The voxel resolution is obtained from the labeled image.


Variable Documentation

struct I3D_DLLEXPORT i3d::BINARY

Definition of new type used for bilevel images. sizeof(GRAY8) == sizeof(BINARY) but typeid(GRAY8) != typeid(BINARY), so it's possible to differentiate these two types of images

Initial value:

{
        {"I3D", "i3d", IMG_I3D, 3},
        {"TARGA", "tga", IMG_TARGA, 2},
        {"JPEG", "jpg", IMG_JPEG, 2},
        {"TIFF", "tif", IMG_TIFF, 2},
        {"RAW", "mha", IMG_METAIO, 3},
        {"RAW", "mhd", IMG_METAIO, 3},
        {"ICS", "ics", IMG_ICS, 5}
}
supported image formats

constant representing white color

const METAIOTypeNameToEnum i3d::METAIONameToTypeConv[]

Initial value:

 {
    {"MET_NONE",MET_OTHER},
    {"MET_ASCII_CHAR",MET_OTHER},
    {"MET_CHAR",MET_OTHER},
    {"MET_UCHAR",MET_UCHAR},
    {"MET_SHORT",MET_OTHER},
    {"MET_USHORT",MET_USHORT},
    {"MET_INT",MET_OTHER},
    {"MET_UINT",MET_OTHER},
    {"MET_LONG",MET_OTHER},
    {"MET_ULONG",MET_OTHER},
    {"MET_FLOAT",MET_FLOAT},
    {"MET_DOUBLE",MET_DOUBLE},
    {"MET_STRING",MET_OTHER},
    {"MET_CHAR_ARRAY",MET_OTHER},
    {"MET_UCHAR_ARRAY",MET_OTHER},
    {"MET_SHORT_ARRAY",MET_OTHER},
    {"MET_USHORT_ARRAY",MET_OTHER},
    {"MET_INT_ARRAY",MET_OTHER},
    {"MET_UINT_ARRAY",MET_OTHER},
    {"MET_FLOAT_ARRAY",MET_OTHER},
    {"MET_DOUBLE_ARRAY",MET_OTHER},
    {"MET_FLOAT_MATRIX",MET_OTHER},
    {"MET_OTHER",MET_OTHER}
}
const table to convert String to METAIOType

constant representing black color

const METAIOTypeToImgVoxelTypeTable i3d::TypeConv[]

Initial value:

 {
    {1, MET_UCHAR, Gray8Voxel },
    {3, MET_UCHAR, RGBVoxel },
    {1, MET_USHORT, Gray16Voxel },
    {3, MET_USHORT, RGB16Voxel },
    {1, MET_FLOAT, FloatVoxel },
    {3, MET_FLOAT, VectFloatVoxel }, 
    {3, MET_DOUBLE, VectDoubleVoxel },
    {1, MET_OTHER, UnknownVoxel } 
}
const table to convert METAIOType to ImgVoxelType

template class I3D_DLLEXPORT i3d::Vector3d< int >

Explicit instantiations: