21 #ifndef _MIRTKPROBABILISTICATLAS_H 23 #define _MIRTKPROBABILISTICATLAS_H 25 #include "mirtk/Object.h" 27 #include "mirtk/Image.h" 41 class ProbabilisticAtlas :
public Object
43 mirtkObjectMacro(ProbabilisticAtlas);
46 vector<RealImage> _images;
49 vector<RealPixel *> _pointers;
52 int _number_of_voxels;
55 int _number_of_tissues;
58 RealImage _segmentation;
67 void SwapImages(
int,
int);
70 void AddImage(RealImage image);
79 RealPixel GetValue(
unsigned int channel);
82 RealPixel GetValue(
int x,
int y,
int z,
unsigned int tissue);
85 void SetValue(
unsigned int tissue, RealPixel value);
88 void SetValue(
int x,
int y,
int z,
unsigned int tissue, RealPixel value);
91 int GetNumberOfVoxels();
94 void AddProbabilityMaps(
int, RealImage **atlas);
100 void NormalizeAtlas();
103 void NormalizeAtlas(RealImage background);
106 int GetNumberOfTissues();
109 void Write(
int,
const char *);
112 RealImage ComputeHardSegmentation();
115 void ExtractLabel(
int label, RealImage& image);
118 void WriteHardSegmentation(
const char *filename);
120 RealImage GetImage(
int);
124 inline void ProbabilisticAtlas::First()
127 for (i=0; i<_pointers.size(); i++) _pointers[i] = _images[i].GetPointerToVoxels();
130 inline void ProbabilisticAtlas::Next()
133 for (i=0; i<_pointers.size(); i++) _pointers[i]++;
136 inline RealPixel ProbabilisticAtlas::GetValue(
unsigned int channel)
138 if (channel < _images.size())
return *_pointers[channel];
140 std::cerr <<
"Channel identificator " << channel <<
" out of range." <<std::endl;
145 inline RealPixel ProbabilisticAtlas::GetValue(
int x,
int y,
int z,
unsigned int channel)
147 if (channel < _images.size())
return _images[channel].
Get(x,y,z);
149 std::cerr <<
"Channel identificator " << channel <<
" out of range." <<std::endl;
154 inline void ProbabilisticAtlas::SetValue(
unsigned int channel, RealPixel value)
156 if (channel < _images.size()) *_pointers[channel] = value;
158 std::cerr <<
"Channel identificator " << channel <<
" out of range." <<std::endl;
163 inline void ProbabilisticAtlas::SetValue(
int x,
int y,
int z,
unsigned int channel, RealPixel value)
165 if (channel < _images.size()) _images[channel].Put( x, y, z, value);
167 std::cerr <<
"Channel identificator " << channel <<
" out of range." <<std::endl;
172 inline int ProbabilisticAtlas::GetNumberOfVoxels()
174 return _number_of_voxels;
177 inline int ProbabilisticAtlas::GetNumberOfTissues()
179 return _number_of_tissues;
string Get(const ParameterList ¶ms, string name)
Get parameter value from parameters list.