X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk%2Fsrc%2FbbmaracasvisuAxeVolume.cxx;h=1711efe09d9ef16a19ee44e2c28cf78e64cdcc10;hb=0c3a32b70caed542c709c9c4f21419c3e9761800;hp=bee0a9a0792a6244fffe56ff7872b4ba8a713f37;hpb=1e114d2e85dfcbb93b774b5aa43bc96a2293c4e7;p=creaMaracasVisu.git diff --git a/bbtk/src/bbmaracasvisuAxeVolume.cxx b/bbtk/src/bbmaracasvisuAxeVolume.cxx index bee0a9a..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,64 +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]; - printf("AxeVolume::Process %d -> %f, %f, %f\n",iAxe, px,py,pz); + 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::bbUserFinalizeProcessing() { } - - //----------------------------------------------------------------- - + + //----------------------------------------------------------------- + } // EO namespace bbcreaMaracasVisu