X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk%2Fsrc%2FbbmaracasvisuAxeVolume.cxx;h=1711efe09d9ef16a19ee44e2c28cf78e64cdcc10;hb=0c3a32b70caed542c709c9c4f21419c3e9761800;hp=be808e7320f44f0a02c7e36a1e18739169f0449f;hpb=4970ac35d6d4bc3cea54e8e6033b34c01c3103fb;p=creaMaracasVisu.git diff --git a/bbtk/src/bbmaracasvisuAxeVolume.cxx b/bbtk/src/bbmaracasvisuAxeVolume.cxx index be808e7..1711efe 100644 --- a/bbtk/src/bbmaracasvisuAxeVolume.cxx +++ b/bbtk/src/bbmaracasvisuAxeVolume.cxx @@ -7,6 +7,9 @@ BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,AxeVolume) BBTK_BLACK_BOX_IMPLEMENTATION(AxeVolume,bbtk::AtomicBlackBox); void AxeVolume::Process() { + + printf("EED AxeVolume::Process start \n"); + if ( mimage!=NULL ) { mimage->Delete(); @@ -18,12 +21,20 @@ void AxeVolume::Process() int sizeY=ext[3]-ext[2]; int sizeZ=ext[5]-ext[4]; - mimage = vtkImageData::New(); + double spc[3]; + bbGetInputIn()->GetSpacing(spc); + double invSpc[3]; + invSpc[0] = 1/spc[0]; + invSpc[1] = 1/spc[1]; + invSpc[2] = 1/spc[2]; + + mimage = vtkImageData::New(); mimage->SetDimensions(sizeX,sizeY,sizeZ); mimage->SetOrigin(0,0,0); mimage->SetExtent( 0 , sizeX-1 , 0 , sizeY-1 , 0, sizeZ-1 ); mimage->SetWholeExtent( 0 , sizeX-1 , 0 , sizeY-1 , 0, sizeZ-1 ); mimage->SetScalarTypeToUnsignedShort(); + mimage->SetSpacing(spc); mimage->AllocateScalars(); @@ -48,59 +59,77 @@ void AxeVolume::Process() { if (sizeLstPointR=1) + { + r = bbGetInputlstPointR()[ bbGetInputlstPointR().size()-1 ] * invSpc[0]; + } else { + r = 1; + } } else { - r = bbGetInputlstPointR()[ iAxe ]; + r = bbGetInputlstPointR()[ iAxe ]* invSpc[0]; } - px = bbGetInputlstPointX()[iAxe]; - py = bbGetInputlstPointY()[iAxe]; - pz = bbGetInputlstPointZ()[iAxe]; + px = bbGetInputlstPointX()[iAxe] * invSpc[0]; + py = bbGetInputlstPointY()[iAxe] * invSpc[1]; + pz = bbGetInputlstPointZ()[iAxe] * invSpc[2]; px1 = px - r; py1 = py - r; pz1 = pz - r; px2 = px + r; py2 = py + r; pz2 = pz + r; + rr=r*r; - for ( i=px1 ; i<=px2 ; i++ ) + for ( i=px1 ; i<=px2 ; i++ ) { - for ( j=py1 ; j=0) && (i=0) && (j=0) && (kGetScalarPointer (i, j, k); + if (*p==0) { - p = (unsigned short*)mimage->GetScalarPointer (i, j, k); - *p=255; - } + rz = k - pz; + rz = rz*rz; + if ( rx + ry + rz <= rr ) + { + *p=255; + } + } // *p==0 } // inside point } //for k } //for j } //for i } // for iAxe - bbSetOutputOut( mimage ); + bbSetOutputOut( mimage ); + + printf("EED AxeVolume::Process end \n"); + } + //----------------------------------------------------------------- + void AxeVolume::bbUserSetDefaultValues() + { + mimage=NULL; + } + //----------------------------------------------------------------- + void AxeVolume::bbUserInitializeProcessing() + { + } -void AxeVolume::bbUserConstructor() -{ - mimage = NULL; -} -void AxeVolume::bbUserCopyConstructor() -{ + //----------------------------------------------------------------- + void AxeVolume::bbUserFinalizeProcessing() + { + } -} -void AxeVolume::bbUserDestructor() -{ + //----------------------------------------------------------------- -} } // EO namespace bbcreaMaracasVisu