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