35 #ifndef AIMS_TALAIRACH_TALBOUNDINGBOX_POINTS_H 36 #define AIMS_TALAIRACH_TALBOUNDINGBOX_POINTS_H 64 Point3df dsize( roiIt->voxelSize() );
65 Point3df boxmax( -10000.0f, -10000.0f, -10000.0f );
66 Point3df boxmin( 10000.0f, 10000.0f, 10000.0f );
70 std::list<Point3d> points ;
71 while(roiIt->isValid() ){
74 while( maskIt->isValid() ){
75 points.push_back( maskIt->value() ) ;
83 for( std::list<Point3d>::iterator it = points.begin() ; it != points.end() ; ++it ){
84 pt =
Point3df(
float( (*it)[0] ),
float( (*it)[1] ),
float( (*it)[2] ) );
85 pt[ 0 ] *= dsize[ 0 ];
86 pt[ 1 ] *= dsize[ 1 ];
87 pt[ 2 ] *= dsize[ 2 ];
90 if ( npt[ 0 ] < boxmin[ 0 ] ) boxmin[ 0 ] = npt[ 0 ];
91 if ( npt[ 1 ] < boxmin[ 1 ] ) boxmin[ 1 ] = npt[ 1 ];
92 if ( npt[ 2 ] < boxmin[ 2 ] ) boxmin[ 2 ] = npt[ 2 ];
93 if ( npt[ 0 ] > boxmax[ 0 ] ) boxmax[ 0 ] = npt[ 0 ];
94 if ( npt[ 1 ] > boxmax[ 1 ] ) boxmax[ 1 ] = npt[ 1 ];
95 if ( npt[ 2 ] > boxmax[ 2 ] ) boxmax[ 2 ] = npt[ 2 ];
98 if ( fabs( boxmin[ 0 ] ) > fabs( boxmax[ 0 ] ) )
99 _scale[ 0 ] = 1.0f / fabs( boxmin[ 0 ] );
100 else _scale[ 0 ] = 1.0f / fabs( boxmax[ 0 ] );
102 std::cout <<
"Box Min : " << boxmin <<
"\tBox Max :" << boxmax << std::endl ;
103 _scale[ 1 ] = 1.0f / fabs( boxmax[ 1 ] );
106 _scale[ 2 ] = 1.0f / fabs( boxmin[ 2 ] );
135 std::cout <<
"Scale : " <<
_scale << std::endl ;
virtual Motion computeTransformation(const TalairachPoints &)
virtual ~TalairachBoundingBoxPoints()
void computeBox(carto::rc_ptr< aims::RoiIterator > roiIt)
Motion computeTransformationAndBox(const TalairachPoints &, carto::rc_ptr< aims::RoiIterator > roiIt)
TalairachBoundingBoxPoints()
Point3df toTalairach(const Point3df &)