#include <regions.h>
Public Member Functions | |
| LabeledImage3d (const Offset *off_=0, const Resolution *res_=0) | |
| void | CreateRegionsOld (Image3d< VOXEL > &, const Neighbourhood &nb=nb3D_6) |
| void | CreateRegions (Image3d< VOXEL > &img, const Neighbourhood &nb=nb3D_6) |
| void | CreateRegionsFF (Image3d< VOXEL > &, const Neighbourhood &nb=nb3D_6) |
| void | CreateForegroundRegionsFF (const Image3d< VOXEL > &, const Neighbourhood &nb=nb3D_6) |
| void | RemoveComponent (LABEL label) |
| template<class Predicate> | |
| void | MergeComponents (LABEL comp, Predicate pred) |
| void | MergeComponents (LABEL comp1, LABEL comp2) |
| template<class T> | |
| bool | Convert (Image3d< T > &img) |
| size_t | NumberOfComponents () const |
| Vector3d< int > | GetDisplacement () const |
| void | SetDisplacement (const Vector3d< int > &d) |
| size_t | get_max_label (void) const |
| size_t | FindAndSetMaxLabel () |
| LABEL | AddNewComponent (const Image3d< BINARY > &mask) |
| void | UpdateComponent (LABEL lbl, const Image3d< BINARY > &mask) |
| void | GetComponentMask (LABEL lbl, Image3d< BINARY > &mask) const |
| void | SaveImage (const char *filename, i3d::FileFormat format=IMG_ICS) const |
| void | ReadImage (const char *filename, const VOI< PIXELS > *voi=NULL, bool isregexp=0, size_t channel=-1) |
Public Attributes | |
| ComponentInfo< VOXEL >::Container | components |
Private Attributes | |
| size_t | max_label |
| Vector3d< int > | displacement |
| i3d::LabeledImage3d< LABEL, VOXEL >::LabeledImage3d | ( | const Offset * | off_ = 0, |
|
| const Resolution * | res_ = 0 | |||
| ) | [inline, explicit] |
Empty image:.
| void i3d::LabeledImage3d< LABEL, VOXEL >::CreateRegionsOld | ( | Image3d< VOXEL > & | img, | |
| const Neighbourhood & | nb = nb3D_6 | |||
| ) | [inline] |
CreateRegions performs region labeling algorithm on an input Image3d<VOXEL> image.
Size of *this LabeledImage3d will be same as of the input image. Information about regions is stored into this->components container. Neigbourhood nb is expected to be symetric. If it is not, the algorithm create symetric neigbourhood from offsets (x, y, z) of nb where (x <= 0 && y == 0 && z == 0) || (y < 0 && z == 0) || (y <= 0 && z < 0)
| void i3d::LabeledImage3d< LABEL, VOXEL >::CreateRegions | ( | Image3d< VOXEL > & | img, | |
| const Neighbourhood & | nb = nb3D_6 | |||
| ) | [inline] |
The function CreateRegions performs Rosenfeld's region labelling algortihm on an input image.
This implementation is done in more effective way than the above one and gives the same results. In contrast to CreateRegionsOld function, the output sequence of labels is in ascending order (without spaces) and starts with label 1.
| void i3d::LabeledImage3d< LABEL, VOXEL >::CreateRegionsFF | ( | Image3d< VOXEL > & | img, | |
| const Neighbourhood & | nb = nb3D_6 | |||
| ) | [inline] |
The results are same as for CreateRegions function.
Different algorithm (based on FloodFill) is used. Neighbourhood nb3D_6 is imlicitly assumed
| void i3d::LabeledImage3d< LABEL, VOXEL >::CreateForegroundRegionsFF | ( | const Image3d< VOXEL > & | img, | |
| const Neighbourhood & | nb = nb3D_6 | |||
| ) | [inline] |
If we know the background needn't be labeled we can speed up the labeling process.
The foreground is formed by nonzero pixels.
| void i3d::LabeledImage3d< LABEL, VOXEL >::RemoveComponent | ( | LABEL | label | ) | [inline] |
Remove component with given label.
If such a component does not exist, the i3d::InternalException is thrown.
| void i3d::LabeledImage3d< LABEL, VOXEL >::MergeComponents | ( | LABEL | comp, | |
| Predicate | pred | |||
| ) | [inline] |
Component comp is merged with all components for which pred holds.
| void i3d::LabeledImage3d< LABEL, VOXEL >::MergeComponents | ( | LABEL | comp1, | |
| LABEL | comp2 | |||
| ) | [inline] |
components comp1 and comp2 are merged
| bool i3d::LabeledImage3d< LABEL, VOXEL >::Convert | ( | Image3d< T > & | img | ) | [inline] |
function converts LabeledImage3d to Image3d if it is possible (i.e number of components < max value of Image3d type) List of components is lost.
Returned value indicate whether conversion was successful.
| size_t i3d::LabeledImage3d< LABEL, VOXEL >::NumberOfComponents | ( | ) | const [inline] |
return number of components
| Vector3d<int> i3d::LabeledImage3d< LABEL, VOXEL >::GetDisplacement | ( | ) | const [inline] |
get the image displacement
| void i3d::LabeledImage3d< LABEL, VOXEL >::SetDisplacement | ( | const Vector3d< int > & | d | ) | [inline] |
set the image displacement
| size_t i3d::LabeledImage3d< LABEL, VOXEL >::get_max_label | ( | void | ) | const [inline] |
| size_t i3d::LabeledImage3d< LABEL, VOXEL >::FindAndSetMaxLabel | ( | ) | [inline] |
| LABEL i3d::LabeledImage3d< LABEL, VOXEL >::AddNewComponent | ( | const Image3d< BINARY > & | mask | ) | [inline] |
Add a new component to this labelled image.
The new component is defined using mask in the given input image
| void i3d::LabeledImage3d< LABEL, VOXEL >::UpdateComponent | ( | LABEL | lbl, | |
| const Image3d< BINARY > & | mask | |||
| ) | [inline] |
Update component of the labelled image.
The new component is defined using mask in the given input image. It is assumed that the mask was created by GetComponentMask, especially that the voi of the mask is the same. Warning: function can replace labels of other components and create inconsistency. If mask grasped only background voxels it should be safe.
| void i3d::LabeledImage3d< LABEL, VOXEL >::GetComponentMask | ( | LABEL | lbl, | |
| Image3d< BINARY > & | mask | |||
| ) | const [inline] |
Create the binary mask of given componen.
| void i3d::LabeledImage3d< LABEL, VOXEL >::SaveImage | ( | const char * | filename, | |
| i3d::FileFormat | format = IMG_ICS | |||
| ) | const |
Save LabeledImage3d to a given file - creates filename.l3d containing the name of a file with the 3d data and list of components.
3d data is converted to GRAY8 or GRAY16 image (depending on the number of components) and saved in usual way. Throws an IOException on error. l3d file format: 3d image filename displacement vector number of components - n max_label components list 1..n (label voi volume border voxel_value)
| void i3d::LabeledImage3d< LABEL, VOXEL >::ReadImage | ( | const char * | filename, | |
| const VOI< PIXELS > * | voi = NULL, |
|||
| bool | isregexp = 0, |
|||
| size_t | channel = -1 | |||
| ) | [inline] |
Load LabeledImage3d from .l3d file.
size_t i3d::LabeledImage3d< LABEL, VOXEL >::max_label [private] |
Vector3d<int> i3d::LabeledImage3d< LABEL, VOXEL >::displacement [private] |
Displacement in voxels according to the original image.
We can have an indexed image for a part of the original image or even an indexed image which is not fully covered by the original image (for instance, if it has black voxels added at borders to allow fast binary functions).
| ComponentInfo<VOXEL>::Container i3d::LabeledImage3d< LABEL, VOXEL >::components |
container of ComponentInfo structures:
1.5.4