//=====
#include "bbcreaVtkDistanceMap.h"
#include "bbcreaVtkPackage.h"
+
+#include "creaVtk_MACROS.h"
+
namespace bbcreaVtk
{
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();
double depth=0;
int px,py,pz;
int pxOut,pyOut,pzOut;
+ double tmpValue;
-printf("EED Warnning! DistanceMap::Process Clean Ponter Image......\n");
-printf("EED Warnning! DistanceMap::Process Clean Ponter Image......\n");
-printf("EED Warnning! DistanceMap::Process Clean Ponter Image......\n");
-printf("EED Warnning! DistanceMap::Process Clean Ponter Image......\n");
-printf("EED Warnning! DistanceMap::Process Clean Ponter Image......\n");
-printf("EED Warnning! DistanceMap::Process Clean Ponter Image......\n");
-printf("EED Warnning! DistanceMap::Process Clean Ponter Image......\n");
-printf("EED Warnning! DistanceMap::Process Clean Ponter Image......\n");
+ DEF_POINTER_IMAGE_VTK_CREA(vIn,ssIn,pIn,stIn,bbGetInputIn())
+ DEF_POINTER_IMAGE_VTK_CREA(vOut,ssOut,pOut,stOut,imageoutput)
while (lst1X.size()>0)
{
size=lst1X.size();
for (i=0;i<size;i++)
{
- glIn=bbGetInputIn()->GetScalarComponentAsDouble( 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];
if (!( (px==lst1X[i]) && (py==lst1Y[i]) && (pz==lst1Z[i]) ))
{
if ((px>=0) && (px<dim[0]) && (py>=0) && (py<dim[1]) && (pz>=0) && (pz<dim[2]) )
- { glOut=imageoutput->GetScalarComponentAsDouble( 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
int pxOutBack;
int pyOutBack;
int pzOutBack;
- int length=0;
while (ok==true)
{
ok2=false;
{
if ((px>=0) && (px<dim[0]) && (py>=0) && (py<dim[1]) && (pz>=0) && (pz<dim[2]) )
{
- glOut=imageoutput->GetScalarComponentAsDouble( px,py,pz , 0);
+ GETVALUE2_VTK_CREA(glOut,pOut,stOut, px + py*dimX + pz*dimXY )
+// glOut=imageoutput->GetScalarComponentAsDouble( px,py,pz , 0);
if ( (glOut<min) && (glOut!=0) )
{
min = glOut;
lstPathXOut.push_back( pxOut );
lstPathYOut.push_back( pyOut );
lstPathZOut.push_back( pzOut );
- length++;
} else {
ok=false;
}
bbSetOutputOut( imageoutput );
bbSetOutputFinalPoint( lstPointOut );
- bbSetOutputLength( length );
+ bbSetOutputLengthPixels( lstPathXOut.size() );
+
+ // invert list of points
+ size=lstPathXOut.size();
+ long int size2=size/2;
+ int tmp;
+ for (i=0; i<size2;i++)
+ {
+ tmp= lstPathXOut[i]; lstPathXOut[i]=lstPathXOut[size-1-i]; lstPathXOut[size-1-i]=tmp;
+ tmp= lstPathYOut[i]; lstPathYOut[i]=lstPathYOut[size-1-i]; lstPathYOut[size-1-i]=tmp;
+ tmp= lstPathZOut[i]; lstPathZOut[i]=lstPathZOut[size-1-i]; lstPathZOut[size-1-i]=tmp;
+ } // for invert list
+
bbSetOutputLstPathXOut( lstPathXOut );
bbSetOutputLstPathYOut( lstPathYOut );
bbSetOutputLstPathZOut( lstPathZOut );
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
// Here we initialize the input 'In' to 0
bbSetInputIn(NULL);
+ bbSetInputAverageRadius(10);
bbSetInputSlope(10);
imageoutput=NULL;