X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk_creaVtk_PKG%2Fsrc%2FbbcreaVtkDistanceMap.cxx;h=fae5840f0958a5319805039e279f9dd58e35c5c2;hb=refs%2Fheads%2Fvtk8itk4wx3-mingw64;hp=1c50d0f3405c1a0fd028e19a3521dbcfa7821c31;hpb=dce9dbecb71a7f84a827c550976eeec0eee2c6a8;p=creaVtk.git diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkDistanceMap.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkDistanceMap.cxx index 1c50d0f..fae5840 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkDistanceMap.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkDistanceMap.cxx @@ -3,6 +3,9 @@ //===== #include "bbcreaVtkDistanceMap.h" #include "bbcreaVtkPackage.h" + +#include "creaVtk_MACROS.h" + namespace bbcreaVtk { @@ -29,14 +32,17 @@ void DistanceMap::Process() if ( (bbGetInputIn()!=NULL) && (bbGetInputPoint1().size()==3) ) { - int ext[6]; - int dim[3]; + int ext[6]; + int dim[3]; + long int dimX,dimXY; double spc[3]; bbGetInputIn()->GetSpacing(spc); bbGetInputIn()->GetExtent(ext); - dim[0]= ext[1]-ext[0]+1; - dim[1]= ext[3]-ext[2]+1; - dim[2]= ext[5]-ext[4]+1; + dim[0] = ext[1]-ext[0]+1; + dim[1] = ext[3]-ext[2]+1; + dim[2] = ext[5]-ext[4]+1; + dimX = dim[0]; + dimXY = dim[0]*dim[1]; if (imageoutput!=NULL) { imageoutput->Delete(); @@ -74,6 +80,11 @@ void DistanceMap::Process() double depth=0; int px,py,pz; int pxOut,pyOut,pzOut; + double tmpValue; + + + DEF_POINTER_IMAGE_VTK_CREA(vIn,ssIn,pIn,stIn,bbGetInputIn()) + DEF_POINTER_IMAGE_VTK_CREA(vOut,ssOut,pOut,stOut,imageoutput) while (lst1X.size()>0) { @@ -81,13 +92,18 @@ void DistanceMap::Process() size=lst1X.size(); for (i=0;iGetScalarComponentAsDouble( lst1X[i], lst1Y[i], lst1Z[i], 0); + GETVALUE2_VTK_CREA(glIn,pIn,stIn, lst1X[i] + lst1Y[i]*dimX + lst1Z[i]*dimXY ) + +// glIn=bbGetInputIn()->GetScalarComponentAsDouble( lst1X[i], lst1Y[i], lst1Z[i], 0); if (glIn!=0) { - glOut=imageoutput->GetScalarComponentAsDouble( lst1X[i], lst1Y[i], lst1Z[i], 0); + GETVALUE2_VTK_CREA(glOut,pOut,stOut, lst1X[i] + lst1Y[i]*dimX + lst1Z[i]*dimXY ) +// glOut=imageoutput->GetScalarComponentAsDouble( lst1X[i], lst1Y[i], lst1Z[i], 0); if (glOut==0) { - imageoutput->SetScalarComponentFromDouble( lst1X[i], lst1Y[i], lst1Z[i], 0, depth+(255-glIn)); + tmpValue = depth + (255-glIn)*bbGetInputAverageRadius()*2; + SETVALUE2_VTK_CREA(tmpValue,pOut,stOut, lst1X[i] + lst1Y[i]*dimX + lst1Z[i]*dimXY ) +// imageoutput->SetScalarComponentFromDouble( lst1X[i], lst1Y[i], lst1Z[i], 0, depth+(255-glIn)*bbGetInputAverageRadius()*2); pxOut=lst1X[i]; pyOut=lst1Y[i]; pzOut=lst1Z[i]; @@ -100,7 +116,12 @@ void DistanceMap::Process() if (!( (px==lst1X[i]) && (py==lst1Y[i]) && (pz==lst1Z[i]) )) { if ((px>=0) && (px=0) && (py=0) && (pzGetScalarComponentAsDouble( px,py,pz , 0); } else { glOut=-1; } + { + GETVALUE2_VTK_CREA(glOut,pOut,stOut, px + py*dimX + pz*dimXY ) +// glOut=imageoutput->GetScalarComponentAsDouble( px,py,pz , 0); + } else { + glOut=-1; + } // if px py pz inside the image if (glOut==0) { lst2X.push_back(px); lst2Y.push_back( py ); lst2Z.push_back( pz ); } } // if } // for kk @@ -174,7 +195,8 @@ void DistanceMap::Process() { if ((px>=0) && (px=0) && (py=0) && (pzGetScalarComponentAsDouble( px,py,pz , 0); + GETVALUE2_VTK_CREA(glOut,pOut,stOut, px + py*dimX + pz*dimXY ) +// glOut=imageoutput->GetScalarComponentAsDouble( px,py,pz , 0); if ( (glOut