#---------------------------------------------------------------------------
# Package dependencies
+
+IF(${BBTK_PACKAGE_NAME}_USE_OPENMP)
+ SET(USE_OPENMP ON CACHE BOOL "Use OPENMP" FORCE)
+ SET(${BBTK_PACKAGE_NAME}_LIBS
+ ${${BBTK_PACKAGE_NAME}_LIBS}
+ ${OpenMP_libomp_LIBRARY_crea}
+ )
+ LINK_DIRECTORIES( /opt/local/lib/libomp )
+ENDIF(${BBTK_PACKAGE_NAME}_USE_VTK)
+
IF(${BBTK_PACKAGE_NAME}_USE_VTK)
SET(USE_VTK ON CACHE BOOL "Use VTK" FORCE)
SET(${BBTK_PACKAGE_NAME}_LIBS
# SET(${BBTK_PACKAGE_NAME}_USE_GDCM2 ON)
# SET(${BBTK_PACKAGE_NAME}_USE_GSMIS ON)
# SET(${BBTK_PACKAGE_NAME}_USE_WXWIDGETS ON)
+SET(${BBTK_PACKAGE_NAME}_USE_OPENMP ON)
+
#===========================================================================
#===========================================================================
../std/src
# The path to the build tree folder is needed to find bbstd_EXPORT.h
${PROJECT_BINARY_DIR}/packages/std/src
+
+ /opt/local/include/libomp
+
)
#===========================================================================
# - automatically handled libraries or packages : wx, vtk... (see above)
# - the dirs automatically set by other libraries found by FIND_PACKAGE
../itk/src
+ /opt/local/include/libomp
+
)
#===========================================================================
} // if In0.size and k1.size
} // Type 15
+ if (bbGetInputType()==16) // 16 switch In0 and In1 (k1=1 nothing, k0 swhich)
+ {
+ if (bbGetInputk1().size()==1)
+ {
+ if (bbGetInputk1()[0] == 0)
+ {
+ Out0 = In0;
+ Out1 = In1;
+ } // if k1 == 0
+ if (bbGetInputk1()[0] == 1)
+ {
+ Out0 = In1;
+ Out1 = In0;
+ } // if k1 == 1
+ } // if size k1 == 1
+ } // if Type 16
+
+
bbSetOutputOut0( Out0 );
bbSetOutputOut1( Out1 );
bbSetOutputOut2( Out2 );
BBTK_AUTHOR("InfoDev");
BBTK_DESCRIPTION("No Description.");
BBTK_CATEGORY("empty");
- BBTK_INPUT(VectorFilterDouble,Type,"default (0) 0=Erase duplicated lines, 1=Redimention Vectors, 2=Insert intermediat points,3=Adition k1, 4=Substraction k1, 5=Multilication k1, 6=Division k1, 7=Connect mesh X1,Y1,Z1,idxs1,X2,X2,X2,idx2, 8=Order All vectors with the logic of In0 , 9=Invert Vectors, 10=Nearest Point in the vector. In3PointXYZ In0LstX In1LstY In2LstZ (Out0-index Out1-PointXYZ), 11=Mul Spacing (K1[spcX,spcY,spcZ]=Spacing), 12=Div Spacing (K1[spcX,spcY,spcZ]=Spacing), 13=Distance pointIn0 and pontIn1, 14=Select specific segments [k1] in In0=lstPx In1=lstPy In2=lstPz In3=lstIndex (if k1 empty all segments are selected) , 15 swhitch element in a point k1=0 yz, k1=1 nothing k2=2 xz",int,"");
- BBTK_INPUT(VectorFilterDouble,k1,"(default [0]) nothing (Type0), k1[0]=new size vectors (Type 1) , nothing (Type2), k1[0] = Addition const. (Type 3), k1[0] = Substraction const. (Type 4), k1[0] = Multiplication const. (Type 5) , k1[0] = Division const. (Type 6) , k1[spcX,spcY,spcZ] MulSpc In0_X,In1_Y,In2_Z (type 11), k1[spcX,spcY,spcZ] DivSpc In0_X,In1_Y,In2_Z (type 12) , k1[segment1, segment2,..] (type 14) , direction (type 15) ",std::vector<double>,"");
+ BBTK_INPUT(VectorFilterDouble,Type,"default (0) 0=Erase duplicated lines, 1=Redimention Vectors, 2=Insert intermediat points,3=Adition k1, 4=Substraction k1, 5=Multilication k1, 6=Division k1, 7=Connect mesh X1,Y1,Z1,idxs1,X2,X2,X2,idx2, 8=Order All vectors with the logic of In0 , 9=Invert Vectors, 10=Nearest Point in the vector. In3PointXYZ In0LstX In1LstY In2LstZ (Out0-index Out1-PointXYZ), 11=Mul Spacing (K1[spcX,spcY,spcZ]=Spacing), 12=Div Spacing (K1[spcX,spcY,spcZ]=Spacing), 13=Distance pointIn0 and pontIn1, 14=Select specific segments [k1] in In0=lstPx In1=lstPy In2=lstPz In3=lstIndex (if k1 empty all segments are selected) , 15 swhitch element in a point k1=0 yz, k1=1 nothing k2=2 xz , 16 switch In0 and In1 (k1=1 nothing k0 swhich)",int,"");
+ BBTK_INPUT(VectorFilterDouble,k1,"(default [0]) nothing (Type0), k1[0]=new size vectors (Type 1) , nothing (Type2), k1[0] = Addition const. (Type 3), k1[0] = Substraction const. (Type 4), k1[0] = Multiplication const. (Type 5) , k1[0] = Division const. (Type 6) , k1[spcX,spcY,spcZ] MulSpc In0_X,In1_Y,In2_Z (type 11), k1[spcX,spcY,spcZ] DivSpc In0_X,In1_Y,In2_Z (type 12) , k1[segment1, segment2,..] (type 14) , direction (type 15), direction (type 16) ",std::vector<double>,"");
BBTK_INPUT(VectorFilterDouble,In0,"Input vector",std::vector<double>,"");
BBTK_INPUT(VectorFilterDouble,In1,"Input vector",std::vector<double>,"");
BBTK_INPUT(VectorFilterDouble,In2,"Input vector",std::vector<double>,"");
# SET(${BBTK_PACKAGE_NAME}_USE_GDCM2 ON)
# SET(${BBTK_PACKAGE_NAME}_USE_GSMIS ON)
# SET(${BBTK_PACKAGE_NAME}_USE_WXWIDGETS ON)
+SET(${BBTK_PACKAGE_NAME}_USE_OPENMP ON)
#===========================================================================
#===========================================================================
DEF_POINTER_IMAGE_VTK_CREA(vI,ssI,pI,stI,bbGetInputIn())
long int index=0;
- //int i,j;
- int k;
-
-int k1omp=(double)(maxZ-1)*0.0;
-int k2omp=(double)(maxZ-1)*0.2;
-int k3omp=(double)(maxZ-1)*0.4;
-int k4omp=(double)(maxZ-1)*0.6;
-int k5omp=(double)(maxZ-1)*0.8;
-int k6omp=(double)(maxZ-1)*1.0;
-
-//printf("EED ImageBoundaries::Process (with openmp)\n");
-
+
+ int *vecXMin = (int*)malloc( maxZ*sizeof(int) );
+ int *vecYMin = (int*)malloc( maxZ*sizeof(int) );
+ int *vecZMin = (int*)malloc( maxZ*sizeof(int) );
+ int *vecXMax = (int*)malloc( maxZ*sizeof(int) );
+ int *vecYMax = (int*)malloc( maxZ*sizeof(int) );
+ int *vecZMax = (int*)malloc( maxZ*sizeof(int) );
+
+ //int i,j;
+ int k;
+
+ for ( k=0 ; k<maxZ ; k++)
+ {
+ vecXMax[k] = 0;
+ vecYMax[k] = 0;
+ vecZMax[k] = 0;
+ vecXMin[k] = maxX-1;
+ vecYMin[k] = maxY-1;
+ vecZMin[k] = maxZ-1;
+ } // for
+
+ int k1omp = (double)(maxZ-1)*0.0;
+ int k2omp = (double)(maxZ-1)*0.2;
+ int k3omp = (double)(maxZ-1)*0.4;
+ int k4omp = (double)(maxZ-1)*0.6;
+ int k5omp = (double)(maxZ-1)*0.8;
+ int k6omp = (double)(maxZ-1)*1.0;
+
+printf("EED ImageBoundaries::Process (with openmp)\n");
// http://jakascorner.com/blog/2016/05/omp-for.html
-//#pragma omp parallel shared(maxZ,bXMin,bYMin,bZMin,bXMax,bYMax,bZMax)
-//{
- #pragma omp for
+ #pragma omp parallel for
for ( k=0 ; k<maxZ ; k++)
{
-//if ( (k1omp==k) || (k2omp==k) || (k3omp==k) ||
-// (k4omp==k) || (k5omp==k) || (k6omp==k) ) { printf(" %d%\n", (int)(((double)k/(double)(maxZ-1))*100 )); }
+if ( (k1omp==k) || (k2omp==k) || (k3omp==k) ||
+ (k4omp==k) || (k5omp==k) || (k6omp==k) ) { printf(" %d%\n", (int)(((double)k/(double)(maxZ-1))*100 )); }
int i,j;
double vItmpOMP;
for (j=0 ; j<maxY ; j++)
index++;
if ( (vItmpOMP>=lowervalue) && (vItmpOMP<=uppervalue) )
{
+ /*
if (i<bXMin) bXMin = i;
if (j<bYMin) bYMin = j;
if (k<bZMin) bZMin = k;
if (i>bXMax) bXMax = i;
if (j>bYMax) bYMax = j;
if (k>bZMax) bZMax = k;
+ */
+ if (i<vecXMin[k]) vecXMin[k] = i;
+ if (j<vecYMin[k]) vecYMin[k] = j;
+ if (k<vecZMin[k]) vecZMin[k] = k;
+ if (i>vecXMax[k]) vecXMax[k] = i;
+ if (j>vecYMax[k]) vecYMax[k] = j;
+ if (k>vecZMax[k]) vecZMax[k] = k;
+
}
} // for k
} // for j
} // i
-// } // #pragma
- std::vector<int> tmpIndex;
+
+ for ( k=0 ; k<maxZ ; k++)
+ {
+ if (vecXMin[k]<bXMin) bXMin = vecXMin[k];
+ if (vecYMin[k]<bYMin) bYMin = vecYMin[k];
+ if (vecZMin[k]<bZMin) bZMin = vecZMin[k];
+ if (vecXMax[k]>bXMax) bXMax = vecXMax[k];
+ if (vecYMax[k]>bYMax) bYMax = vecYMax[k];
+ if (vecZMax[k]>bZMax) bZMax = vecZMax[k];
+ }
+
+ delete vecXMin;
+ delete vecYMin;
+ delete vecZMin;
+ delete vecXMax;
+ delete vecYMax;
+ delete vecZMax;
+
+ std::vector<int> tmpIndex;
std::vector<int> tmpSize;
if (bXMin>bXMax){
tmpIndex.push_back(0);