Classes | Typedefs | Enumerations | Functions
ecvl Namespace Reference

Classes

struct  arithmetic_superior_type
 
class  AugAdditiveLaplaceNoise
 Augmentation wrapper for ecvl::AdditiveLaplaceNoise. More...
 
class  AugAdditivePoissonNoise
 Augmentation wrapper for ecvl::AdditivePoissonNoise. More...
 
class  AugBrightness
 Augmentation wrapper for brightness adjustment. More...
 
class  AugCenterCrop
 Augmentation CenterCrop wrapper for ecvl::CenterCrop. More...
 
class  AugCoarseDropout
 Augmentation wrapper for ecvl::CoarseDropout. More...
 
class  AugDivBy255
 Augmentation DivBy255. More...
 
class  AugElasticTransform
 Augmentation wrapper for ecvl::ElasticTransform. More...
 
class  AugFlip
 Augmentation wrapper for ecvl::Flip2D. More...
 
class  AugGammaContrast
 Augmentation wrapper for ecvl::GammaContrast. More...
 
class  AugGaussianBlur
 Augmentation wrapper for ecvl::GaussianBlur. More...
 
class  AugGridDistortion
 Augmentation wrapper for ecvl::GridDistortion. More...
 
class  Augmentation
 Abstract class which represent a generic Augmentation function. More...
 
struct  AugmentationFactory
 
class  AugmentationParam
 Augmentations parameters. More...
 
class  AugMirror
 Augmentation wrapper for ecvl::Mirror2D. More...
 
class  AugNormalize
 Augmentation wrapper for ecvl::Normalize. More...
 
class  AugOpticalDistortion
 Augmentation wrapper for ecvl::OpticalDistortion. More...
 
class  AugPepper
 Augmentation wrapper for ecvl::Pepper. More...
 
class  AugResizeDim
 Augmentation wrapper for ecvl::ResizeDim. More...
 
class  AugResizeScale
 Augmentation wrapper for ecvl::ResizeScale. More...
 
class  AugRotate
 Augmentation wrapper for ecvl::Rotate2D. More...
 
class  AugSalt
 Augmentation wrapper for ecvl::Salt. More...
 
class  AugSaltAndPepper
 Augmentation wrapper for ecvl::SaltAndPepper. More...
 
class  AugScaleTo
 Augmentation wrapper for ecvl::AugScaleTo. More...
 
class  AugToFloat32
 Augmentation ToFloat32. More...
 
class  AugTranspose
 Augmentation wrapper for ecvl::Transpose. More...
 
struct  ConstContiguousIterator
 
class  ConstContiguousView
 
class  ConstContiguousViewXYC
 
struct  ConstIterator
 
class  ConstView
 
struct  ContiguousIterator
 
class  ContiguousView
 
class  ContiguousViewXYC
 
class  Dataset
 DeepHealth Dataset. More...
 
class  DatasetAugmentations
 Dataset Augmentations. More...
 
class  DLDataset
 DeepHealth Deep Learning Dataset. More...
 
class  FpgaHal
 
class  GenerateClassificationDataset
 Generate an ecvl::Dataset from a directory tree for a classification task. More...
 
class  GenerateDataset
 Abstract class which fill the dataset object with name and description, features common to all types of datasets. More...
 
class  GenerateSegmentationDataset
 Generate an ecvl::Dataset from a directory tree for a segmentation task. More...
 
class  GpuHal
 
class  Image
 Image class. More...
 
struct  Iterator
 
struct  larger_arithmetic_type
 
class  MetaData
 
class  OneOfAugmentationContainer
 OneOfAugmentationContainer. More...
 
class  OverlayMetaData
 
class  param
 
class  param_list
 
struct  promote_superior_type
 
class  Sample
 Sample image in a dataset. More...
 
class  SequentialAugmentationContainer
 SequentialAugmentationContainer. More...
 
struct  Shader
 
struct  SignedTable1D
 
struct  SignedTable2D
 
class  Split
 Splits of a dataset. More...
 
struct  Table1D
 
struct  Table2D
 
struct  TypeInfo
 
struct  TypeInfo< ecvl::DataType::float32 >
 
struct  TypeInfo< ecvl::DataType::float64 >
 
struct  TypeInfo< ecvl::DataType::int16 >
 
struct  TypeInfo< ecvl::DataType::int32 >
 
struct  TypeInfo< ecvl::DataType::int64 >
 
struct  TypeInfo< ecvl::DataType::int8 >
 
struct  TypeInfo< ecvl::DataType::none >
 
struct  TypeInfo< ecvl::DataType::uint16 >
 
struct  TypeInfo< ecvl::DataType::uint8 >
 
class  View
 

Typedefs

typedef std::array< int, 2 > Point2i
 
typedef std::array< double, 2 > Point2d
 
typedef std::array< int, 2 > Size2i
 
typedef std::array< double, 2 > Size2d
 
typedef std::vector< double > Scalar
 
template<ecvl::DataType DT>
using TypeInfo_t = typename TypeInfo< DT >::basetype
 
template<typename T >
using optional = std::experimental::optional< T >
 
using bad_optional_access = std::experimental::bad_optional_access
 
template<typename T , typename U >
using larger_arithmetic_type_t = typename larger_arithmetic_type< T, U >::type
 
template<typename T , typename U >
using arithmetic_superior_type_t = typename arithmetic_superior_type< T, U >::type
 
template<typename T , typename U >
using promote_superior_type_t = typename promote_superior_type< T, U >::type
 
template<DataType DT, DataType DU>
using promote_superior_type_dt = promote_superior_type_t< TypeInfo_t< DT >, TypeInfo_t< DU > >
 

Enumerations

enum  DataType {
  DataType::ECVL_TUPLE, DataType::int8, DataType::int16, DataType::int32,
  DataType::int64, DataType::float32, DataType::float64, DataType::uint8,
  DataType::uint16, DataType::none
}
 DataType is an enum class which defines data types allowed for images. More...
 
enum  ColorType {
  ColorType::none, ColorType::GRAY, ColorType::RGB, ColorType::RGBA,
  ColorType::BGR, ColorType::HSV, ColorType::YCbCr
}
 Enum class representing the ECVL supported color spaces. More...
 
enum  ImReadMode { ImReadMode::GRAYSCALE = 0, ImReadMode::COLOR = 1, ImReadMode::ANYCOLOR = 4 }
 Enum class representing the ECVL ImRead flags. More...
 
enum  ThresholdingType { ThresholdingType::BINARY, ThresholdingType::BINARY_INV }
 Enum class representing the ECVL thresholding types. More...
 
enum  InterpolationType {
  InterpolationType::nearest, InterpolationType::linear, InterpolationType::area, InterpolationType::cubic,
  InterpolationType::lanczos4
}
 Enum class representing the ECVL interpolation types. More...
 
enum  MorphType {
  MorphType::MORPH_ERODE, MorphType::MORPH_DILATE, MorphType::MORPH_OPEN, MorphType::MORPH_CLOSE,
  MorphType::MORPH_GRADIENT, MorphType::MORPH_TOPHAT, MorphType::MORPH_BLACKHAT, MorphType::MORPH_HITMISS
}
 Enum class representing the ECVL morphology types. More...
 
enum  BorderType {
  BorderType::BORDER_CONSTANT, BorderType::BORDER_REPLICATE, BorderType::BORDER_REFLECT, BorderType::BORDER_WRAP,
  BorderType::BORDER_REFLECT_101, BorderType::BORDER_TRANSPARENT
}
 Enum class representing the ECVL border types. More...
 
enum  InpaintType { InpaintType::INPAINT_NS, InpaintType::INPAINT_TELEA }
 Enum class representing the ECVL inpaint types. More...
 
enum  SplitType : unsigned { SplitType::training, SplitType::validation, SplitType::test }
 Enum class representing the Dataset supported splits. More...
 

Functions

void Add (const Image &src1, const Image &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
 Adds two source Images storing the result into a destination Image. More...
 
template<typename ST2 >
void Add (const Image &src1, const ST2 &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
 Adds a scalar value to an Images storing the result into a destination Image. More...
 
template<typename ST1 >
void Add (const ST1 &src1, const Image &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
 Adds a scalar value to an Images storing the result into a destination Image. More...
 
void Sub (const Image &src1, const Image &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
 
template<typename ST2 >
void Sub (const Image &src1, const ST2 &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
 
template<typename ST1 >
void Sub (const ST1 &src1, const Image &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
 
void Mul (const Image &src1, const Image &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
 
template<typename ST2 >
void Mul (const Image &src1, const ST2 &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
 
template<typename ST1 >
void Mul (const ST1 &src1, const Image &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
 
void Div (const Image &src1, const Image &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
 
template<typename ST2 >
void Div (const Image &src1, const ST2 &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
 
template<typename ST1 >
void Div (const ST1 &src1, const Image &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
 
void Neg (const Image &src, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
 Negation of an Image. More...
 
double SqDist (const Point2i &a, const Point2i &b)
 Calculate the distance squared between two ecvl::Point2i. More...
 
uint8_t DataTypeSize (DataType dt)
 Provides the size in bytes of a given DataType. More...
 
constexpr size_t DataTypeSize ()
 Function to get the number of existing DataType at compile time. More...
 
constexpr size_t DataTypeSignedSize ()
 Function to get the number of existing signed DataType at compile time. More...
 
constexpr std::array< DataType, DataTypeSize()> DataTypeArray ()
 Function to get a std::array with all the DataType values at compile time. More...
 
constexpr std::array< DataType, DataTypeSignedSize()> DataTypeSignedArray ()
 Function to get a std::array with all the signed DataType values at compile time. More...
 
template<typename T >
int vsize (const std::vector< T > &v)
 
void RearrangeChannels (const Image &src, Image &dst, const std::string &channels)
 Changes the order of the Image dimensions. More...
 
void RearrangeChannels (const Image &src, Image &dst, const std::string &channels, DataType new_type)
 Same as RearrangeChannels(), with the chance to specify the DataType of the output Image. More...
 
void CopyImage (const Image &src, Image &dst, DataType new_type=DataType::none)
 Copies the source Image into the destination Image. More...
 
void CopyImage (const Image &src, Image &dst, DataType new_type, const std::string &channels)
 Same as CopyImage(), with the chance to specify the channels order of the output Image. More...
 
void ShallowCopyImage (const Image &src, Image &dst)
 Performs a shallow copy of the source Image into the destination. More...
 
void ConvertTo (const Image &src, Image &dst, DataType dtype, bool saturate=true)
 Convert Image to another DataType. More...
 
bool ImRead (const ecvl::filesystem::path &filename, Image &dst, ImReadMode flags=ImReadMode::ANYCOLOR)
 Loads an image from a file. More...
 
bool ImReadMulti (const ecvl::filesystem::path &filename, Image &dst)
 Loads a multi-page image from a file. More...
 
bool ImWrite (const ecvl::filesystem::path &filename, const Image &src)
 Saves an image into a specified file. More...
 
int GetOpenCVInterpolation (InterpolationType interp)
 Given an InterpolationType, the GetOpenCVInterpolation function returns the associated OpenCV enum value. More...
 
void ResizeDim (const ecvl::Image &src, ecvl::Image &dst, const std::vector< int > &newdims, InterpolationType interp=InterpolationType::linear)
 Resizes an Image to the specified dimensions. More...
 
void ResizeScale (const ecvl::Image &src, ecvl::Image &dst, const std::vector< double > &scales, InterpolationType interp=InterpolationType::linear)
 Resizes an Image by scaling the dimensions to a given scale factor. More...
 
void Flip2D (const ecvl::Image &src, ecvl::Image &dst)
 Flips an Image. More...
 
void Mirror2D (const ecvl::Image &src, ecvl::Image &dst)
 Mirrors an Image. More...
 
void Rotate2D (const ecvl::Image &src, ecvl::Image &dst, double angle, const std::vector< double > &center={}, double scale=1.0, InterpolationType interp=InterpolationType::linear)
 Rotates an Image. More...
 
void RotateFullImage2D (const ecvl::Image &src, ecvl::Image &dst, double angle, double scale=1.0, InterpolationType interp=InterpolationType::linear)
 Rotates an Image resizing the output accordingly. More...
 
void ChangeColorSpace (const Image &src, Image &dst, ColorType new_type)
 Copies the source Image into destination Image changing the color space. More...
 
void Threshold (const Image &src, Image &dst, double thresh, double maxval, ThresholdingType thresh_type=ThresholdingType::BINARY)
 Applies a fixed threshold to an input Image. More...
 
void MultiThreshold (const Image &src, Image &dst, const std::vector< int > &thresholds, int minval=0, int maxval=255)
 Applies multiple thresholds to the input Image. More...
 
int OtsuThreshold (const Image &src)
 Calculates the Otsu thresholding value. More...
 
std::vector< int > OtsuMultiThreshold (const Image &src, int n_thresholds=2)
 Calculates the Otsu thresholding values. More...
 
void Filter2D (const Image &src, Image &dst, const Image &ker, DataType type=DataType::none)
 Convolves an Image with a kernel. More...
 
void SeparableFilter2D (const Image &src, Image &dst, const std::vector< double > &kerX, const std::vector< double > &kerY, DataType type=DataType::none)
 Convolves an Image with a couple of 1-dimensional kernels. More...
 
void GaussianBlur (const Image &src, Image &dst, int sizeX, int sizeY, double sigmaX, double sigmaY=0)
 Blurs an Image using a Gaussian kernel. More...
 
void GaussianBlur (const Image &src, Image &dst, double sigma)
 
void AdditiveLaplaceNoise (const Image &src, Image &dst, double std_dev)
 Adds Laplace distributed noise to an Image. More...
 
void AdditivePoissonNoise (const Image &src, Image &dst, double lambda)
 Adds Poisson distributed noise to an Image. More...
 
void GammaContrast (const Image &src, Image &dst, double gamma)
 Adjust contrast by scaling each pixel value X to 255 * ((X/255) ** gamma). More...
 
void CoarseDropout (const Image &src, Image &dst, double p, double drop_size, bool per_channel)
 Sets rectangular areas within an Image to zero. More...
 
void IntegralImage (const Image &src, Image &dst, DataType dst_type=DataType::float64)
 Calculate the integral image of the source Image. More...
 
void NonMaximaSuppression (const Image &src, Image &dst)
 Calculate the Non-Maxima suppression of the source Image. More...
 
std::vector< ecvl::Point2iGetMaxN (const Image &src, size_t n)
 Get the n maximum values that are in the source Image. More...
 
void ConnectedComponentsLabeling (const Image &src, Image &dst)
 Labels connected components in a binary Image. More...
 
void FindContours (const Image &src, std::vector< std::vector< Point2i >> &contours)
 Finds contours in a binary image. More...
 
void Stack (const std::vector< Image > &src, Image &dst)
 Stack a sequence of Images along the depth dimension (images width and height must match) More...
 
void HConcat (const std::vector< Image > &src, Image &dst)
 Horizontal concatenation of images (with the same number of rows) More...
 
void VConcat (const std::vector< Image > &src, Image &dst)
 Vertical concatenation of images (with the same number of columns) More...
 
void Morphology (const Image &src, Image &dst, MorphType op, Image &kernel, Point2i anchor={ -1, -1 }, int iterations=1, BorderType border_type=BorderType::BORDER_CONSTANT, const int &border_value=0)
 Performs advanced morphological transformations using an erosion and dilation as basic operations. More...
 
void Inpaint (const Image &src, Image &dst, const Image &inpaintMask, double inpaintRadius, InpaintType flag=InpaintType::INPAINT_TELEA)
 Restores the selected region in an image using the region neighborhood. More...
 
void MeanStdDev (const Image &src, std::vector< double > &mean, std::vector< double > &stddev)
 Calculates the mean and the standard deviation of an Image. More...
 
void Transpose (const Image &src, Image &dst)
 Swap rows and columns of an Image. More...
 
void GridDistortion (const Image &src, Image &dst, int num_steps=5, const std::array< float, 2 > &distort_limit={ -0.3f, 0.3f }, InterpolationType interp=InterpolationType::linear, BorderType border_type=BorderType::BORDER_REFLECT_101, const int &border_value=0, const unsigned seed=std::default_random_engine::default_seed)
 Randomly stretch or reduce each cell of the grid in which the input Image is divided into. Based on https://github.com/albumentations-team/albumentations/blob/master/albumentations/augmentations/transforms.py#L1175. More...
 
void ElasticTransform (const Image &src, Image &dst, double alpha=34., double sigma=4., InterpolationType interp=InterpolationType::linear, BorderType border_type=BorderType::BORDER_REFLECT_101, const int &border_value=0, const unsigned seed=std::default_random_engine::default_seed)
 Elastic deformation of input Image. Based on https://github.com/albumentations-team/albumentations/blob/master/albumentations/augmentations/transforms.py#L1235. More...
 
void OpticalDistortion (const Image &src, Image &dst, const std::array< float, 2 > &distort_limit={ -0.3f, 0.3f }, const std::array< float, 2 > &shift_limit={ -0.1f, 0.1f }, InterpolationType interp=InterpolationType::linear, BorderType border_type=BorderType::BORDER_REFLECT_101, const int &border_value=0, const unsigned seed=std::default_random_engine::default_seed)
 Barrel / pincushion distortion. Based on https://github.com/albumentations-team/albumentations/blob/master/albumentations/augmentations/transforms.py#L1114. More...
 
void Salt (const Image &src, Image &dst, double p, bool per_channel=false, const unsigned seed=std::default_random_engine::default_seed)
 Adds salt noise (white pixels) to an Image. More...
 
void Pepper (const Image &src, Image &dst, double p, bool per_channel=false, const unsigned seed=std::default_random_engine::default_seed)
 Adds pepper noise (black pixels) to an Image. More...
 
void SaltAndPepper (const Image &src, Image &dst, double p, bool per_channel=false, const unsigned seed=std::default_random_engine::default_seed)
 Adds salt and pepper noise (white and black pixels) to an Image. White and black pixels are equally likely. More...
 
void SliceTimingCorrection (const Image &src, Image &dst, bool odd=false, bool down=false)
 Corrects each voxel's time-series. Slice timing correction works by using (Hanning-windowed) sinc interpolation to shift each time-series by an appropriate fraction of a TR relative to the middle of the TR period. The default slice order acquisition is from the bottom of the brain to the top. More...
 
void Moments (const Image &src, Image &moments, int order=3, DataType type=DataType::float64)
 Calculate all raw image moments of the source Image up to the specified order. More...
 
void CentralMoments (const Image &src, Image &moments, std::vector< double > center, int order=3, DataType type=DataType::float64)
 Calculate all central image moments of the source Image up to the specified order. More...
 
void DrawEllipse (Image &src, ecvl::Point2i center, ecvl::Size2i axes, double angle, const ecvl::Scalar &color, int thickness=1)
 Draw an ellipse over the specified Image. More...
 
void DropColorChannel (Image &src)
 Remove color channel from the input Image. More...
 
void Normalize (const Image &src, Image &dst, const double &mean, const double &std)
 Normalize Image image with mean and standard deviation. More...
 
void Normalize (const Image &src, Image &dst, const std::vector< double > &mean, const std::vector< double > &std)
 Normalize xyc Image image with separate mean and standard deviation for each color channel. More...
 
void CenterCrop (const ecvl::Image &src, ecvl::Image &dst, const std::vector< int > &size)
 Crops the given image at the center. More...
 
void ScaleTo (const Image &src, Image &dst, const double &new_min, const double &new_max)
 Linearly scale an Image into a new range. More...
 
template<DataType ODT, typename IDT >
TypeInfo< ODT >::basetype saturate_cast (IDT v)
 Saturate a value (of any type) to the specified type. More...
 
template<typename ODT , typename IDT >
ODT saturate_cast (const IDT &v)
 Saturate a value (of any type) to the specified type. More...
 
bool DicomRead (const ecvl::filesystem::path &filename, Image &dst)
 Loads an image from a DICOM file. More...
 
bool DicomWrite (const ecvl::filesystem::path &filename, const Image &src)
 Saves an image into a specified DICOM file. More...
 
bool NiftiRead (const ecvl::filesystem::path &filename, Image &dst)
 Loads a nifti image from a file. More...
 
bool NiftiWrite (const ecvl::filesystem::path &filename, const Image &src)
 Saves an image into a specified nifti file. More...
 
ecvl::Image MatToImage (const cv::Mat &m, ColorType ctype=ColorType::none)
 Convert a cv::Mat into an ecvl::Image. More...
 
ecvl::Image MatVecToImage (const std::vector< cv::Mat > &v)
 Convert a std::vector<cv::Mat> into an ecvl::Image. More...
 
cv::Mat ImageToMat (const Image &img)
 Convert an ECVL Image into OpenCV Mat. More...
 
bool OpenSlideRead (const ecvl::filesystem::path &filename, Image &dst, const int level, const std::vector< int > &dims)
 Loads a region of a whole-slide image file. More...
 
bool OpenSlideGetLevels (const ecvl::filesystem::path &filename, std::vector< std::array< int, 2 >> &levels)
 Get width and height for each level of a whole-slide image. More...
 
template<typename T , typename U >
promote_superior_type_t< T, U > PromoteAdd (T lhs, U rhs)
 
template<typename T , typename U >
promote_superior_type_t< T, U > PromoteSub (T lhs, U rhs)
 
template<typename T , typename U >
promote_superior_type_t< T, U > PromoteMul (T lhs, U rhs)
 
template<typename T , typename U >
promote_superior_type_t< T, U > PromoteDiv (T lhs, U rhs)
 
constexpr unsigned operator+ (SplitType const val)
 
InterpolationType StrToInterpolationType (const std::string &interp, const std::string &aug_name)
 
void TensorToImage (Tensor *&t, Image &img)
 Convert an EDDL Tensor into an ECVL Image. More...
 
void TensorToView (Tensor *&t, View< DataType::float32 > &v)
 Convert an EDDL Tensor into an ECVL View. More...
 
void ImageToTensor (const Image &img, Tensor *&t)
 Convert an ECVL Image into an EDDL Tensor. More...
 
void ImageToTensor (const Image &img, Tensor *&t, const int &offset)
 Insert an ECVL Image into an EDDL Tensor. More...
 
void ImShow (const Image &img)
 Displays an Image. More...
 
wxImage WxFromImg (Image &img)
 Convert an ECVL Image into a wxImage. More...
 
Image ImgFromWx (const wxImage &wx)
 Convert a wxImage into an ECVL Image. More...
 

Typedef Documentation

◆ arithmetic_superior_type_t

template<typename T , typename U >
using ecvl::arithmetic_superior_type_t = typedef typename arithmetic_superior_type<T, U>::type

Definition at line 45 of file type_promotion.h.

◆ bad_optional_access

using ecvl::bad_optional_access = typedef std::experimental::bad_optional_access

Definition at line 74 of file optional.h.

◆ larger_arithmetic_type_t

template<typename T , typename U >
using ecvl::larger_arithmetic_type_t = typedef typename larger_arithmetic_type<T, U>::type

Definition at line 32 of file type_promotion.h.

◆ optional

template<typename T >
using ecvl::optional = typedef std::experimental::optional<T>

Definition at line 72 of file optional.h.

◆ Point2d

typedef std::array<double, 2> ecvl::Point2d

Definition at line 26 of file datatype.h.

◆ Point2i

typedef std::array<int, 2> ecvl::Point2i

Definition at line 25 of file datatype.h.

◆ promote_superior_type_dt

template<DataType DT, DataType DU>
using ecvl::promote_superior_type_dt = typedef promote_superior_type_t<TypeInfo_t<DT>, TypeInfo_t<DU> >

Definition at line 64 of file type_promotion.h.

◆ promote_superior_type_t

template<typename T , typename U >
using ecvl::promote_superior_type_t = typedef typename promote_superior_type<T, U>::type

Definition at line 61 of file type_promotion.h.

◆ Scalar

typedef std::vector<double> ecvl::Scalar

Definition at line 29 of file datatype.h.

◆ Size2d

typedef std::array<double, 2> ecvl::Size2d

Definition at line 28 of file datatype.h.

◆ Size2i

typedef std::array<int, 2> ecvl::Size2i

Definition at line 27 of file datatype.h.

◆ TypeInfo_t

template<ecvl::DataType DT>
using ecvl::TypeInfo_t = typedef typename TypeInfo<DT>::basetype

Definition at line 67 of file datatype.h.

Enumeration Type Documentation

◆ BorderType

enum ecvl::BorderType
strong

Enum class representing the ECVL border types.

Enumerator
BORDER_CONSTANT 

iiiiii|abcdefgh|iiiiiii with some specified i

BORDER_REPLICATE 

aaaaaa|abcdefgh|hhhhhhh

BORDER_REFLECT 

fedcba|abcdefgh|hgfedcb

BORDER_WRAP 

cdefgh|abcdefgh|abcdefg

BORDER_REFLECT_101 

gfedcb|abcdefgh|gfedcba

BORDER_TRANSPARENT 

uvwxyz|abcdefgh|ijklmno

Definition at line 362 of file imgproc.h.

◆ ColorType

enum ecvl::ColorType
strong

Enum class representing the ECVL supported color spaces.

Enumerator
none 

Special ColorType for Images that contain only data and do not have any ColorType

GRAY 

Gray-scale ColorType

RGB 

RGB ColorType

RGBA 

RGBA ColorType

BGR 

BGR ColorType

HSV 

HSV ColorType

YCbCr 

YCbCr ColorType

Definition at line 50 of file image.h.

◆ DataType

enum ecvl::DataType
strong

DataType is an enum class which defines data types allowed for images.

Enumerator
ECVL_TUPLE 
int8 

int8_t

int16 

int16_t

int32 

int32_t

int64 

int64_t

float32 

float

float64 

double

uint8 

uint8_t

uint16 

uint16_t

none 

none type

Definition at line 43 of file datatype.h.

◆ ImReadMode

enum ecvl::ImReadMode
strong

Enum class representing the ECVL ImRead flags.

Enumerator
GRAYSCALE 

If set, always convert image to the single channel grayscale image (codec internal conversion).

COLOR 

If set, always convert image to the 3 channel BGR color image.

ANYCOLOR 

If set, the image color format is deduced from file format.

Definition at line 28 of file imgcodecs.h.

◆ InpaintType

enum ecvl::InpaintType
strong

Enum class representing the ECVL inpaint types.

Enumerator
INPAINT_NS 

Use Navier-Stokes based method.

INPAINT_TELEA 

Use the algorithm proposed by Alexandru Telea.

Definition at line 394 of file imgproc.h.

◆ InterpolationType

Enum class representing the ECVL interpolation types.

Enumerator
nearest 

Nearest neighbor interpolation

linear 

Bilinear interpolation

area 

Resampling using pixel area relation. It may be a preferred method for image decimation, as it gives moire-free results. But when the image is zoomed, it is similar to the nearest method.

cubic 

Bicubic interpolation

lanczos4 

Lanczos interpolation over 8x8 neighborhood

Definition at line 37 of file imgproc.h.

◆ MorphType

enum ecvl::MorphType
strong

Enum class representing the ECVL morphology types.

Enumerator
MORPH_ERODE 
MORPH_DILATE 
MORPH_OPEN 

an opening operation

\[\texttt{dst} = \mathrm{open} ( \texttt{src} , \texttt{element} )= \mathrm{dilate} ( \mathrm{erode} ( \texttt{src} , \texttt{element} ))\]

MORPH_CLOSE 

a closing operation

\[\texttt{dst} = \mathrm{close} ( \texttt{src} , \texttt{element} )= \mathrm{erode} ( \mathrm{dilate} ( \texttt{src} , \texttt{element} ))\]

MORPH_GRADIENT 

a morphological gradient

\[\texttt{dst} = \mathrm{morph\_grad} ( \texttt{src} , \texttt{element} )= \mathrm{dilate} ( \texttt{src} , \texttt{element} )- \mathrm{erode} ( \texttt{src} , \texttt{element} )\]

MORPH_TOPHAT 

"top hat"

\[\texttt{dst} = \mathrm{tophat} ( \texttt{src} , \texttt{element} )= \texttt{src} - \mathrm{open} ( \texttt{src} , \texttt{element} )\]

MORPH_BLACKHAT 

"black hat"

\[\texttt{dst} = \mathrm{blackhat} ( \texttt{src} , \texttt{element} )= \mathrm{close} ( \texttt{src} , \texttt{element} )- \texttt{src}\]

MORPH_HITMISS 

"hit or miss". Only supported for DataType::uint8 binary images.

Definition at line 341 of file imgproc.h.

◆ SplitType

enum ecvl::SplitType : unsigned
strong

Enum class representing the Dataset supported splits.

Enumerator
training 
validation 
test 

Definition at line 38 of file dataset_parser.h.

◆ ThresholdingType

Enum class representing the ECVL thresholding types.

Enumerator
BINARY 

\[\texttt{dst} (x,y) = \fork{\texttt{maxval}}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{0}{otherwise}\]

BINARY_INV 

\[\texttt{dst} (x,y) = \fork{0}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{maxval}}{otherwise}\]

Definition at line 27 of file imgproc.h.

Function Documentation

◆ Add() [1/3]

void ecvl::Add ( const Image src1,
const Image src2,
Image dst,
DataType  dst_type = DataType::none,
bool  saturate = true 
)
inline

Adds two source Images storing the result into a destination Image.

The procedure takes two input Images (src1 and src2) and adds them together performing a pixel-wise addition and storing the result into the destination image. Saturation is applied by default. If it is not the desired behavior change the saturate parameter to false.

The operation performed is dst = src1 + src2.

If the DataType of the destination Image is not specified (DataType::none) the destination Image will preserve its own type, if any, or it will inherit the DataType of src1 otherwise.

Parameters
[in]src1Augend operand (an Image).
[in]src2Addend operand (an Image).
[out]dstDestination Image. It will store the final result.
[in]dst_typeDesired type for the destination Image. If none (default) the destination Image will preserve its own type, if any, or it will inherit the DataType of src1 otherwise.
[in]saturateWhether to apply saturation or not. Default is true.
Returns
.
Examples
example_image_view.cpp.

Definition at line 69 of file arithmetic.h.

◆ Add() [2/3]

template<typename ST2 >
void ecvl::Add ( const Image src1,
const ST2 &  src2,
Image dst,
DataType  dst_type = DataType::none,
bool  saturate = true 
)

Adds a scalar value to an Images storing the result into a destination Image.

The procedure takes two input values, an Image (src1) and a scalar (src2) and adds them together: each pixel of the Image is increased by the scalar value and the result is stored in the destination Image. Saturation is applied by default. If it is not the desired behavior change the saturate parameter to false.

The operation performed is dst = src1 + src2.

If the DataType of the destination Image is not specified (DataType::none) the destination Image will preserve its own type, if any, or it will inherit the DataType of src1 otherwise.

Parameters
[in]src1Augend operand (an Image).
[in]src2Addend operand (a scalar value).
[out]dstDestination Image. It will store the final result.
[in]dst_typeDesired type for the destination Image. If none (default) the destination Image will preserve its own type, if any, or it will inherit the DataType of src1 otherwise.
[in]saturateWhether to apply saturation or not. Default is true.
Returns
.

Definition at line 92 of file arithmetic.h.

◆ Add() [3/3]

template<typename ST1 >
void ecvl::Add ( const ST1 &  src1,
const Image src2,
Image dst,
DataType  dst_type = DataType::none,
bool  saturate = true 
)

Adds a scalar value to an Images storing the result into a destination Image.

The procedure takes two input values, a scalar (src1) and an Image (src2) and adds them together: each pixel of the Image is increased by the scalar value and the result is stored in the destination Image. Saturation is applied by default. If it is not the desired behavior change the saturate parameter to false.

The operation performed is dst = src1 + src2.

If the DataType of the destination Image is not specified (DataType::none) the destination Image will preserve its own type, if any, or it will inherit the DataType of src1 otherwise.

Parameters
[in]src1Augend operand (a scalar value).
[in]src2Addend operand (an Image).
[out]dstDestination Image. It will store the final result.
[in]dst_typeDesired type for the destination Image. If none (default) the destination Image will preserve its own type, if any, or it will inherit the DataType of src2 otherwise.
[in]saturateWhether to apply saturation or not. Default is true.
Returns
.

Definition at line 116 of file arithmetic.h.

◆ AdditiveLaplaceNoise()

void ecvl::AdditiveLaplaceNoise ( const Image src,
Image dst,
double  std_dev 
)

Adds Laplace distributed noise to an Image.

Parameters
[in]srcInput Image.
[out]dstOutput Image.
[in]std_devStandard deviation of the noise generating distribution. Suggested values are around 255 * 0.05 for uint8 Images.
Examples
example_imgproc.cpp.

◆ AdditivePoissonNoise()

void ecvl::AdditivePoissonNoise ( const Image src,
Image dst,
double  lambda 
)

Adds Poisson distributed noise to an Image.

Parameters
[in]srcInput Image.
[out]dstOutput Image.
[in]lambdaLambda parameter of the Poisson distribution.

◆ CenterCrop()

void ecvl::CenterCrop ( const ecvl::Image src,
ecvl::Image dst,
const std::vector< int > &  size 
)

Crops the given image at the center.

The function crops Image src at the center and outputs the result in dst.

Parameters
[in]srcThe input Image.
[out]dstThe output resized Image.
[in]sizestd::vector<int> specifies the desired output size of the crop. Must be in the order [w,h].
Examples
example_imgproc.cpp.

◆ CentralMoments()

void ecvl::CentralMoments ( const Image src,
Image moments,
std::vector< double >  center,
int  order = 3,
DataType  type = DataType::float64 
)

Calculate all central image moments of the source Image up to the specified order.

When working with a 2D image, naming \(\bar{x} = \frac{M_{10}}{M_{00}}\) and \(\bar{y} = \frac{M_{01}}{M_{00}}\) the components of the centroid (see documentation of Moments() for more details) and \(I(x,y)\) the pixel intensities, the central moments are calculated with the following formula:

\( \mu_{ij} = \sum_x{\sum_y{(x-\bar{x})^i(y-\bar{y})^jI(x,y)}} \)

The central moments up to order 3 are then:

\(\mu_{00} = M_{00}\),
\(\mu_{01} = 0\),
\(\mu_{10} = 0\),
\(\mu_{11} = M_{11} - \bar{x}M_{01} = M_{11} - \bar{y}M_{10}\),
\(\mu_{20} = M_{20} - \bar{x}M_{10}\),
\(\mu_{02} = M_{02} - \bar{y}M_{01}\),
\(\mu_{21} = M_{21} - 2\bar{x}M_{11} - \bar{y}M_{20} + 2\bar{x}^2M_{01}\),
\(\mu_{12} = M_{12} - 2\bar{y}M_{11} - \bar{x}M_{02} + 2\bar{y}^2M_{10}\),
\(\mu_{30} = M_{30} - 3\bar{x}M_{20} + 2\bar{x}^2M_{10}\),
\(\mu_{03} = M_{03} - 3\bar{y}M_{02} + 2\bar{y}^2M_{01}\)

The formula above can be accordingly extended when working with higher dimensions. Note that central moments are translational invariant. Moments are stored in the output moments Image in the same order as for source channels. The output moments Image will be on the same device of the source Image.

Information about image orientation can be derived from the covariance matrix of the image \(I(x,y)\), constructed with the second order central moments:

\(cov[I(x,y)] = \begin{bmatrix}\mu_{20}' & \mu_{11}'\\ \mu_{11}' & \mu_{02}'\end{bmatrix}\)

where

\(\mu_{20}' = \frac{\mu_{20}}{\mu_{00}} = \frac{M_{20}}{M_{00}} − \bar{x}^2\)
\(\mu_{02}' = \frac{\mu_{02}}{\mu_{00}} = \frac{M_{02}}{M_{00}} − \bar{y}^2\)
\(\mu_{11}' = \frac{\mu_{11}}{\mu_{00}} = \frac{M_{11}}{M_{00}} − \bar{x}\bar{y}\)

The eigenvectors of the \(cov[I(x,y)]\) matrix correspond to the major and minor axes of the image intensity. The orientation can be extracted as:

\(\theta = \frac{1}{2}arctan(\frac{2\mu_{11}'}{\mu_{20}' - \mu_{02}'})\)

On the other hand, the eigenvalues of the \(cov[I(x,y)]\) matrix are given by:

\(\lambda_i = \frac{\mu_{20}' + \mu_{02}'}{2} \pm \frac{\sqrt{4\mu_{11}'^2 + (\mu_{20}' - \mu_{02}')^2}}{2} \)

Eigenvalues are proportional to the square length of the eigenvector axes. The half-axes of the ellipse generated by the eigenvectors are given by \(\frac{d}{\sqrt{\lambda_1}}\) and \(\frac{d}{\sqrt{\lambda_2}}\) where \(d\) is the proportional factor. Considering that the moment \(\mu_{00} = M_{00}\) is the area (when the image is binary) of the image objects we can easily calculate \(d\) using the following equation:

\(\mu_{00} = \pi \frac{d^2}{\sqrt{\lambda_1 \lambda_2}}\)

Additionally, the eccentricity of the image can be calculates as:

\(e = \sqrt{1 - \frac{\lambda_2}{\lambda_1}}\)

Parameters
[in]srcInput Image on which calculating row moments up to the specified order. It must be a grayscale (ColorType::GRAY) or a data (ColorType::none) Image.
[out]momentsOutput data (ColorType:none) Image containing the computed raw image moments. The moments DataType is specified by the type parameter. The size of the Image will be (order + 1, order + 1)
[in]centerVector (std::vector<double>) representing the center coordinates: they can be calculated from raw moments. As an example, for a 2d image center coordinates are given by \((\frac{M_{10}}{M_{00}}, \frac{M_{01}}{M_{00}})\). See Moments() documentation for more details. center.size() and src.dims_ must match in size (except for the 'c' channel). The source axes order must be the same used to specify center coordinates.
[in]orderRaw image moments will be calculated up to the specified order. Default is 3.
[in]typeSpecify the ecvl::DataType to be used for the moments Image. It could be either DataType::float32 or DataType::float64. Default is DataType::float64.
Examples
example_moments.cpp.

◆ ChangeColorSpace()

void ecvl::ChangeColorSpace ( const Image src,
Image dst,
ColorType  new_type 
)

Copies the source Image into destination Image changing the color space.

The ChangeColorSpace procedure converts the color space of the source Image into the specified color space. New data are copied into destination Image. Source and destination can be contiguous or not and can also be the same Image.

Parameters
[in]srcThe input Image to convert in the new color space.
[out]dstThe output Image in the "new_type" color space.
[in]new_typeThe new color space in which the src Image must be converted.
Examples
example_ecvl_gui.cpp, example_image_view.cpp, example_imgproc.cpp, example_moments.cpp, example_nifti_dicom.cpp, and example_threshold.cpp.

◆ CoarseDropout()

void ecvl::CoarseDropout ( const Image src,
Image dst,
double  p,
double  drop_size,
bool  per_channel 
)

Sets rectangular areas within an Image to zero.

Parameters
[in]srcInput Image.
[out]dstOutput Image.
[in]pProbability of any rectangle being set to zero.
[in]drop_sizeSize of rectangles in percentage of the input Image.
[in]per_channelWhether to use the same value for all channels of a pixel or not.
Examples
example_imgproc.cpp.

◆ ConnectedComponentsLabeling()

void ecvl::ConnectedComponentsLabeling ( const Image src,
Image dst 
)

Labels connected components in a binary Image.

The ConnectedComponentsLabeling() procedure implement the Spaghetti algorithm described in [1], an extremely efficient algorithm to label connected components inside binary images using 8-way connectivity.

Parameters
[in]srcInput Image. It must be with channels "xyc", only one color channel and DataType::uint8.
[out]dstOutput Image.
Examples
example_imgproc.cpp.

◆ ConvertTo()

void ecvl::ConvertTo ( const Image src,
Image dst,
DataType  dtype,
bool  saturate = true 
)

Convert Image to another DataType.

Parameters
[in]srcSource Image to be converted into destination Image.
[out]dstDestination Image that will hold a converted copy of the source Image.
[in]dtypeDataType Desired DataType of dst Image.
[in]saturateWheter to apply saturate_cast to avoid possible overflows.

◆ CopyImage() [1/2]

void ecvl::CopyImage ( const Image src,
Image dst,
DataType  new_type = DataType::none 
)

Copies the source Image into the destination Image.

The CopyImage() procedure takes an Image and copies its data into the destination Image. Source and destination cannot be the same Image. Source cannot be a Image with DataType::none. The optional new_type parameter can be used to change the DataType of the destination Image. This function is mainly designed to change the DataType of an Image, copying its data into a new Image or to copy an Image into a View as a patch. So if you just want to copy an Image as it is, use the copy constructor or = instead. Anyway, the procedure will handle all the possible situations that may happen trying to avoid unnecessary allocations. When the DataType is not specified the function will have the following behaviors:

  • if the destination Image is empty the source will be directly copied into the destination.
  • if source and destination have different size in memory or different channels and the destination is the owner of data, the procedure will overwrite the destination Image creating a new Image (channels and dimensions will be the same of the source Image, pixels type (DataType) will be the same of the destination Image if they are not none or the same of the source otherwise).
  • if source and destination have different size in memory or different channels and the destination is not the owner of data, the procedure will throw an exception.
  • if source and destination have different color types and the destination is the owner of data, the procedure produces a destination Image with the same color type of the source.
  • if source and destination have different color types and the destination is not the owner of data, the procedure will throw an exception.
  • if source and destination are the same Image, there are two options. If new_type is the same of the two Image(s) or it is DataType::none, nothing happens. Otherwise, an exception is thrown. When the DataType is specified the function will have the same behavior, but the destination Image will have the specified DataType.
Parameters
[in]srcSource Image to be copied into destination Image.
[out]dstDestination Image that will hold a copy of the source Image. Cannot be the source Image.
[in]new_typeDesired type for the destination Image after the copy. If none (default) the destination Image will preserve its type if it is not empty, otherwise it will have the same type of the source Image.

Examples
example_image_view.cpp.

◆ CopyImage() [2/2]

void ecvl::CopyImage ( const Image src,
Image dst,
DataType  new_type,
const std::string &  channels 
)

Same as CopyImage(), with the chance to specify the channels order of the output Image.

Parameters
[in]srcSource Image to be copied into destination Image.
[out]dstDestination Image that will hold a copy of the source Image. Cannot be the source Image.
[in]new_typeDesired type for the destination Image after the copy. If none (default) the destination Image will preserve its type if it is not empty, otherwise it will have the same type of the source Image.
[in]channelsDesired order of Image channels.

◆ DataTypeArray()

constexpr std::array<DataType, DataTypeSize()> ecvl::DataTypeArray ( )

Function to get a std::array with all the DataType values at compile time.

Returns
A std::array with all the DataType values.

Definition at line 100 of file datatype.h.

◆ DataTypeSignedArray()

constexpr std::array<DataType, DataTypeSignedSize()> ecvl::DataTypeSignedArray ( )

Function to get a std::array with all the signed DataType values at compile time.

Returns
A std::array with all the signed DataType values.

Definition at line 115 of file datatype.h.

◆ DataTypeSignedSize()

constexpr size_t ecvl::DataTypeSignedSize ( )

Function to get the number of existing signed DataType at compile time.

Returns
The number of existing signed DataType.

Definition at line 86 of file datatype.h.

◆ DataTypeSize() [1/2]

uint8_t ecvl::DataTypeSize ( DataType  dt)

Provides the size in bytes of a given DataType.

Given one of the DataType, the function returns its size in bytes.

Parameters
[in]dtA DataType.
Returns
The DataType size in bytes

◆ DataTypeSize() [2/2]

constexpr size_t ecvl::DataTypeSize ( )

Function to get the number of existing DataType at compile time.

Returns
The number of existing DataType.

Definition at line 73 of file datatype.h.

◆ DicomRead()

bool ecvl::DicomRead ( const ecvl::filesystem::path &  filename,
Image dst 
)

Loads an image from a DICOM file.

Loads an image from the specified DICOM file. If the image cannot be read for any reason, the function creates an empty Image and returns false.

Parameters
[in]filenameA filesystem::path identifying the file name.
[out]dstImage in which data will be stored.
Returns
true if the image is correctly read, false otherwise.
Examples
example_nifti_dicom.cpp.

◆ DicomWrite()

bool ecvl::DicomWrite ( const ecvl::filesystem::path &  filename,
const Image src 
)

Saves an image into a specified DICOM file.

The function DicomWrite saves the input image into a specified file, with the DICOM format.

Parameters
[in]filenameA filesystem::path identifying the output file name.
[in]srcImage to be saved.
Returns
true if the image is correctly written, false otherwise.
Examples
example_nifti_dicom.cpp.

◆ Div() [1/3]

void ecvl::Div ( const Image src1,
const Image src2,
Image dst,
DataType  dst_type = DataType::none,
bool  saturate = true 
)
inline
Examples
example_image_view.cpp.

Definition at line 126 of file arithmetic.h.

◆ Div() [2/3]

template<typename ST2 >
void ecvl::Div ( const Image src1,
const ST2 &  src2,
Image dst,
DataType  dst_type = DataType::none,
bool  saturate = true 
)

Definition at line 127 of file arithmetic.h.

◆ Div() [3/3]

template<typename ST1 >
void ecvl::Div ( const ST1 &  src1,
const Image src2,
Image dst,
DataType  dst_type = DataType::none,
bool  saturate = true 
)

Definition at line 128 of file arithmetic.h.

◆ DrawEllipse()

void ecvl::DrawEllipse ( Image src,
ecvl::Point2i  center,
ecvl::Size2i  axes,
double  angle,
const ecvl::Scalar color,
int  thickness = 1 
)

Draw an ellipse over the specified Image.

Parameters
[in,out]srcImage on which draw the ellipse.
[in]centerCenter of the ellipse to be drawn.
[in]axesHalf of the size of the ellipse axes.
[in]angleEllipse rotation angle. It must be in degrees.
[in]colorEllipse color. It can be either a number (e.g. {255}) or an RGB value (e.g. {40, 40, 40})
[in]thicknessThickness of the ellipse border. If negative all the pixell of the ellipse will be filled with the specified color value. Default is 1.
Examples
example_moments.cpp.

◆ DropColorChannel()

void ecvl::DropColorChannel ( Image src)

Remove color channel from the input Image.

The DropColorChannel() procedure remove the color channel ("c") from the specified input Image, modifying all the other attribute accordingly. This function can be only applied on Images with ColorType::GRAY, i.e. images having the color channel dimension equal to 1.

Parameters
[in,out]srcImage from which to drop the color channel.

◆ ElasticTransform()

void ecvl::ElasticTransform ( const Image src,
Image dst,
double  alpha = 34.,
double  sigma = 4.,
InterpolationType  interp = InterpolationType::linear,
BorderType  border_type = BorderType::BORDER_REFLECT_101,
const int &  border_value = 0,
const unsigned  seed = std::default_random_engine::default_seed 
)

Elastic deformation of input Image. Based on https://github.com/albumentations-team/albumentations/blob/master/albumentations/augmentations/transforms.py#L1235.

Parameters
[in]srcInput Image.
[out]dstOutput Image.
[in]alphaScaling factor that controls the intensity of the deformation.
[in]sigmaGaussian kernel standard deviation
[in]interpInterpolation type used. If src is DataType::int8 or DataType::int32, Interpolation::nearest is used. Default is InterpolationType::linear.
[in]border_typeFlag used to specify the pixel extrapolation method. Default is BorderType::BORDER_REFLECT_101.
[in]border_valuePadding value if border_type is BorderType::BORDER_CONSTANT.
[in]seedSeed to use for this function's random number generator.
Examples
example_imgproc.cpp.

◆ Filter2D()

void ecvl::Filter2D ( const Image src,
Image dst,
const Image ker,
DataType  type = DataType::none 
)

Convolves an Image with a kernel.

Parameters
[in]srcInput Image.
[out]dstOutput Image.
[in]kerConvolution kernel.
[in]typeDestination ecvl::DataType. If DataType::none, the same of src is used.
Examples
example_imgproc.cpp.

◆ FindContours()

void ecvl::FindContours ( const Image src,
std::vector< std::vector< Point2i >> &  contours 
)

Finds contours in a binary image.

Parameters
[in]srcInput Image. It must be with channels "xyc", only one color channel and DataType::uint8.
[out]contoursOutput contours.
Examples
example_imgproc.cpp.

◆ Flip2D()

void ecvl::Flip2D ( const ecvl::Image src,
ecvl::Image dst 
)

Flips an Image.

The Flip2D procedure vertically flips an Image.

Parameters
[in]srcThe input Image.
[out]dstThe output flipped Image.
Examples
example_imgproc.cpp.

◆ GammaContrast()

void ecvl::GammaContrast ( const Image src,
Image dst,
double  gamma 
)

Adjust contrast by scaling each pixel value X to 255 * ((X/255) ** gamma).

Parameters
[in]srcInput Image.
[out]dstOutput Image.
[in]gammaExponent for the contrast adjustment.
Examples
example_imgproc.cpp, and example_nifti_dicom.cpp.

◆ GaussianBlur() [1/2]

void ecvl::GaussianBlur ( const Image src,
Image dst,
int  sizeX,
int  sizeY,
double  sigmaX,
double  sigmaY = 0 
)

Blurs an Image using a Gaussian kernel.

Parameters
[in]srcInput Image.
[out]dstOutput Image.
[in]sizeXHorizontal size of the kernel. Must be positive and odd.
[in]sizeYVertical size of the kernel. Must be positive and odd.
[in]sigmaXGaussian kernel standard deviation in X direction.
[in]sigmaYGaussian kernel standard deviation in Y direction. If zero, sigmaX is used. If both are zero, they are calculated from sizeX and sizeY.
Examples
example_imgproc.cpp.

◆ GaussianBlur() [2/2]

void ecvl::GaussianBlur ( const Image src,
Image dst,
double  sigma 
)

◆ GetMaxN()

std::vector<ecvl::Point2i> ecvl::GetMaxN ( const Image src,
size_t  n 
)

Get the n maximum values that are in the source Image.

Parameters
[in]srcInput Image. It must be with ColorType::GRAY, "xyc" and DataType::int32.
[in]nHow many values must be returned.
Returns
vector of Point2i containing the coordinates of the n max values of the Image.

◆ GetOpenCVInterpolation()

int ecvl::GetOpenCVInterpolation ( InterpolationType  interp)

Given an InterpolationType, the GetOpenCVInterpolation function returns the associated OpenCV enum value.

Parameters
[in]interpInterpolation type, see InterpolationType.
Returns
Associated OpenCV enum value.

◆ GridDistortion()

void ecvl::GridDistortion ( const Image src,
Image dst,
int  num_steps = 5,
const std::array< float, 2 > &  distort_limit = { -0.3f, 0.3f },
InterpolationType  interp = InterpolationType::linear,
BorderType  border_type = BorderType::BORDER_REFLECT_101,
const int &  border_value = 0,
const unsigned  seed = std::default_random_engine::default_seed 
)

Randomly stretch or reduce each cell of the grid in which the input Image is divided into. Based on https://github.com/albumentations-team/albumentations/blob/master/albumentations/augmentations/transforms.py#L1175.

Parameters
[in]srcInput Image.
[out]dstOutput Image.
[in]num_stepsCount of grid cells on each side.
[in]distort_limitRange of distortion steps.
[in]interpInterpolation type used. Default is InterpolationType::linear.
[in]border_typeFlag used to specify the pixel extrapolation method. Default is BorderType::BORDER_REFLECT_101.
[in]border_valuePadding value if border_type is BorderType::BORDER_CONSTANT.
[in]seedSeed to use for this function's random number generator.
Examples
example_imgproc.cpp.

◆ HConcat()

void ecvl::HConcat ( const std::vector< Image > &  src,
Image dst 
)

Horizontal concatenation of images (with the same number of rows)

Parameters
[in]srcvector of input Images.
[out]dstOutput Image.
Examples
example_imgproc.cpp.

◆ ImageToMat()

cv::Mat ecvl::ImageToMat ( const Image img)

Convert an ECVL Image into OpenCV Mat.

Parameters
[in]imgInput ECVL Image.
Returns
Output OpenCV Mat.

◆ ImageToTensor() [1/2]

void ecvl::ImageToTensor ( const Image img,
Tensor *&  t 
)

Convert an ECVL Image into an EDDL Tensor.

Image must have 3 dimensions "xy[czo]" (in any order).
Output Tensor will be created with shape \(C\) x \(H\) x \(W\).

Parameters
[in]imgInput ECVL Image.
[out]tOutput EDDL Tensor. It is created inside the function.
Examples
example_ecvl_eddl.cpp.

◆ ImageToTensor() [2/2]

void ecvl::ImageToTensor ( const Image img,
Tensor *&  t,
const int &  offset 
)

Insert an ECVL Image into an EDDL Tensor.

This function is useful to insert into an EDDL Tensor more than one image, specifying how many images are already stored in the Tensor. Image must have 3 dimensions "xy[czo]" (in any order).

Parameters
[in]imgInput ECVL Image.
[out]tOutput EDDL Tensor. It must be created with the right dimensions before calling this function.
[in]offsetHow many images are already stored in the Tensor.

◆ ImgFromWx()

Image ecvl::ImgFromWx ( const wxImage &  wx)

Convert a wxImage into an ECVL Image.

Parameters
[in]wxInput wxImage.
Returns
ECVL Image.
Examples
example_ecvl_gui.cpp.

◆ ImRead()

bool ecvl::ImRead ( const ecvl::filesystem::path &  filename,
Image dst,
ImReadMode  flags = ImReadMode::ANYCOLOR 
)

Loads an image from a file.

The function ImRead loads an image from the specified file (jpg, png, dicom or nifti). If the image cannot be read for any reason, the function creates an empty Image and returns false.

Parameters
[in]filenameA std::filesystem::path identifying the file name.
[out]dstImage in which data will be stored.
[in]flagsAn ImReadMode indicating how to read the image.
Returns
true if the image is correctly read, false otherwise.
Examples
example_core_iterators.cpp, example_ecvl_eddl.cpp, example_ecvl_gui.cpp, example_image_view.cpp, example_imgcodecs.cpp, example_imgproc.cpp, example_moments.cpp, example_nifti_dicom.cpp, and example_threshold.cpp.

◆ ImReadMulti()

bool ecvl::ImReadMulti ( const ecvl::filesystem::path &  filename,
Image dst 
)

Loads a multi-page image from a file.

The function ImReadMulti loads a multi-page image from the specified file. If the image cannot be read for any reason, the function creates an empty Image and returns false.

Parameters
[in]filenameA std::string identifying the file name.
[out]dstImage in which data will be stored.
Returns
true if the image is correctly read, false otherwise.

◆ ImShow()

void ecvl::ImShow ( const Image img)

Displays an Image.

The ImShow function instantiates a ShowApp and starts it with a wxEntry() call. The image is shown with its original size.

Parameters
[in]imgImage to be shown.
Examples
example_ecvl_gui.cpp.

◆ ImWrite()

bool ecvl::ImWrite ( const ecvl::filesystem::path &  filename,
const Image src 
)

Saves an image into a specified file.

The function ImWrite saves the input image into a specified file. The image format is chosen based on the filename extension. The following sample shows how to create a BGR image and save it to the PNG file "test.png":

/*
* ECVL - European Computer Vision Library
* Version: 0.3.4
* copyright (c) 2021, Università degli Studi di Modena e Reggio Emilia (UNIMORE), AImageLab
* Authors:
* Costantino Grana (costantino.grana@unimore.it)
* Federico Bolelli (federico.bolelli@unimore.it)
* Michele Cancilla (michele.cancilla@unimore.it)
* Laura Canalini (laura.canalini@unimore.it)
* Stefano Allegretti (stefano.allegretti@unimore.it)
* All rights reserved.
*/
#include "ecvl/core.h"
#include <iostream>
using namespace ecvl;
using namespace std;
int main()
{
// Create BGR Image
Image img({ 500, 500, 3 }, DataType::uint8, "xyc", ColorType::BGR);
// Populate Image with pseudo-random data
for (int r = 0; r < img.dims_[1]; ++r) {
for (int c = 0; c < img.dims_[0]; ++c) {
*img.Ptr({ c, r, 0 }) = 255;
*img.Ptr({ c, r, 1 }) = (r / 2) % 255;
*img.Ptr({ c, r, 2 }) = (r / 2) % 255;
}
}
ImWrite("example_imgcodecs.png", img);
if (!ImRead("example_imgcodecs.png", img)) {
return EXIT_FAILURE;
}
cout << "Successfully read a color image" << endl;
if (!ImRead("example_imgcodecs.png", img, ImReadMode::GRAYSCALE)) {
return EXIT_FAILURE;
}
cout << "Successfully read a grayscale image" << endl;
return EXIT_SUCCESS;
}

Parameters
[in]filenameA std::filesystem::path identifying the output file name.
[in]srcImage to be saved.
Returns
true if the image is correctly written, false otherwise.
Examples
example_core_iterators.cpp, example_ecvl_gui.cpp, example_image_view.cpp, example_imgcodecs.cpp, example_imgproc.cpp, and example_openslide.cpp.

◆ Inpaint()

void ecvl::Inpaint ( const Image src,
Image dst,
const Image inpaintMask,
double  inpaintRadius,
InpaintType  flag = InpaintType::INPAINT_TELEA 
)

Restores the selected region in an image using the region neighborhood.

Parameters
[in]srcInput Image.
[out]dstOutput Image.
[in]inpaintMaskInpainting mask, an Image with 1-channel and DataType::uint8. Non-zero pixels indicate the area that needs to be inpainted.
[in]inpaintRadiusRadius of a circular neighborhood of each point inpainted that is considered by the algorithm.
[in]flagInpainting method that could be InpaintType::INPAINT_NS or InpaintType::INPAINT_TELEA.

◆ IntegralImage()

void ecvl::IntegralImage ( const Image src,
Image dst,
DataType  dst_type = DataType::float64 
)

Calculate the integral image of the source Image.

Parameters
[in]srcInput Image. It must be with ColorType::GRAY, "xyc" and DataType::uint8.
[out]dstOutput Image.
[in]dst_typeDataType of the destination Image.

◆ MatToImage()

ecvl::Image ecvl::MatToImage ( const cv::Mat &  m,
ColorType  ctype = ColorType::none 
)

Convert a cv::Mat into an ecvl::Image.

Parameters
[in]mInput OpenCV Mat.
[in]ctypeInput ColorType of the returned ecvl::Image. If not provided the ColorType is guessed from OpenCV Mat.
Returns
ECVL image.

◆ MatVecToImage()

ecvl::Image ecvl::MatVecToImage ( const std::vector< cv::Mat > &  v)

Convert a std::vector<cv::Mat> into an ecvl::Image.

Parameters
[in]vInput std::vector of OpenCV Mat.
Returns
ECVL image.

◆ MeanStdDev()

void ecvl::MeanStdDev ( const Image src,
std::vector< double > &  mean,
std::vector< double > &  stddev 
)

Calculates the mean and the standard deviation of an Image.

Parameters
[in]srcInput Image.
[out]meanMean of the Image pixels.
[out]stddevStandard deviation of the Image pixels.

◆ Mirror2D()

void ecvl::Mirror2D ( const ecvl::Image src,
ecvl::Image dst 
)

Mirrors an Image.

The Mirror2D procedure horizontally flips an Image.

Parameters
[in]srcThe input Image.
[out]dstThe output mirrored Image.
Examples
example_imgproc.cpp, and example_nifti_dicom.cpp.

◆ Moments()

void ecvl::Moments ( const Image src,
Image moments,
int  order = 3,
DataType  type = DataType::float64 
)

Calculate all raw image moments of the source Image up to the specified order.

When working with a 2D image, naming the pixel intensities as \(I(x,y)\), raw image moments \(M_{ij}\) are calculated with the following formula:

\( M_{ij} = \sum_x{\sum_y{x^iy^jI(x,y)}} \)

The following properties can be derived from raw image moments:

  • Area (for binary images) or sum of grey level (for grayscale images): \(M_{00} \), accessible through moments(0,0) i.e. moments(x,y);
  • Centroid: \(\{\bar{x}, \bar{y}\} = \{\frac{M_{10}}{M_{00}}, \frac{M_{01}}{M_{00}}\}\).

The formula above can be accordingly extended when working with higher dimensions. Note that raw moments are neither translation, scale nor rotation invariant. Moments are stored in the output moments Image in the same order as for source channels. The output moments Image will be on the same device of the source Image.

Parameters
[in]srcInput Image on which calculating row moments up to the specified order. It must be a grayscale (ColorType::GRAY) or a data (ColorType::none) Image.
[out]momentsOutput data (ColorType:none) Image containing the computed raw image moments. The moments DataType is specified by the type parameter. The size of the Image will be (order + 1, order + 1)
[in]orderRaw image moments will be calculated up to the specified order. Default is 3.
[in]typeSpecify the ecvl::DataType to be used for the moments Image. It could be either DataType::float32 or DataType::float64. Default is DataType::float64.
Examples
example_moments.cpp.

◆ Morphology()

void ecvl::Morphology ( const Image src,
Image dst,
MorphType  op,
Image kernel,
Point2i  anchor = { -1, -1 },
int  iterations = 1,
BorderType  border_type = BorderType::BORDER_CONSTANT,
const int &  border_value = 0 
)

Performs advanced morphological transformations using an erosion and dilation as basic operations.

Parameters
[in]srcInput Image.
[out]dstOutput Image.
[in]opType of a morphological operation, see MorphType.
[in]kernelStructuring element.
[in]anchorAnchor position with the kernel. Negative values mean that the anchor is at the kernel center.
[in]iterationsNumber of times erosion and dilation are applied.
[in]border_typePixel extrapolation method, see BorderType. BorderType::BORDER_WRAP is not supported.
[in]border_valueBorder value in case of a constant border.

◆ Mul() [1/3]

void ecvl::Mul ( const Image src1,
const Image src2,
Image dst,
DataType  dst_type = DataType::none,
bool  saturate = true 
)
inline
Examples
example_image_view.cpp.

Definition at line 122 of file arithmetic.h.

◆ Mul() [2/3]

template<typename ST2 >
void ecvl::Mul ( const Image src1,
const ST2 &  src2,
Image dst,
DataType  dst_type = DataType::none,
bool  saturate = true 
)

Definition at line 123 of file arithmetic.h.

◆ Mul() [3/3]

template<typename ST1 >
void ecvl::Mul ( const ST1 &  src1,
const Image src2,
Image dst,
DataType  dst_type = DataType::none,
bool  saturate = true 
)

Definition at line 124 of file arithmetic.h.

◆ MultiThreshold()

void ecvl::MultiThreshold ( const Image src,
Image dst,
const std::vector< int > &  thresholds,
int  minval = 0,
int  maxval = 255 
)

Applies multiple thresholds to the input Image.

The Threshold() function applies multiple thresholding to the input Image. The resulting Image is quantized based on the provided thresholds values. Output values will range uniformly from minval to maxval.

Parameters
[in]srcInput Image on which to apply the threshold.
[out]dstThe output thresholded Image.
[in]thresholdsThreshold values.
[in]minvalThe minimum value in the output Image. Default is 0.
[in]maxvalThe maximum value in the output Image. Default is 255.
Examples
example_threshold.cpp.

◆ Neg()

void ecvl::Neg ( const Image src,
Image dst,
DataType  dst_type = DataType::none,
bool  saturate = true 
)
inline

Negation of an Image.

The Neg() function negates every value of an Image, and stores the the result in a destination Image with the specified type.

Parameters
[in]srcImage to be negated.
[out]dstDestination Image. It will store the final result.
[in]dst_typeDesired type for the destination Image. If none (default) the destination Image will preserve its own type, if any, or it will inherit the DataType of src otherwise.
[in]saturateWhether to apply saturation or not. Default is true.
Returns

Definition at line 146 of file arithmetic.h.

◆ NiftiRead()

bool ecvl::NiftiRead ( const ecvl::filesystem::path &  filename,
Image dst 
)

Loads a nifti image from a file.

The function NiftiRead loads an image from the specified nifti file. If the image cannot be read for any reason, the function creates an empty Image and returns false.

Parameters
[in]filenameA std::filesystem::path identifying the file name.
[out]dstImage in which data will be stored.
Returns
true if the image is correctly read, false otherwise.
Examples
example_ecvl_gui.cpp, and example_nifti_dicom.cpp.

◆ NiftiWrite()

bool ecvl::NiftiWrite ( const ecvl::filesystem::path &  filename,
const Image src 
)

Saves an image into a specified nifti file.

The function NiftiWrite saves the input image into a specified file, with the NIfTI-1 format.

Parameters
[in]filenameA std::filesystem::path identifying the output file name.
[in]srcImage to be saved.
Returns
true if the image is correctly written, false otherwise.
Examples
example_nifti_dicom.cpp.

◆ NonMaximaSuppression()

void ecvl::NonMaximaSuppression ( const Image src,
Image dst 
)

Calculate the Non-Maxima suppression of the source Image.

Parameters
[in]srcInput Image. It must be with ColorType::GRAY, "xyc" and DataType::int32.
[out]dstOutput Image.

◆ Normalize() [1/2]

void ecvl::Normalize ( const Image src,
Image dst,
const double &  mean,
const double &  std 
)

Normalize Image image with mean and standard deviation.

The Normalize creates an Image in which each pixel of the Image is subtracted by mean and divide by std. Useful to normalize a dataset, in fact normalization helps to get the data within a range and which helps in making training of neural networks a lot faster.

Parameters
[in]srcImage to normalize.
[out]dstOutput normalized Image.
[in]meanMean to use for normalization.
[in]stdStandard deviation to use for normalization.

◆ Normalize() [2/2]

void ecvl::Normalize ( const Image src,
Image dst,
const std::vector< double > &  mean,
const std::vector< double > &  std 
)

Normalize xyc Image image with separate mean and standard deviation for each color channel.

The Normalize creates an Image in which each pixel of the input xyc Image is subtracted by the mean and divide by the std for its channel. Useful to normalize a dataset, in fact normalization helps to get the data within a range and which helps in making training of neural networks a lot faster.

Parameters
[in]srcImage to normalize.
[out]dstOutput normalized Image.
[in]meanVector of means to use for normalization.
[in]stdVector of standard deviations to use for normalization.

◆ OpenSlideGetLevels()

bool ecvl::OpenSlideGetLevels ( const ecvl::filesystem::path &  filename,
std::vector< std::array< int, 2 >> &  levels 
)

Get width and height for each level of a whole-slide image.

Parameters
[in]filenameA filesystem::path identifying the file name.
[out]levelsA std::vector of array containing two elements, width and height respectively. levels[k] are the dimensions of level k.
Returns
true if the image is correctly read, false otherwise.
Examples
example_openslide.cpp.

◆ OpenSlideRead()

bool ecvl::OpenSlideRead ( const ecvl::filesystem::path &  filename,
Image dst,
const int  level,
const std::vector< int > &  dims 
)

Loads a region of a whole-slide image file.

Loads a region from the specified whole-slide image file. Supported formats are those supported by OpenSlide library. If the region cannot be read for any reason, the function creates an empty Image and returns false.

Parameters
[in]filenameA filesystem::path identifying the file name.
[out]dstImage in which data will be stored.
[in]levelImage level to be extracted.
[in]dimsstd::vector containing { x, y, w, h }. x and y are the top left x-coordinate and y-coordinate, in the level 0 reference frame. w and h are the width and height of the region.
Returns
true if the image is correctly read, false otherwise.
Examples
example_openslide.cpp.

◆ operator+()

constexpr unsigned ecvl::operator+ ( SplitType const  val)
inline

Definition at line 38 of file dataset_parser.h.

◆ OpticalDistortion()

void ecvl::OpticalDistortion ( const Image src,
Image dst,
const std::array< float, 2 > &  distort_limit = { -0.3f, 0.3f },
const std::array< float, 2 > &  shift_limit = { -0.1f, 0.1f },
InterpolationType  interp = InterpolationType::linear,
BorderType  border_type = BorderType::BORDER_REFLECT_101,
const int &  border_value = 0,
const unsigned  seed = std::default_random_engine::default_seed 
)

Barrel / pincushion distortion. Based on https://github.com/albumentations-team/albumentations/blob/master/albumentations/augmentations/transforms.py#L1114.

Parameters
[in]srcInput Image.
[out]dstOutput Image.
[in]distort_limitRange to randomly select the intensity of the distortion.
[in]shift_limitRange of image shifting.
[in]interpInterpolation type used. Default is InterpolationType::linear.
[in]border_typeFlag used to specify the pixel extrapolation method. Default is BorderType::BORDER_REFLECT_101.
[in]border_valuePadding value if border_type is BorderType::BORDER_CONSTANT.
[in]seedSeed to use for this function's random number generator.
Examples
example_imgproc.cpp.

◆ OtsuMultiThreshold()

std::vector<int> ecvl::OtsuMultiThreshold ( const Image src,
int  n_thresholds = 2 
)

Calculates the Otsu thresholding values.

The OtsuThreshold() function calculates the Otsu threshold values over a given input Image. The source Image must be of ColorType::GRAY. The number of thresholds to be found is defined by the n_thresholds parameter (default is 2). This function implement the algorithm described in [2].

Parameters
[in]srcInput Image on which to calculate the Otsu threshold value.
[in]n_thresholdsNumber of thresholds to be found using the Otsu multi threshold algorithm variation.
Returns
Otsu thresholds value in a vector of ints.
Examples
example_threshold.cpp.

◆ OtsuThreshold()

int ecvl::OtsuThreshold ( const Image src)

Calculates the Otsu thresholding value.

The OtsuThreshold() function calculates the Otsu threshold value over a given input Image. The Image must be of ColorType::GRAY. This function implements the algorithm described in [3].

Parameters
[in]srcInput Image on which to calculate the Otsu threshold value.
Returns
Otsu threshold value.
Examples
example_imgproc.cpp, example_nifti_dicom.cpp, and example_threshold.cpp.

◆ Pepper()

void ecvl::Pepper ( const Image src,
Image dst,
double  p,
bool  per_channel = false,
const unsigned  seed = std::default_random_engine::default_seed 
)

Adds pepper noise (black pixels) to an Image.

Parameters
[in]srcInput Image.
[out]dstOutput Image.
[in]pProbability of replacing a pixel with pepper noise.
[in]per_channelIf true, noise is not considered pixel-wise but channel-wise.
[in]seedSeed to use for this function's random number generator.
Examples
example_imgproc.cpp.

◆ PromoteAdd()

template<typename T , typename U >
promote_superior_type_t<T, U> ecvl::PromoteAdd ( lhs,
rhs 
)

Definition at line 73 of file type_promotion.h.

◆ PromoteDiv()

template<typename T , typename U >
promote_superior_type_t<T, U> ecvl::PromoteDiv ( lhs,
rhs 
)

Definition at line 76 of file type_promotion.h.

◆ PromoteMul()

template<typename T , typename U >
promote_superior_type_t<T, U> ecvl::PromoteMul ( lhs,
rhs 
)

Definition at line 75 of file type_promotion.h.

◆ PromoteSub()

template<typename T , typename U >
promote_superior_type_t<T, U> ecvl::PromoteSub ( lhs,
rhs 
)

Definition at line 74 of file type_promotion.h.

◆ RearrangeChannels() [1/2]

void ecvl::RearrangeChannels ( const Image src,
Image dst,
const std::string &  channels 
)

Changes the order of the Image dimensions.

The RearrangeChannels procedure changes the order of the input Image dimensions saving the result into the output Image. The new order of dimensions can be specified as a string through the "channels" parameter. Input and output Images can be the same. The number of channels of the input Image must be the same of required channels.

Parameters
[in]srcInput Image on which to rearrange dimensions.
[out]dstThe output rearranged Image. Can be the src Image.
[in]channelsDesired order of Image channels.

Examples
example_image_view.cpp.

◆ RearrangeChannels() [2/2]

void ecvl::RearrangeChannels ( const Image src,
Image dst,
const std::string &  channels,
DataType  new_type 
)

Same as RearrangeChannels(), with the chance to specify the DataType of the output Image.

Parameters
[in]srcInput Image on which to rearrange dimensions.
[out]dstThe output rearranged Image. Can be the src Image.
[in]channelsDesired order of Image channels.
[in]new_typeDesired type for the destination Image after the copy. If none the destination Image will preserve its type if it is not empty, otherwise it will have the same type of the source Image.

◆ ResizeDim()

void ecvl::ResizeDim ( const ecvl::Image src,
ecvl::Image dst,
const std::vector< int > &  newdims,
InterpolationType  interp = InterpolationType::linear 
)

Resizes an Image to the specified dimensions.

The function resizes Image src and outputs the result in dst.

Parameters
[in]srcThe input Image.
[out]dstThe output resized Image.
[in]newdimsstd::vector<int> that specifies the new size of each dimension. The vector size must match the src Image dimensions, excluding the color channel.
[in]interpInterpolationType to be used. Default is InterpolationType::linear.
Examples
example_imgproc.cpp.

◆ ResizeScale()

void ecvl::ResizeScale ( const ecvl::Image src,
ecvl::Image dst,
const std::vector< double > &  scales,
InterpolationType  interp = InterpolationType::linear 
)

Resizes an Image by scaling the dimensions to a given scale factor.

The function resizes Image src and outputs the result in dst.

Parameters
[in]srcThe input Image.
[out]dstThe output rescaled Image.
[in]scalesstd::vector<double> that specifies the scale to apply to each dimension. The vector size must match the src Image dimensions, excluding the color channel.
[in]interpInterpolationType to be used. Default is InterpolationType::linear.
Examples
example_imgproc.cpp.

◆ Rotate2D()

void ecvl::Rotate2D ( const ecvl::Image src,
ecvl::Image dst,
double  angle,
const std::vector< double > &  center = {},
double  scale = 1.0,
InterpolationType  interp = InterpolationType::linear 
)

Rotates an Image.

The Rotate2D procedure rotates an Image of a given angle (expressed in degrees) in a clockwise manner, with respect to a given center. The value of unknown pixels in the output Image are set to 0. The output Image is guaranteed to have the same dimensions as the input one. An optional scale parameter can be provided: this won't change the output Image size, but the image is scaled during rotation. Different interpolation types are available, see InterpolationType.

Parameters
[in]srcThe input Image.
[out]dstThe output rotated Image.
[in]angleThe rotation angle in degrees.
[in]centerA std::vector<double> representing the coordinates of the rotation center. If empty, the center of the image is used.
[in]scaleOptional scaling factor.
[in]interpInterpolation type used. Default is InterpolationType::linear.
Examples
example_imgproc.cpp.

◆ RotateFullImage2D()

void ecvl::RotateFullImage2D ( const ecvl::Image src,
ecvl::Image dst,
double  angle,
double  scale = 1.0,
InterpolationType  interp = InterpolationType::linear 
)

Rotates an Image resizing the output accordingly.

The RotateFullImage2D procedure rotates an Image of a given angle (expressed in degrees) in a clockwise manner. The value of unknown pixels in the output Image are set to 0. The output Image is guaranteed to contain all the pixels of the rotated image. Thus, its dimensions can be different from those of the input. An optional scale parameter can be provided. Different interpolation types are available, see InterpolationType.

Parameters
[in]srcThe input Image.
[out]dstThe rotated output Image.
[in]angleThe rotation angle in degrees.
[in]scaleOptional scaling factor.
[in]interpInterpolation type used. Default is InterpolationType::linear.
Examples
example_imgproc.cpp.

◆ Salt()

void ecvl::Salt ( const Image src,
Image dst,
double  p,
bool  per_channel = false,
const unsigned  seed = std::default_random_engine::default_seed 
)

Adds salt noise (white pixels) to an Image.

Parameters
[in]srcInput Image.
[out]dstOutput Image.
[in]pProbability of replacing a pixel with salt noise.
[in]per_channelIf true, noise is not considered pixel-wise but channel-wise.
[in]seedSeed to use for this function's random number generator.
Examples
example_imgproc.cpp.

◆ SaltAndPepper()

void ecvl::SaltAndPepper ( const Image src,
Image dst,
double  p,
bool  per_channel = false,
const unsigned  seed = std::default_random_engine::default_seed 
)

Adds salt and pepper noise (white and black pixels) to an Image. White and black pixels are equally likely.

Parameters
[in]srcInput Image.
[out]dstOutput Image.
[in]pProbability of replacing a pixel with salt and pepper noise.
[in]per_channelIf true, noise is not considered pixel-wise but channel-wise.
[in]seedSeed to use for this function's random number generator.
Examples
example_imgproc.cpp.

◆ saturate_cast() [1/2]

template<DataType ODT, typename IDT >
TypeInfo<ODT>::basetype ecvl::saturate_cast ( IDT  v)

Saturate a value (of any type) to the specified type.

Given an input of any type the saturate_cast function provide an output return value of the specified type applying saturation. When the input value in greater than the maximum possible value (max) for the output type, the max value is returned. When the input value in lower than the minimum possible value (min) for the output type, the min value is returned.

Parameters
[in]vInput value (of any type).
Returns
Input value after cast and saturation.

Definition at line 36 of file saturate_cast.h.

◆ saturate_cast() [2/2]

template<typename ODT , typename IDT >
ODT ecvl::saturate_cast ( const IDT &  v)

Saturate a value (of any type) to the specified type.

Given an input of any type the saturate_cast function provide an output return value of the specified type applying saturation. When the input value in greater than the maximum possible value (max) for the output type, the max value is returned. When the input value in lower than the minimum possible value (min) for the output type, the min value is returned.

Parameters
[in]vInput value (of any type).
Returns
Input value after cast and saturation.

Definition at line 64 of file saturate_cast.h.

◆ ScaleTo()

void ecvl::ScaleTo ( const Image src,
Image dst,
const double &  new_min,
const double &  new_max 
)

Linearly scale an Image into a new range.

The function linearly rescale the Image having values in [min,max] into a new arbitrary range [new_min,new_max].

Parameters
[in]srcThe input Image.
[out]dstThe output resized Image.
[in]new_mindouble which indicates the new minimum value.
[in]new_maxdouble which indicates the new maximum value.

◆ SeparableFilter2D()

void ecvl::SeparableFilter2D ( const Image src,
Image dst,
const std::vector< double > &  kerX,
const std::vector< double > &  kerY,
DataType  type = DataType::none 
)

Convolves an Image with a couple of 1-dimensional kernels.

Parameters
[in]srcInput Image.
[out]dstOutput Image.
[in]kerXConvolution kernel for the X-axis.
[in]kerYConvolution kernel for the Y-axis.
[in]typeDestination ecvl::DataType. If DataType::none, the same of src is used.
Examples
example_imgproc.cpp.

◆ ShallowCopyImage()

void ecvl::ShallowCopyImage ( const Image src,
Image dst 
)

Performs a shallow copy of the source Image into the destination.

The ShallowCopyImage() procedure takes an Image and copies the fields values into destination Image. This means that source and destination Image(s) will point to the same Image data in memory. The data ownership of the source Image will be preserved, i.e. the result of the IsOwner() method on the source Image will be the same before and after the execution of the ShallowCopyImage(). Destination Image will never be the owner of the data. Source and destination Image(s) cannot be the same.

Parameters
[in]srcSource Image to be shallow copied into destination Image.
[out]dstDestination Image that will hold a copy of the source Image field value. Cannot be the source Image.

◆ SliceTimingCorrection()

void ecvl::SliceTimingCorrection ( const Image src,
Image dst,
bool  odd = false,
bool  down = false 
)

Corrects each voxel's time-series. Slice timing correction works by using (Hanning-windowed) sinc interpolation to shift each time-series by an appropriate fraction of a TR relative to the middle of the TR period. The default slice order acquisition is from the bottom of the brain to the top.

Parameters
[in]srcInput Image. It must be with channels "xyzt" and with spacings (distance between consecutive voxels on each dimensions).
[out]dstOutput Image. It will be with DataType::float32.
[in]oddSlices were acquired with interleaved order (0, 2, 4... 1, 3, 5...)
[in]downSlices were acquired from the top of the brain to the bottom

◆ SqDist()

double ecvl::SqDist ( const Point2i a,
const Point2i b 
)

Calculate the distance squared between two ecvl::Point2i.

Parameters
[in]aFirst point integer coordinates.
[in]bSecond point integer coordinates.

◆ Stack()

void ecvl::Stack ( const std::vector< Image > &  src,
Image dst 
)

Stack a sequence of Images along the depth dimension (images width and height must match)

Parameters
[in]srcvector of input Images. It must be with channels "xyc".
[out]dstOutput Image.
Examples
example_imgproc.cpp.

◆ StrToInterpolationType()

InterpolationType ecvl::StrToInterpolationType ( const std::string &  interp,
const std::string &  aug_name 
)

◆ Sub() [1/3]

void ecvl::Sub ( const Image src1,
const Image src2,
Image dst,
DataType  dst_type = DataType::none,
bool  saturate = true 
)
inline
Examples
example_image_view.cpp.

Definition at line 118 of file arithmetic.h.

◆ Sub() [2/3]

template<typename ST2 >
void ecvl::Sub ( const Image src1,
const ST2 &  src2,
Image dst,
DataType  dst_type = DataType::none,
bool  saturate = true 
)

Definition at line 119 of file arithmetic.h.

◆ Sub() [3/3]

template<typename ST1 >
void ecvl::Sub ( const ST1 &  src1,
const Image src2,
Image dst,
DataType  dst_type = DataType::none,
bool  saturate = true 
)

Definition at line 120 of file arithmetic.h.

◆ TensorToImage()

void ecvl::TensorToImage ( Tensor *&  t,
Image img 
)

Convert an EDDL Tensor into an ECVL Image.

Tensor dimensions must be \(C\) x \(H\) x \(W\) or \(N\) x \(C\) x \(H\) x \(W\), where:
\(N\) = batch size
\(C\) = channels
\(H\) = height
\(W\) = width

Parameters
[in]tInput EDDL Tensor.
[out]imgOutput ECVL Image. It is a "xyo" with DataType::float32 and ColorType::none Image.
Examples
example_ecvl_eddl.cpp.

◆ TensorToView()

void ecvl::TensorToView ( Tensor *&  t,
View< DataType::float32 > &  v 
)

Convert an EDDL Tensor into an ECVL View.

Tensor dimensions must be \(C\) x \(H\) x \(W\) or \(N\) x \(C\) x \(H\) x \(W\), where:
\(N\) = batch size
\(C\) = channels
\(H\) = height
\(W\) = width

Parameters
[in]tInput EDDL Tensor.
[out]vOutput ECVL View. It is a "xyo" with ColorType::none View.
Examples
example_ecvl_eddl.cpp.

◆ Threshold()

void ecvl::Threshold ( const Image src,
Image dst,
double  thresh,
double  maxval,
ThresholdingType  thresh_type = ThresholdingType::BINARY 
)

Applies a fixed threshold to an input Image.

The Threshold() function applies a fixed thresholding to an input Image. The function is useful to get a binary image out of a grayscale (ColorType::GRAY) Image or to remove noise filtering out pixels with too small or too large values. Anyway, the function can be applied to any input Image. The pixels up to "thresh" value will be set to 0, the pixels above this value will be set to "maxvalue" if "thresh_type" is ThresholdingType::BINARY (default). The opposite will happen if "thresh_type" is ThresholdingType::BINARY_INV.

Parameters
[in]srcInput Image on which to apply the threshold.
[out]dstThe output thresholded Image.
[in]threshThreshold value.
[in]maxvalThe maximum values in the thresholded Image.
[in]thresh_typeType of threshold to be applied, see ThresholdingType. The default value is ThresholdingType::BINARY.
Examples
example_imgproc.cpp, example_moments.cpp, example_nifti_dicom.cpp, and example_threshold.cpp.

◆ Transpose()

void ecvl::Transpose ( const Image src,
Image dst 
)

Swap rows and columns of an Image.

Parameters
[in]srcInput Image.
[out]dstOutput transposed Image.
Examples
example_imgproc.cpp.

◆ VConcat()

void ecvl::VConcat ( const std::vector< Image > &  src,
Image dst 
)

Vertical concatenation of images (with the same number of columns)

Parameters
[in]srcvector of input Images.
[out]dstOutput Image.
Examples
example_imgproc.cpp.

◆ vsize()

template<typename T >
int ecvl::vsize ( const std::vector< T > &  v)

Definition at line 34 of file image.h.

◆ WxFromImg()

wxImage ecvl::WxFromImg ( Image img)

Convert an ECVL Image into a wxImage.

Parameters
[in]imgInput ECVL Image.
Returns
wxImage.
Examples
example_ecvl_gui.cpp.