35 #ifndef AIMS_ROI_ROISTAT_H 36 #define AIMS_ROI_ROISTAT_H 65 std::vector<float> tacByStructName(std::string s);
67 void applyGtm(
RoiGtm& rgtm );
68 void streamout(
char *out=NULL);
84 std::set< Vertex*> currentRoiStatVert;
86 std::vector< int > roi_st, roi_dt;
89 roi.setProperty(
"last_image_stated", image);
90 setProperty(
"last_image_stated", image);
93 std::vector< int > bbmaxTO;
94 std::vector< float > vsTO;
95 roi.getProperty(
"boundingbox_max", bbmaxTO);
96 roi.getProperty(
"voxel_size", vsTO );
99 std::vector< int > i_st, i_dt;
102 for(
int i= 0; i < image.
dimT(); i++) {
126 const std::list<BaseTree*> & metaRoiList = _roiSel->children();
131 for (
int t = 0; t < image.
dimT(); ++t)
136 getProperty(
"start_time", roi_st );
137 roi_st.push_back( i_st[ t ] );
138 setProperty(
"start_time",roi_st);
139 getProperty(
"duration_time", roi_dt );
140 roi_dt.push_back( i_dt[ t ] );
141 setProperty(
"duration_time",roi_dt);
145 tmpin(x, y, z) = image(x, y, z, t);
147 _interpolator->setRef( tmpin );
149 bbmaxTO[0]+1, bbmaxTO[1]+1, bbmaxTO[2]+1,
150 Point3df( vsTO[0],vsTO[1],vsTO[2] ) );
154 metaRoi != metaRoiList.end();
157 std::map<int,carto::rc_ptr<BucketMap<Void> > > corresBuckets;
158 std::map<int,carto::rc_ptr<BucketMap<Void> > >
::iterator 159 ib, eb = corresBuckets.end();
160 Tree* tmpTree =
dynamic_cast< Tree *
>( *metaRoi );
161 std::string surname;(*tmpTree).getProperty(
"surname", surname);
164 const std::list<BaseTree*> & metaRoiChild = (*metaRoi)->
children();
166 metaRoiContent != metaRoiChild.end();
169 tmpTree =
dynamic_cast< Tree *
>( *metaRoiContent );
170 std::string tmp;(*tmpTree).getProperty(
"nomenName", tmp);
174 for( std::set< Vertex* >::const_iterator j = roisv.begin();
175 j != roisv.end(); ++j )
177 int l; (*j)->getProperty(
"roi_label", l);
178 if( (*j)->getProperty(
"aims_roi", bck ) )
179 corresBuckets[ l ] = bck;
181 std::cout <<
"Bucket not found. Label = " << l << std::endl ;
185 if (corresBuckets.size() == 0)
continue;
189 currentRoiStatVert = getVerticesWith(
"surname", surname);
191 ASSERT (currentRoiStatVert.size() < 2 );
193 if (currentRoiStatVert.size() == 0)
196 v->setProperty(
"surname", surname);
198 else v = *( currentRoiStatVert.begin() );
206 for( ib=corresBuckets.begin(); ib!=eb; ++ib )
213 for( ibk=bck->begin()->second.begin(),
214 ebk=bck->begin()->second.end(); ibk!=ebk; ++ibk )
216 float pixel = tmpout( ibk->first );
219 min = (min > pixel) ? pixel : min;
220 max = (max < pixel) ? pixel : max;
227 std=(float)sqrt( (
double)(std-
square(mean)*pn2) / (
float)(pn2-1) );
229 v->setProperty(
"voxel_number", pn2 );
230 std::vector< float > tac, sac, mac, Mac;
231 v->getProperty(
"mean_ac", tac);
232 tac.push_back( mean );
233 v->setProperty(
"mean_ac", tac);
234 v->getProperty(
"std_ac", sac);
235 sac.push_back( std );
236 v->setProperty(
"std_ac", sac);
237 v->getProperty(
"min_ac", mac);
238 mac.push_back( min );
239 v->setProperty(
"min_ac", mac);
240 v->getProperty(
"max_ac", Mac);
241 Mac.push_back( max );
242 v->setProperty(
"max_ac", Mac);
246 setProperty(
"voxel_volume",vsTO[0]*vsTO[1]*vsTO[2]);
float min(float x, float y)
float max(float x, float y)
virtual bool getProperty(const std::string &, Object &) const
#define ForEach3d(thing, x, y, z)
std::list< BaseTree *>::const_iterator const_iterator
std::set< Vertex *> VertByNameAndDescendantName(std::string &name)
Resampler< float > * _interpolator
const std::list< BaseTree *> & children() const
const aims::Header * header() const
void setSizeXYZT(float sizex=1.0f, float sizey=1.0f, float sizez=1.0f, float sizet=1.0f)
void populate(AimsData< T > &image, AimsRoi &roi, const Motion &motion)
virtual bool hasProperty(const std::string &) const