brainrat-private 6.0.4
slices.h File Reference
#include <iomanip>
#include <cartobase/type/string_conversion.h>
#include <aims/io/process.h>
#include <aims/io/io_g.h>
#include <aims/data/data_g.h>
#include <aims/math/mathelem.h>
#include <aims/morphology/morphology_g.h>
#include <aims/utility/converter_g.h>
Include dependency graph for slices.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  SlicesDetector
 
class  SlicesStacker
 
class  RGBSlicesStacker
 
class  GreyLevelSlicesStacker
 
struct  Component
 
struct  Tests
 
struct  Maxima
 
class  HistologyScanSlicesDetector
 

Macros

#define INCH   25.49
 
#define NB_MODES   2
 
#define MIN_HISTO   0
 
#define MAX_HISTO   64
 
#define MAX_INT16_T   32767
 
#define MAX_ITER   500
 
#define MID_WINDOW   4
 
#define FRACTION   3.0
 
#define BORDER_LOCAL   10
 
#define BORDER_GLOBAL   50
 
#define PERCENT_SURFACE   .2
 
#define EROSION   1
 

Typedefs

typedef struct ComponentComponentPtr
 
typedef struct TestsTestsPtr
 
typedef struct MaximaMaximaPtr
 
typedef std::vector< Component >::iterator CompIterator
 
typedef std::vector< Maxima >::iterator MaxIterator
 

Enumerations

enum  ContinuityParameterTested { ComponentSurface , ComponentSize_hz , ComponentSize_vt }
 
enum  Direction { Horizontal , Vertical }
 
enum  HistoAnalysisFunction { HistogramMode , ProjectionMode }
 

Functions

Maxima affectMaxima (int32_t iter, int32_t num, int32_t val, int32_t pos, int32_t extr)
 
void writeComponents (std::vector< Component > &comp)
 
void writeVector3int32_t (std::vector< AimsVector< int32_t, 3 > > &vect)
 
void writeVectorInt32_t (std::vector< int32_t > &vect)
 
void writeAimsInt32_t (carto::VolumeRef< int32_t > &vol)
 
void writeAimsFloat (carto::VolumeRef< float > &vol)
 
void writeMaxima (std::vector< Maxima > &mxm)
 
void writeMaximaIter (std::vector< Maxima > &mxm, int32_t iter)
 
template<class T>
float computeHistogramRatio (const carto::VolumeRef< T > &vol, const int32_t bins)
 
carto::VolumeRef< int32_t > generateHistogram (const carto::VolumeRef< int16_t > &vol, const int32_t bins=MAX_HISTO)
 
std::vector< AimsVector< int32_t, 3 > > updateVDM (std::vector< AimsVector< int32_t, 3 > > &vdm)
 
carto::VolumeRef< int16_t > applyThreshold (const carto::VolumeRef< int16_t > &vol, const int16_t threshold_lower_bound, const int16_t threshold_upper_bound, const int16_t new_value=MAX_INT16_T)
 
carto::VolumeRef< int16_t > computeConnexComponent (carto::VolumeRef< int16_t > &vol)
 
std::vector< ComponentremoveComponent (std::vector< Component > cpnt, int32_t l)
 
std::vector< ComponentremoveComponents (const std::vector< Component > &cpnt, const std::vector< Component > &to_remove)
 
std::vector< ComponentinsertComponent (std::vector< Component > cpnt, int32_t comp, std::vector< Component > cpnt2slices, int32_t l)
 
std::vector< int32_t > getComponentLabels (const std::vector< Component > &cpnt)
 
std::vector< ComponentextractInformationFromComponent (const carto::VolumeRef< int16_t > &vol)
 
Tests testComponents (const std::vector< Component > &cpnt, int32_t number_cpnt)
 
void displayComponentsStrategy (const std::vector< Component > &cpnt)
 
void displayStatus (const Tests &t)
 
bool isValid (const Tests &t)
 
std::vector< int32_t > extractVectorFromComponent (std::vector< Component > cpnt, ContinuityParameterTested param)
 
std::vector< ComponentprocessMedianConsistencyParameters (std::vector< Component > &cpnt, float variation, int32_t mid_window=0)
 
carto::VolumeRef< int32_t > projectData (carto::VolumeRef< int16_t > &X)
 
carto::VolumeRef< int16_t > transposeVolume (carto::VolumeRef< int16_t > &vol)
 
bool removeComponentsInVolume (carto::VolumeRef< int16_t > &vol, const std::vector< Component > &to_remove)
 
carto::VolumeRef< int16_t > extractFromVolume (const carto::VolumeRef< int16_t > &vol, const int32_t x, const int32_t X, const int32_t y, const int32_t Y, const int32_t old_label, const int32_t new_label)
 
bool copyToVolume (const carto::VolumeRef< int16_t > &vol, carto::VolumeRef< int16_t > &destvol, const int32_t x, const int32_t X, const int32_t y, const int32_t Y, const int32_t old_label, const int32_t new_label)
 
std::vector< ComponentopeningComponent (std::vector< Component > &cpnt, int32_t comp, carto::VolumeRef< int16_t > vol, float fraction)
 
std::vector< ComponentseparateComponent (std::vector< Component > &cpnt, int32_t comp, carto::VolumeRef< int16_t > vol, int32_t min_surface, Direction dir, float fraction)
 
std::vector< ComponentgetOutliersBySurface (const std::vector< Component > &cpnt, const float min_surface)
 
std::vector< ComponentgetOutliersByWeight (const std::vector< Component > &cpnt, const int32_t slices_number)
 
std::vector< ComponentfilterComponentsBySurface (const std::vector< Component > &cpnt, const float min_surface)
 
std::vector< ComponentweightedRemoveComponents (std::vector< Component > &cpnt, int32_t slices_number)
 
std::vector< ComponentprocessOutlierComponent (std::vector< Component > &cpnt, carto::VolumeRef< int16_t > &vol, int32_t min_surface, int32_t slices_number, float fraction)
 
int32_t getDimensionCount (std::vector< int32_t > dimensionsizes)
 
std::vector< ComponentchangeComponentsIndex (std::vector< Component > &components, std::vector< int32_t > dimensionsizes, std::vector< int32_t > dimensionorders, int32_t offset=1, int32_t step=1)
 
bool compareComponentsByLabelM (const Component &c1, const Component &c2)
 
std::vector< ComponentsortComponent (std::vector< Component > &cpnt, std::vector< int32_t > dimensionsizes)
 
carto::VolumeRef< int16_t > applyNewLabelling (std::vector< Component > cpnt, carto::VolumeRef< int16_t > vol)
 
template<class T>
bool detectSlices (aims::Process &p, const std::string &, aims::Finder &)
 
int32_t extractMaxima (std::vector< int32_t > vctr)
 
template<class T>
void rescale (carto::VolumeRef< T > &in, carto::RescalerInfo &info)
 
template<class T>
bool writeStackedSlices (int32_t dx, int32_t dy, int32_t res, float z, T background, std::vector< Component > &cpnt, carto::VolumeRef< T > &vol, std::string outputfile, std::string format)
 
template<class T>
bool writeNumberedSlices (int32_t dx, int32_t dy, int32_t res, float z, T background, std::vector< Component > &cpnt, carto::VolumeRef< T > &vol, std::string outputdir, std::string outputname, std::string format, uint8_t slicemin)
 
template<class T>
float getVoxelLebesgue (const carto::VolumeRef< T > &vol)
 
template<class T>
int32_t getVoxelCount (const carto::VolumeRef< T > &vol, float value)
 
template<class T>
background (std::vector< Component > &cpnt, carto::VolumeRef< T > &vol)
 
template<>
AimsRGB background< AimsRGB > (std::vector< Component > &cpnt, carto::VolumeRef< AimsRGB > &vol)
 
template<>
AimsRGBA background< AimsRGBA > (std::vector< Component > &cpnt, carto::VolumeRef< AimsRGBA > &vol)
 

Macro Definition Documentation

◆ BORDER_GLOBAL

#define BORDER_GLOBAL   50

Definition at line 34 of file slices.h.

Referenced by writeNumberedSlices(), and writeStackedSlices().

◆ BORDER_LOCAL

#define BORDER_LOCAL   10

◆ EROSION

#define EROSION   1

Definition at line 36 of file slices.h.

◆ FRACTION

#define FRACTION   3.0

Definition at line 31 of file slices.h.

Referenced by HistologyScanSlicesDetector::HistologyScanSlicesDetector().

◆ INCH

#define INCH   25.49

Definition at line 23 of file slices.h.

Referenced by writeNumberedSlices(), and writeStackedSlices().

◆ MAX_HISTO

#define MAX_HISTO   64

◆ MAX_INT16_T

#define MAX_INT16_T   32767

Definition at line 27 of file slices.h.

Referenced by applyThreshold().

◆ MAX_ITER

#define MAX_ITER   500

Definition at line 28 of file slices.h.

◆ MID_WINDOW

#define MID_WINDOW   4

Definition at line 29 of file slices.h.

◆ MIN_HISTO

#define MIN_HISTO   0

Definition at line 25 of file slices.h.

◆ NB_MODES

#define NB_MODES   2

◆ PERCENT_SURFACE

#define PERCENT_SURFACE   .2

Definition at line 35 of file slices.h.

Typedef Documentation

◆ CompIterator

typedef std::vector<Component>::iterator CompIterator

Definition at line 265 of file slices.h.

◆ ComponentPtr

typedef struct Component * ComponentPtr

◆ MaximaPtr

typedef struct Maxima * MaximaPtr

◆ MaxIterator

typedef std::vector<Maxima>::iterator MaxIterator

Definition at line 266 of file slices.h.

◆ TestsPtr

typedef struct Tests * TestsPtr

Enumeration Type Documentation

◆ ContinuityParameterTested

Enumerator
ComponentSurface 
ComponentSize_hz 
ComponentSize_vt 

Definition at line 93 of file slices.h.

◆ Direction

enum Direction
Enumerator
Horizontal 
Vertical 

Definition at line 100 of file slices.h.

◆ HistoAnalysisFunction

Enumerator
HistogramMode 
ProjectionMode 

Definition at line 106 of file slices.h.

Function Documentation

◆ affectMaxima()

Maxima affectMaxima ( int32_t iter,
int32_t num,
int32_t val,
int32_t pos,
int32_t extr )

◆ applyNewLabelling()

carto::VolumeRef< int16_t > applyNewLabelling ( std::vector< Component > cpnt,
carto::VolumeRef< int16_t > vol )

◆ applyThreshold()

carto::VolumeRef< int16_t > applyThreshold ( const carto::VolumeRef< int16_t > & vol,
const int16_t threshold_lower_bound,
const int16_t threshold_upper_bound,
const int16_t new_value = MAX_INT16_T )

References MAX_INT16_T.

◆ background()

◆ background< AimsRGB >()

template<>
AimsRGB background< AimsRGB > ( std::vector< Component > & cpnt,
carto::VolumeRef< AimsRGB > & vol )
inline

◆ background< AimsRGBA >()

template<>
AimsRGBA background< AimsRGBA > ( std::vector< Component > & cpnt,
carto::VolumeRef< AimsRGBA > & vol )
inline

◆ changeComponentsIndex()

std::vector< Component > changeComponentsIndex ( std::vector< Component > & components,
std::vector< int32_t > dimensionsizes,
std::vector< int32_t > dimensionorders,
int32_t offset = 1,
int32_t step = 1 )

Referenced by individStackSlices().

◆ compareComponentsByLabelM()

bool compareComponentsByLabelM ( const Component & c1,
const Component & c2 )

◆ computeConnexComponent()

carto::VolumeRef< int16_t > computeConnexComponent ( carto::VolumeRef< int16_t > & vol)

◆ computeHistogramRatio()

template<class T>
float computeHistogramRatio ( const carto::VolumeRef< T > & vol,
const int32_t bins )

◆ copyToVolume()

bool copyToVolume ( const carto::VolumeRef< int16_t > & vol,
carto::VolumeRef< int16_t > & destvol,
const int32_t x,
const int32_t X,
const int32_t y,
const int32_t Y,
const int32_t old_label,
const int32_t new_label )

◆ detectSlices()

◆ displayComponentsStrategy()

void displayComponentsStrategy ( const std::vector< Component > & cpnt)

◆ displayStatus()

void displayStatus ( const Tests & t)

◆ extractFromVolume()

carto::VolumeRef< int16_t > extractFromVolume ( const carto::VolumeRef< int16_t > & vol,
const int32_t x,
const int32_t X,
const int32_t y,
const int32_t Y,
const int32_t old_label,
const int32_t new_label )

◆ extractInformationFromComponent()

std::vector< Component > extractInformationFromComponent ( const carto::VolumeRef< int16_t > & vol)

◆ extractMaxima()

int32_t extractMaxima ( std::vector< int32_t > vctr)

◆ extractVectorFromComponent()

std::vector< int32_t > extractVectorFromComponent ( std::vector< Component > cpnt,
ContinuityParameterTested param )

◆ filterComponentsBySurface()

std::vector< Component > filterComponentsBySurface ( const std::vector< Component > & cpnt,
const float min_surface )

◆ generateHistogram()

carto::VolumeRef< int32_t > generateHistogram ( const carto::VolumeRef< int16_t > & vol,
const int32_t bins = MAX_HISTO )

References MAX_HISTO.

◆ getComponentLabels()

std::vector< int32_t > getComponentLabels ( const std::vector< Component > & cpnt)

◆ getDimensionCount()

int32_t getDimensionCount ( std::vector< int32_t > dimensionsizes)

◆ getOutliersBySurface()

std::vector< Component > getOutliersBySurface ( const std::vector< Component > & cpnt,
const float min_surface )

◆ getOutliersByWeight()

std::vector< Component > getOutliersByWeight ( const std::vector< Component > & cpnt,
const int32_t slices_number )

◆ getVoxelCount()

template<class T>
int32_t getVoxelCount ( const carto::VolumeRef< T > & vol,
float value )

◆ getVoxelLebesgue()

template<class T>
float getVoxelLebesgue ( const carto::VolumeRef< T > & vol)

◆ insertComponent()

std::vector< Component > insertComponent ( std::vector< Component > cpnt,
int32_t comp,
std::vector< Component > cpnt2slices,
int32_t l )

◆ isValid()

bool isValid ( const Tests & t)

◆ openingComponent()

std::vector< Component > openingComponent ( std::vector< Component > & cpnt,
int32_t comp,
carto::VolumeRef< int16_t > vol,
float fraction )

◆ processMedianConsistencyParameters()

std::vector< Component > processMedianConsistencyParameters ( std::vector< Component > & cpnt,
float variation,
int32_t mid_window = 0 )

◆ processOutlierComponent()

std::vector< Component > processOutlierComponent ( std::vector< Component > & cpnt,
carto::VolumeRef< int16_t > & vol,
int32_t min_surface,
int32_t slices_number,
float fraction )

◆ projectData()

carto::VolumeRef< int32_t > projectData ( carto::VolumeRef< int16_t > & X)

◆ removeComponent()

std::vector< Component > removeComponent ( std::vector< Component > cpnt,
int32_t l )

◆ removeComponents()

std::vector< Component > removeComponents ( const std::vector< Component > & cpnt,
const std::vector< Component > & to_remove )

◆ removeComponentsInVolume()

bool removeComponentsInVolume ( carto::VolumeRef< int16_t > & vol,
const std::vector< Component > & to_remove )

◆ rescale()

template<class T>
void rescale ( carto::VolumeRef< T > & in,
carto::RescalerInfo & info )

References background().

Referenced by bio::ChannelExtractor< AimsHSV, C >::getChannela(), bio::ChannelExtractor< AimsRGB, C >::getChannela(), bio::ChannelExtractor< AimsRGBA, C >::getChannela(), bio::ChannelExtractor< AimsHSV, C >::getChannelB(), bio::ChannelExtractor< AimsHSV, C >::getChannelb(), bio::ChannelExtractor< AimsRGB, C >::getChannelb(), bio::ChannelExtractor< AimsRGBA, C >::getChannelb(), bio::ChannelExtractor< AimsHSV, C >::getChannelCb(), bio::ChannelExtractor< AimsRGB, C >::getChannelCb(), bio::ChannelExtractor< AimsRGBA, C >::getChannelCb(), bio::ChannelExtractor< AimsHSV, C >::getChannelCr(), bio::ChannelExtractor< AimsRGB, C >::getChannelCr(), bio::ChannelExtractor< AimsRGBA, C >::getChannelCr(), bio::ChannelExtractor< AimsHSV, C >::getChannelG(), bio::ChannelExtractor< AimsRGB, C >::getChannelH(), bio::ChannelExtractor< AimsRGBA, C >::getChannelH(), bio::ChannelExtractor< AimsHSV, C >::getChannelL(), bio::ChannelExtractor< AimsRGB, C >::getChannelL(), bio::ChannelExtractor< AimsRGBA, C >::getChannelL(), bio::ChannelExtractor< AimsHSV, C >::getChannelR(), bio::ChannelExtractor< AimsHSV, C >::getChannelRGBNorm(), bio::ChannelExtractor< AimsRGB, C >::getChannelRGBNorm(), bio::ChannelExtractor< AimsRGBA, C >::getChannelRGBNorm(), bio::ChannelExtractor< AimsRGB, C >::getChannelS(), bio::ChannelExtractor< AimsRGBA, C >::getChannelS(), bio::ChannelExtractor< AimsRGB, C >::getChannelV(), bio::ChannelExtractor< AimsRGBA, C >::getChannelV(), bio::ChannelExtractor< AimsHSV, C >::getChannelX(), bio::ChannelExtractor< AimsRGB, C >::getChannelX(), bio::ChannelExtractor< AimsRGBA, C >::getChannelX(), bio::ChannelExtractor< AimsHSV, C >::getChannelY(), bio::ChannelExtractor< AimsRGB, C >::getChannelY(), bio::ChannelExtractor< AimsRGBA, C >::getChannelY(), bio::ChannelExtractor< AimsHSV, C >::getChannelYl(), bio::ChannelExtractor< AimsRGB, C >::getChannelYl(), bio::ChannelExtractor< AimsRGBA, C >::getChannelYl(), bio::ChannelExtractor< AimsHSV, C >::getChannelZ(), bio::ChannelExtractor< AimsRGB, C >::getChannelZ(), and bio::ChannelExtractor< AimsRGBA, C >::getChannelZ().

◆ separateComponent()

std::vector< Component > separateComponent ( std::vector< Component > & cpnt,
int32_t comp,
carto::VolumeRef< int16_t > vol,
int32_t min_surface,
Direction dir,
float fraction )

◆ sortComponent()

std::vector< Component > sortComponent ( std::vector< Component > & cpnt,
std::vector< int32_t > dimensionsizes )

Referenced by individStackSlices().

◆ testComponents()

Tests testComponents ( const std::vector< Component > & cpnt,
int32_t number_cpnt )

◆ transposeVolume()

carto::VolumeRef< int16_t > transposeVolume ( carto::VolumeRef< int16_t > & vol)

◆ updateVDM()

std::vector< AimsVector< int32_t, 3 > > updateVDM ( std::vector< AimsVector< int32_t, 3 > > & vdm)

◆ weightedRemoveComponents()

std::vector< Component > weightedRemoveComponents ( std::vector< Component > & cpnt,
int32_t slices_number )

◆ writeAimsFloat()

void writeAimsFloat ( carto::VolumeRef< float > & vol)

◆ writeAimsInt32_t()

void writeAimsInt32_t ( carto::VolumeRef< int32_t > & vol)

◆ writeComponents()

void writeComponents ( std::vector< Component > & comp)

Referenced by individStackSlices().

◆ writeMaxima()

void writeMaxima ( std::vector< Maxima > & mxm)

◆ writeMaximaIter()

void writeMaximaIter ( std::vector< Maxima > & mxm,
int32_t iter )

◆ writeNumberedSlices()

template<class T>
bool writeNumberedSlices ( int32_t dx,
int32_t dy,
int32_t res,
float z,
T background,
std::vector< Component > & cpnt,
carto::VolumeRef< T > & vol,
std::string outputdir,
std::string outputname,
std::string format,
uint8_t slicemin )

◆ writeStackedSlices()

template<class T>
bool writeStackedSlices ( int32_t dx,
int32_t dy,
int32_t res,
float z,
T background,
std::vector< Component > & cpnt,
carto::VolumeRef< T > & vol,
std::string outputfile,
std::string format )

◆ writeVector3int32_t()

void writeVector3int32_t ( std::vector< AimsVector< int32_t, 3 > > & vect)

◆ writeVectorInt32_t()

void writeVectorInt32_t ( std::vector< int32_t > & vect)