230 { Interface::IsA <T,Interface::Voxel>();  }
 
  233 template <
typename T>
 
  239         out.
SetPosition(this->GetPosition() + this->GetSpacing().cwiseProduct(begin.cast<
float>()) );
 
  241         for(uint x = 0; x<dim(0); ++x )
 
  242             for(uint y = 0; y<dim(1); ++y )
 
  243                 for(uint z = 0; z<dim(2); ++z )
 
  246                     out[id] = this->At(begin + 
id);
 
  251 template <
typename T>
 
  256     return this->clipImage(v1,v2);
 
  259 template <
typename T>
 
  264     for(uint i=0; i< this->m_Data.size(); ++i) {
 
  265         if( this->GetValue(i) >= density ) {
 
  267             v1 = v1.array().min(
id.array());
 
  268             v2 = v2.array().max(
id.array());
 
  271     return this->clipImage(v1,v2);
 
  274 template <
typename T>
 
  279     for(uint i=0; i< this->m_Data.size(); ++i) {
 
  280         if( this->GetValue(i) >= densityMin && this->GetValue(i) <= densityMax) {
 
  282             v1 = v1.array().min(
id.array());
 
  283             v2 = v2.array().max(
id.array());
 
  286     return this->clipImage(v1,v2);
 
  289 template <
typename T>
 
  301     for(
int ix=voxB(0); ix<voxE(0); ix++)
 
  302         for(
int iy=voxB(1); iy<voxE(1); iy++)
 
  303             for(
int iz=voxB(2); iz<voxE(2); iz++){
 
  311 template <
typename T>
 
  314     std::cout << 
"VoxImage: maskImage, fixing voxels under threshold " << threshold;
 
  316         std::cout << 
" at value " << belowValue;
 
  318         std::cout << 
" at -value";
 
  319     std::cout << 
", voxels above threshold at value ";
 
  321         std::cout << aboveValue;
 
  323         std::cout << 
"found";
 
  330     for(uint i=0; i< this->m_Data.size(); ++i) {
 
  332         if( this->GetValue(i) >= 0 ){
 
  334             if( this->GetValue(i) <= threshold*1.E-6 ){
 
  338                     out.
SetValue(i,-1.*belowValue*1.E-6);}
 
  340                     out.
SetValue(i,-1.*this->GetValue(i));
 
  354 template <
typename T>
 
  357     std::cout << 
"VoxImage: fixing voxels with value " << threshold << std::endl;
 
  363     for(uint i=0; i< this->m_Data.size(); ++i) {
 
  365         if( fabs(this->GetValue(i) - threshold*1.E-6) < tolerance* 1.E-6 ){
 
  368                 out.
SetValue(i,-1.*this->GetValue(i));
 
  374 template <
typename T>
 
  377     std::cout << 
"VoxImage: set abs voxels value " << std::endl;
 
  383     for(uint i=0; i< this->m_Data.size(); ++i)
 
  384         out.
SetValue(i,fabs(this->GetValue(i)));
 
  389 template <
typename T>
 
  401     for(
int ix=voxB(0); ix<voxE(0); ix++)
 
  402         for(
int iy=voxB(1); iy<voxE(1); iy++)
 
  403             for(
int iz=voxB(2); iz<voxE(2); iz++){
 
  406                 if( fabs(this->GetValue(ID) - threshold*1.E-6) < tolerance*1.E-6 ){
 
  407                     out.
SetValue(ID,-1.*this->GetValue(ID));
 
  414 template <
typename T>
 
  426     for(
int ix=voxB(0); ix<voxE(0); ix++)
 
  427         for(
int iy=voxB(1); iy<voxE(1); iy++)
 
  428             for(
int iz=voxB(2); iz<voxE(2); iz++){
 
  431                 out.
SetValue(ID,-1.*this->GetValue(ID));
 
  437 template <
typename T>
 
  445     HPoint3f  Bcoll = this->GetPosition().homogeneous();
 
  448     for(
int ix=0; ix<dim(0); ix++)
 
  449         for(
int iy=0; iy<dim(1); iy++)
 
  450             for(
int iz=0; iz<dim(2); iz++){
 
  457                 HPoint3f Evox = Bvox + this->GetSpacing().homogeneous();
 
  458                 HPoint3f V = Bvox + 0.5*(this->GetSpacing().homogeneous());
 
  467                 float dist = fabs( (x2-x1)*(y1-y0) - ((x1-x0)*(y2-y1))) / sqrt( (x2-x1)*(x2-x1)+((y2-y1)*(y2-y1)));
 
  468                 float distSign = (x2-x1)*(y1-y0) - ((x1-x0)*(y2-y1));
 
  471                 if(dist < tolerance){
 
  476                     out.
SetValue(ID,this->GetValue(ID));
 
  478                 if((distSign>0 && aboveAir) || (distSign<0 && !aboveAir)  )
 
  488     std::fill( m_Data.begin(), m_Data.end(), t ); 
 
void SetValue(const Vector3i &id, Scalarf value)
Definition: VoxImage.h:123
Definition: ContainerBox.h:38
Eigen::Vector3i Vector3i
Definition: Dense.h:134
VoxImage< T > maskImage(const HPoint3f begin, const HPoint3f end, float value) const 
Definition: VoxImage.h:290
Eigen::Vector3f Vector3f
Definition: Dense.h:139
VoxImage< T > fixVoxels(const float threshold, float tolerance) const 
Definition: VoxImage.h:355
VoxImage< T > fixVoxelsAroundPlane(const float threshold, float tolerance, const HPoint3f begin, const HPoint3f end, bool aboveAir) const 
Definition: VoxImage.h:438
VoxImage< T > Abs() const 
Definition: VoxImage.h:375
void SetDims(const Vector3i &size)
Definition: VoxImage.h:130
_HPoint3f< true > HPoint3f
Definition: Dense.h:219
VoxImage< T > clipImage(const Vector3i begin, const Vector3i end) const 
Definition: VoxImage.h:234
void InitVoxels(T t)
Definition: VoxImage.h:486
Definition: VoxImage.h:93