From: Eduardo DAVILA Date: Mon, 22 Jul 2019 14:35:14 +0000 (+0200) Subject: #3281 creaVtk Feature New Normal - FindAxisEED X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=35d972b73bc01e8c2bf9d09fda1470c22f82b4d2;p=creaVtk.git #3281 creaVtk Feature New Normal - FindAxisEED --- diff --git a/bbtk_creaVtk_PKG/bbs/boxes/FindAxisEED.bbg b/bbtk_creaVtk_PKG/bbs/boxes/FindAxisEED.bbg new file mode 100644 index 0000000..943080a --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/boxes/FindAxisEED.bbg @@ -0,0 +1,203 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/FindAxisEED.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:TRUE +COMPLEXBOXNAME:FindAxisEED +PACKAGENAME:creaVtk +COMPLEXOUTPUTS:7 +COMPLEX_PORT +imageOutTmp +-86.519730:-205.275397:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +imageOutDistanceMap +67.799086:-204.784844:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +axisLstX +-12.475387:-203.066620:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +axisLstY +22.071112:-204.330508:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +axisLstZ +39.089406:-202.265702:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +finalPointDistanceMap +-49.262810:-205.322083:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +outLengthPixelsDistanceMap +-28.377706:-204.106778:-900.000000 +FIN_COMPLEX_PORT +COMPLEXINPUTS:6 +COMPLEX_PORT +stdDev +-28.447633:50.012145:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +averageRadius +-159.307290:53.037280:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +imageMask +-106.635422:53.024269:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +slopeDistanceMap +175.140002:49.789248:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +Point2DistanceMap +124.204556:49.878387:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +Point1DistanceMap +77.729781:51.447056:-900.000000 +FIN_COMPLEX_PORT +BOXES:7 +BOX +vtk:ImageGaussianSmooth:Box15 +ISEXEC:FALSE +-86.019292:-54.567937:-900.000000 +-37.119292:-64.567937:-900.000000 +FIN_BOX +BOX +itk:BinaryThresholdImageFilter:Box16 +ISEXEC:FALSE +-69.915319:-77.677020:-900.000000 +-17.740319:-87.677020:-900.000000 +PORT +InsideValue:"255" +PORT +LowerThreshold:"250" +PORT +OutsideValue:"0" +PORT +UpperThreshold:"1000" +FIN_BOX +BOX +vtk:ImageGaussianSmooth:Box17 +ISEXEC:FALSE +-152.015620:-95.824068:-900.000000 +-103.115620:-105.824068:-900.000000 +PORT +StdDevX:"10" +PORT +StdDevY:"10" +PORT +StdDevZ:"3" +FIN_BOX +BOX +creaVtk:ApplyMask:Box20 +ISEXEC:FALSE +-32.976315:-121.753349:-900.000000 +4.248685:-131.753349:-900.000000 +FIN_BOX +BOX +creaVtk:DistanceMap:Box21 +ISEXEC:FALSE +-13.775824:-151.205153:-900.000000 +25.424176:-161.205153:-900.000000 +PORT +Point1:"107 103 382" +FIN_BOX +BOX +std:ConcatStrings:Box30 +ISEXEC:FALSE +-172.788476:-49.034634:-900.000000 +-133.063476:-59.034634:-900.000000 +PORT +In1:"10" +FIN_BOX +BOX +std:ConcatStrings:Box31 +ISEXEC:FALSE +-61.001950:-12.733523:-900.000000 +-21.276950:-22.733523:-900.000000 +PORT +In1:"10" +FIN_BOX +CONNECTIONS:24 +CONNECTION +Box15:Out:Box16:In +NumberOfControlPoints:0 +CONNECTION +Box16:Out:Box17:In +NumberOfControlPoints:0 +CONNECTION +Box17:Out:Box20:Image +NumberOfControlPoints:0 +CONNECTION +Box16:Out:Box20:Mask +NumberOfControlPoints:0 +CONNECTION +Box20:Out:Box21:In +NumberOfControlPoints:0 +CONNECTION +Box30:Out:Box17:StdDevX +NumberOfControlPoints:0 +CONNECTION +Box30:Out:Box17:StdDevY +NumberOfControlPoints:0 +CONNECTION +Box30:Out:Box21:AverageRadius +NumberOfControlPoints:0 +CONNECTION +Box31:Out:Box15:StdDevX +NumberOfControlPoints:0 +CONNECTION +Box31:Out:Box15:StdDevY +NumberOfControlPoints:0 +CONNECTION +Box31:Out:Box15:StdDevZ +NumberOfControlPoints:0 +CONNECTION +stdDev:stdDev:Box31:In1 +NumberOfControlPoints:0 +CONNECTION +averageRadius:averageRadius:Box30:In1 +NumberOfControlPoints:0 +CONNECTION +imageMask:imageMask:Box15:In +NumberOfControlPoints:0 +CONNECTION +slopeDistanceMap:slopeDistanceMap:Box21:Slope +NumberOfControlPoints:0 +CONNECTION +Box16:Out:imageOutTmp:imageOutTmp +NumberOfControlPoints:0 +CONNECTION +Box21:Out:imageOutDistanceMap:imageOutDistanceMap +NumberOfControlPoints:0 +CONNECTION +Box21:LstPathXOut:axisLstX:axisLstX +NumberOfControlPoints:0 +CONNECTION +Box21:LstPathYOut:axisLstY:axisLstY +NumberOfControlPoints:0 +CONNECTION +Box21:LstPathZOut:axisLstZ:axisLstZ +NumberOfControlPoints:0 +CONNECTION +Box21:FinalPoint:finalPointDistanceMap:finalPointDistanceMap +NumberOfControlPoints:0 +CONNECTION +Point2DistanceMap:Point2DistanceMap:Box21:Point2 +NumberOfControlPoints:0 +CONNECTION +Point1DistanceMap:Point1DistanceMap:Box21:Point1 +NumberOfControlPoints:0 +CONNECTION +Box21:LengthPixels:outLengthPixelsDistanceMap:outLengthPixelsDistanceMap +NumberOfControlPoints:0 +APP_END diff --git a/bbtk_creaVtk_PKG/bbs/boxes/FindAxisEED.bbs b/bbtk_creaVtk_PKG/bbs/boxes/FindAxisEED.bbs new file mode 100644 index 0000000..84424b2 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/boxes/FindAxisEED.bbs @@ -0,0 +1,75 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box) +# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/FindAxisEED.bbs +# ---------------------------------- + +include std +include itkvtk +include vtk +include itk +include creaVtk +include std + +define FindAxisEED creaVtk + +author "Author ??" +description "Description ??" + +category "" + +new vtk:ImageGaussianSmooth Box15 + +new itk:BinaryThresholdImageFilter Box16 + set Box16.InsideValue "255" + set Box16.LowerThreshold "250" + set Box16.OutsideValue "0" + set Box16.UpperThreshold "1000" + +new vtk:ImageGaussianSmooth Box17 + set Box17.StdDevX "10" + set Box17.StdDevY "10" + set Box17.StdDevZ "3" + +new creaVtk:ApplyMask Box20 + +new creaVtk:DistanceMap Box21 + set Box21.Point1 "107 103 382" + +new std:ConcatStrings Box30 + set Box30.In1 "10" + +new std:ConcatStrings Box31 + set Box31.In1 "10" + + +connect Box15.Out Box16.In +connect Box16.Out Box17.In +connect Box17.Out Box20.Image +connect Box16.Out Box20.Mask +connect Box20.Out Box21.In +connect Box30.Out Box17.StdDevX +connect Box30.Out Box17.StdDevY +connect Box30.Out Box21.AverageRadius +connect Box31.Out Box15.StdDevX +connect Box31.Out Box15.StdDevY +connect Box31.Out Box15.StdDevZ + +# Complex input ports +input stdDev Box31.In1 " " +input averageRadius Box30.In1 " " +input imageMask Box15.In " " +input slopeDistanceMap Box21.Slope " " +input Point2DistanceMap Box21.Point2 " " +input Point1DistanceMap Box21.Point1 " " + +# Complex output ports +output imageOutTmp Box16.Out " " +output imageOutDistanceMap Box21.Out " " +output axisLstX Box21.LstPathXOut " " +output axisLstY Box21.LstPathYOut " " +output axisLstZ Box21.LstPathZOut " " +output finalPointDistanceMap Box21.FinalPoint " " +output outLengthPixelsDistanceMap Box21.LengthPixels " " + + +endefine diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkDistanceMap.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkDistanceMap.cxx index 787c1ef..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,16 +80,11 @@ void DistanceMap::Process() 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) { @@ -91,13 +92,18 @@ printf("EED Warnning! DistanceMap::Process Clean Ponter Image......\n"); 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]; @@ -110,7 +116,12 @@ printf("EED Warnning! DistanceMap::Process Clean Ponter Image......\n"); 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 @@ -173,7 +184,6 @@ printf("EED Warnning! DistanceMap::Process Clean Ponter Image......\n"); int pxOutBack; int pyOutBack; int pzOutBack; - int length=0; while (ok==true) { ok2=false; @@ -185,7 +195,8 @@ printf("EED Warnning! DistanceMap::Process Clean Ponter Image......\n"); { 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); BBTK_DECLARE_INPUT(Point2, std::vector); BBTK_DECLARE_OUTPUT(Out,vtkImageData*); - BBTK_DECLARE_OUTPUT(Length, int ); + BBTK_DECLARE_OUTPUT(LengthPixels, int ); BBTK_DECLARE_OUTPUT(FinalPoint,std::vector); BBTK_DECLARE_OUTPUT(LstPathXOut,std::vector); BBTK_DECLARE_OUTPUT(LstPathYOut,std::vector); @@ -52,11 +53,12 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(DistanceMap,bbtk::AtomicBlackBox); BBTK_INPUT(DistanceMap,In,"Input image",vtkImageData*,""); BBTK_INPUT(DistanceMap,Slope,"(default 10) Slope",double,""); + BBTK_INPUT(DistanceMap,AverageRadius,"(default 10) Average Radius of the tube",double,""); BBTK_INPUT(DistanceMap,Point1,"Start point",std::vector,""); BBTK_INPUT(DistanceMap,Point2,"End point (There is no guarantee of reaching this point.)",std::vector,""); BBTK_OUTPUT(DistanceMap,Out,"Output image",vtkImageData*,""); - BBTK_OUTPUT(DistanceMap,Length,"Path Length",int,""); + BBTK_OUTPUT(DistanceMap,LengthPixels,"Path Length",int,""); BBTK_OUTPUT(DistanceMap,FinalPoint,"Final Point",std::vector,""); BBTK_OUTPUT(DistanceMap,LstPathXOut,"Vector path X",std::vector,""); BBTK_OUTPUT(DistanceMap,LstPathYOut,"Vector path Y",std::vector,"");