iRoCS Toolbox  1.1.0
Data Structures | Functions
iRoCS Namespace Reference

Data Structures

class  Features
 
class  ProgressReporter
 
class  ProgressReporterQt4
 
class  ProgressReporterQt5
 
class  ProgressReporterStream
 

Functions

void assignLayers (atb::Array< double, 3 > const &data, std::vector< atb::Nucleus > &nuclei, atb::IRoCS const &iRoCS, std::string const &modelFileName, std::string const &cacheFileName="", bool updateMitoses=false, bool cacheCoordinates=false, bool forceFeatureComputation=false, ProgressReporter *pr=NULL)
 
void assignLayersToSegmentation (atb::Array< int, 3 > const &L, ShellCoordinateTransform const &sct, double volumeThresholdUm3, std::string const &modelFileName, std::string const &featureFileName, std::string const &featureGroup, std::vector< std::string > &featureNames, std::string const &outFileName, std::string const &labelName, int backgroundLabel=1, ProgressReporter *pr=NULL)
 
void attachIRoCS (atb::IRoCS &iRoCS, std::vector< atb::Nucleus > &nuclei, blitz::TinyVector< double, 3 > const &qcPositionUm, double kappa=1.0, double lambda=0.0, double mu=0.0, double searchRadiusUm=0.0, int nIterations=1000, double tau=0.1, ProgressReporter *pr=NULL)
 
void attachIRoCS (ShellCoordinateTransform &sct, atb::Array< int, 3 > const &segmentation, int backgroundLabel, int downSampleRatio, double segmentLength, double margin, blitz::TinyVector< double, 3 > const &posQC=blitz::TinyVector< double, 3 >(-std::numeric_limits< double >::infinity()), blitz::TinyVector< double, 3 > const &xDirection=blitz::TinyVector< double, 3 >(-std::numeric_limits< double >::infinity()), std::string const &debugFileName="", atb::Array< double, 3 > *l=NULL, atb::Array< double, 3 > *r=NULL, atb::Array< double, 3 > *p=NULL, iRoCS::ProgressReporter *pr=NULL)
 
void boundaryDetection (blitz::Array< bool, 3 > const &segmentation, blitz::Array< bool, 3 > &border)
 
void computeCellFeatures (atb::Array< int, 3 > const &L, ShellCoordinateTransform const &sct, double volumeThresholdUm, std::string const &outFileName, std::string const &featureGroup, int backgroundLabel=-1, bool connectedComponentLabeling=false, ProgressReporter *pr=NULL)
 Compute cell shape features for the given segmentation masks aligned to the given iRoCS shell coordinate transform. More...
 
double computeConvexity (atb::Array< int, 3 > const &L, std::vector< blitz::TinyVector< atb::BlitzIndexT, 3 > > const &voxelSet, int nRandomPairs=100000)
 Compute a convexity measure for a segment based on sample points. More...
 
void computeVoxelSetsPerLabel (atb::Array< int, 3 > const &L, blitz::Array< std::vector< blitz::TinyVector< atb::BlitzIndexT, 3 > >, 1 > &voxelSets, int backgroundLabel, ProgressReporter *pr=NULL)
 For each label compute the vector of voxel positions with that label in L. More...
 
void detectNuclei (atb::Array< double, 3 > const &data, std::vector< atb::Nucleus > &nuclei, std::string const &modelFileName, ptrdiff_t memoryLimit, std::string const &cacheFileName="", ProgressReporter *pr=NULL)
 
void detectSpheres (atb::Array< float, 3 > const &data, std::vector< atb::Nucleus > &spheres, atb::Array< float, 3 > &response, atb::Array< float, 3 > &radiusUm, blitz::TinyVector< double, 2 > const &radiusRangeUm, double radiusStepUm, double preSmoothingSigmaUm, double postSmoothingSigmaUm, double minMagnitude=0.0, bool invertGradients=false, double gamma=1.0, ProgressReporter *pr=NULL)
 
void extractPosition (blitz::Array< bool, 3 > &shell, std::vector< blitz::TinyVector< double, 3 > > &shellPoints)
 
void extractRD (atb::Array< int, 3 > const &L, int label, blitz::TinyVector< double, 3 > const &center, blitz::TinyMatrix< double, 3, 3 > const &axes, blitz::TinyVector< double, 26 > &rd)
 
void labelEpidermis (atb::Array< double, 3 > const &data, std::vector< atb::Nucleus > &nuclei, std::string const &modelFileName, std::string const &cacheFileName="", bool forceFeatureComputation=false, ProgressReporter *pr=NULL)
 
void segmentCells (atb::Array< double, 3 > &data, atb::Array< int, 3 > &segmentation, double gamma, int normalizationType, int medianWidthPx, double processingElementSizeUm, double varSigmaUm, double varEpsilon, float sigmaHessianUm, bool preDiffusion, int nDiffusionIterations, float zCompensationFactor, double kappa, float deltaT, float l1Threshold, float volumeThresholdUm, int boundaryThicknessPx, std::string const &debugFileName="", iRoCS::ProgressReporter *pr=NULL)
 
void trainDetector (TrainingParameters const &parameters, ProgressReporter *pr=NULL)
 
void trainEpidermisLabelling (TrainingParameters const &parameters, ProgressReporter *pr=NULL)
 
void trainLayerAssignment (TrainingParameters const &parameters, ProgressReporter *pr=NULL)
 
void trainLayerAssignmentToSegmentation (std::vector< std::string > const &infiles, std::string const &segmentationName, std::string const &sctName, double volumeThresholdUm3, std::string const &modelFileName, std::vector< std::string > const &featureFileNames, std::string const &featureGroup, std::vector< std::string > &featureNames, std::vector< std::string > const &labelFileNames, std::string const &labelName, blitz::TinyVector< int, 2 > const &labelRange, bool computeFeatures, int backgroundLabel=1, ProgressReporter *pr=NULL)
 
void varianceNormalization (blitz::Array< double, 3 > &data, blitz::TinyVector< double, 3 > const &elementSizeUm, double sigmaUm, double epsilon=1e-10, iRoCS::ProgressReporter *pr=NULL)
 

Function Documentation

◆ trainLayerAssignmentToSegmentation()

void iRoCS::trainLayerAssignmentToSegmentation ( std::vector< std::string > const &  infiles,
std::string const &  segmentationName,
std::string const &  sctName,
double  volumeThresholdUm3,
std::string const &  modelFileName,
std::vector< std::string > const &  featureFileNames,
std::string const &  featureGroup,
std::vector< std::string > &  featureNames,
std::vector< std::string > const &  labelFileNames,
std::string const &  labelName,
blitz::TinyVector< int, 2 > const &  labelRange,
bool  computeFeatures,
int  backgroundLabel = 1,
ProgressReporter pr = NULL 
)

◆ assignLayersToSegmentation()

void iRoCS::assignLayersToSegmentation ( atb::Array< int, 3 > const &  L,
ShellCoordinateTransform const &  sct,
double  volumeThresholdUm3,
std::string const &  modelFileName,
std::string const &  featureFileName,
std::string const &  featureGroup,
std::vector< std::string > &  featureNames,
std::string const &  outFileName,
std::string const &  labelName,
int  backgroundLabel = 1,
ProgressReporter pr = NULL 
)

◆ boundaryDetection()

void iRoCS::boundaryDetection ( blitz::Array< bool, 3 > const &  segmentation,
blitz::Array< bool, 3 > &  border 
)

◆ extractPosition()

void iRoCS::extractPosition ( blitz::Array< bool, 3 > &  shell,
std::vector< blitz::TinyVector< double, 3 > > &  shellPoints 
)

◆ attachIRoCS() [1/2]

void iRoCS::attachIRoCS ( ShellCoordinateTransform sct,
atb::Array< int, 3 > const &  segmentation,
int  backgroundLabel,
int  downSampleRatio,
double  segmentLength,
double  margin,
blitz::TinyVector< double, 3 > const &  posQC = blitz::TinyVector< double, 3 >(-std::numeric_limits< double >::infinity()),
blitz::TinyVector< double, 3 > const &  xDirection = blitz::TinyVector< double, 3 >(-std::numeric_limits< double >::infinity()),
std::string const &  debugFileName = "",
atb::Array< double, 3 > *  l = NULL,
atb::Array< double, 3 > *  r = NULL,
atb::Array< double, 3 > *  p = NULL,
iRoCS::ProgressReporter pr = NULL 
)

◆ attachIRoCS() [2/2]

void iRoCS::attachIRoCS ( atb::IRoCS iRoCS,
std::vector< atb::Nucleus > &  nuclei,
blitz::TinyVector< double, 3 > const &  qcPositionUm,
double  kappa = 1.0,
double  lambda = 0.0,
double  mu = 0.0,
double  searchRadiusUm = 0.0,
int  nIterations = 1000,
double  tau = 0.1,
ProgressReporter pr = NULL 
)

◆ extractRD()

void iRoCS::extractRD ( atb::Array< int, 3 > const &  L,
int  label,
blitz::TinyVector< double, 3 > const &  center,
blitz::TinyMatrix< double, 3, 3 > const &  axes,
blitz::TinyVector< double, 26 > &  rd 
)

◆ computeVoxelSetsPerLabel()

void iRoCS::computeVoxelSetsPerLabel ( atb::Array< int, 3 > const &  L,
blitz::Array< std::vector< blitz::TinyVector< atb::BlitzIndexT, 3 > >, 1 > &  voxelSets,
int  backgroundLabel,
ProgressReporter pr = NULL 
)

For each label compute the vector of voxel positions with that label in L.

Voxels with intensities <= 0 or the given backgroundLabel are not added. The voxel positions for the segment with label i will be returned at index i-1.

Parameters
LThe segmentation mask Array
voxelSetsFor each label compute the set of voxels comprising the segment with that label. The Array must be given with appropriate size to fit all labels you are interested in.
backgroundLabelDo not collect voxel positions for this label

◆ computeConvexity()

double iRoCS::computeConvexity ( atb::Array< int, 3 > const &  L,
std::vector< blitz::TinyVector< atb::BlitzIndexT, 3 > > const &  voxelSet,
int  nRandomPairs = 100000 
)

Compute a convexity measure for a segment based on sample points.

From the given set of segment points, nRandomPairs random pairs are drawn. If the center point of their connecting line is in the segment the convexity test returns true and increments the positive count, otherwise it fails leaving the convexity test count at its current value. In the end the number of positive test results is divided by the number of tests to get a value in [0, 1].

Parameters
LThe segmentation as integer array containing unique labels for each segment
voxelSetA (sub-)set of voxels stemming from the segment
nRandomPairsThe number of random point pairs to use for the convexity test
Returns
Percentage of positive convexity tests

◆ computeCellFeatures()

void iRoCS::computeCellFeatures ( atb::Array< int, 3 > const &  L,
ShellCoordinateTransform const &  sct,
double  volumeThresholdUm,
std::string const &  outFileName,
std::string const &  featureGroup,
int  backgroundLabel = -1,
bool  connectedComponentLabeling = false,
ProgressReporter pr = NULL 
)

Compute cell shape features for the given segmentation masks aligned to the given iRoCS shell coordinate transform.

Features that are computed per segment include:
volumes (1) - The cell volume in micometers cube
normCenters (3) - The normalized iRoCS shell coordinate transform coordinates. They are normalized so that the outer root boundary has a radius value of 1
RD (26) - The cell shape profile. RD(12) + RD(13) = cell extent in axial direction RD(10) + RD(15) = cell extent in radial direction RD(4) + RD(21) = cell extent in angular direction
blockSize (3) - The lengths of the cells' main axes axes
volumeOverBlock (1) - The segment - cuboid spanned by blockSize volume ratio
convexity (1) - An estimate of the segment's convexity using a Montecarlo estimator.
neighbor (n) - The indices of the first n neighboring segments If the segment has less than n neighbors, residual entries will be -1 Additional information stored per segment:
validFlag - Only if this flag is set, the features are valid borderFlag - Is set for segments that touch any volume boundary centers - The segment centers in Array coordinates localAxes - The main segment axes (rotation matrix)

Parameters
LThe segmentation masks. Voxels with value <=0 are assumed to be segment boundaries and are ignored
sctThe iRoCS shell coordinate transform that will be used to get the positional features. The shape features will be aligned to that coordinate system.
volumeThresholdUmSegments smaller than this volume threshold in micrometers cube will be ignored. Their valid flag will be set to false and the features will be set to all zero.
outFileNameThe name of the output hdf5 file to store the per-segment features to.
featureGroupThe hdf5 base group to store the feature datasets to.
backgroundLabelGive the label of the background segment with this parameter. If not given (or a negative value is passed) the background label will be automatically determined as the label belonging to the largest connected component of the segmentation.
connectedComponentLabelingIf given the connected components of the binarized segmentation masks are used instead of the segments as they are. This is important if the integer value of the segments indicates class label instead of instance label or if the existing segment numbering is not consecutive. Labels 0 and <backgroundLabel> are background for the connected component labeling all other labels foreground. If given the label array after connected component labeling will be written to the output group for reference.
prIf given, progress will be reported to this progress reporter

◆ detectNuclei()

void iRoCS::detectNuclei ( atb::Array< double, 3 > const &  data,
std::vector< atb::Nucleus > &  nuclei,
std::string const &  modelFileName,
ptrdiff_t  memoryLimit,
std::string const &  cacheFileName = "",
ProgressReporter pr = NULL 
)

◆ detectSpheres()

void iRoCS::detectSpheres ( atb::Array< float, 3 > const &  data,
std::vector< atb::Nucleus > &  spheres,
atb::Array< float, 3 > &  response,
atb::Array< float, 3 > &  radiusUm,
blitz::TinyVector< double, 2 > const &  radiusRangeUm,
double  radiusStepUm,
double  preSmoothingSigmaUm,
double  postSmoothingSigmaUm,
double  minMagnitude = 0.0,
bool  invertGradients = false,
double  gamma = 1.0,
ProgressReporter pr = NULL 
)

◆ labelEpidermis()

void iRoCS::labelEpidermis ( atb::Array< double, 3 > const &  data,
std::vector< atb::Nucleus > &  nuclei,
std::string const &  modelFileName,
std::string const &  cacheFileName = "",
bool  forceFeatureComputation = false,
ProgressReporter pr = NULL 
)

◆ assignLayers()

void iRoCS::assignLayers ( atb::Array< double, 3 > const &  data,
std::vector< atb::Nucleus > &  nuclei,
atb::IRoCS const &  iRoCS,
std::string const &  modelFileName,
std::string const &  cacheFileName = "",
bool  updateMitoses = false,
bool  cacheCoordinates = false,
bool  forceFeatureComputation = false,
ProgressReporter pr = NULL 
)

◆ varianceNormalization()

void iRoCS::varianceNormalization ( blitz::Array< double, 3 > &  data,
blitz::TinyVector< double, 3 > const &  elementSizeUm,
double  sigmaUm,
double  epsilon = 1e-10,
iRoCS::ProgressReporter pr = NULL 
)

◆ segmentCells()

void iRoCS::segmentCells ( atb::Array< double, 3 > &  data,
atb::Array< int, 3 > &  segmentation,
double  gamma,
int  normalizationType,
int  medianWidthPx,
double  processingElementSizeUm,
double  varSigmaUm,
double  varEpsilon,
float  sigmaHessianUm,
bool  preDiffusion,
int  nDiffusionIterations,
float  zCompensationFactor,
double  kappa,
float  deltaT,
float  l1Threshold,
float  volumeThresholdUm,
int  boundaryThicknessPx,
std::string const &  debugFileName = "",
iRoCS::ProgressReporter pr = NULL 
)

◆ trainDetector()

void iRoCS::trainDetector ( TrainingParameters const &  parameters,
ProgressReporter pr = NULL 
)

◆ trainEpidermisLabelling()

void iRoCS::trainEpidermisLabelling ( TrainingParameters const &  parameters,
ProgressReporter pr = NULL 
)

◆ trainLayerAssignment()

void iRoCS::trainLayerAssignment ( TrainingParameters const &  parameters,
ProgressReporter pr = NULL 
)