//===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== #include "bbcreaVtkMultipleOperations.h" #include "bbcreaVtkPackage.h" #include "creaVtk_MACROS.h" namespace bbcreaVtk { BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,MultipleOperations) BBTK_BLACK_BOX_IMPLEMENTATION(MultipleOperations,bbtk::AtomicBlackBox); //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void MultipleOperations::Process() { printf("EED MultipleOperations::Process Start\n"); // THE MAIN PROCESSING METHOD BODY // Here we simply set the input 'In' value to the output 'Out' // And print out the output value // INPUT/OUTPUT ACCESSORS ARE OF THE FORM : // void bbSet{Input|Output}NAME(const TYPE&) // const TYPE& bbGet{Input|Output}NAME() const // Where : // * NAME is the name of the input/output // (the one provided in the attribute 'name' of the tag 'input') // * TYPE is the C++ type of the input/output // (the one provided in the attribute 'type' of the tag 'input') if ( bbGetInputInLst().size()>0 ) { int extImage[6]; vtkImageData *resultImage=NULL; bbGetInputInLst()[0]->GetExtent( extImage ); int dimXImage = extImage[1]-extImage[0]+1; int dimYImage = extImage[3]-extImage[2]+1; int dimZImage = extImage[5]-extImage[4]+1; int iLst,sizeLst= bbGetInputInLst().size(); if (bbGetOutputOut()!=NULL) { bbGetOutputOut()->Delete(); } resultImage = vtkImageData::New(); resultImage->Initialize(); resultImage->SetSpacing( bbGetInputInLst()[0]->GetSpacing() ); resultImage->SetDimensions( dimXImage, dimYImage, dimZImage ); resultImage->AllocateScalars( bbGetInputInLst()[0]->GetScalarType(),1 ); long int index,size=dimXImage*dimYImage*dimZImage; if (bbGetInputType()==20) { DEF_POINTER_IMAGE_VTK_CREA(vIn ,ssIn ,pIn ,stIn ,bbGetInputInLst()[0] ) DEF_POINTER_IMAGE_VTK_CREA(vOut,ssOut,pOut,stOut,resultImage ) double vInBack,acumDiff; // #pragma omp parallel for for (index=0;indexGetScalarPointer() ); GETVALUE2_VTK_CREA(vIn,pIn,stIn,index) if (iLst!=0) { acumDiff = acumDiff+abs(vIn-vInBack); } vInBack=vIn; } // for iLst acumDiff = acumDiff/sizeLst; SETVALUE2_VTK_CREA(acumDiff,pOut,stOut,index) } // for index } // if Type==20 bbSetOutputOut( resultImage ); } // if InLst size printf("EED MultipleOperations::Process End\n"); } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void MultipleOperations::bbUserSetDefaultValues() { // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 bbSetInputType(0); bbSetOutputOut(NULL); } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void MultipleOperations::bbUserInitializeProcessing() { // THE INITIALIZATION METHOD BODY : // Here does nothing // but this is where you should allocate the internal/output pointers // if any } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void MultipleOperations::bbUserFinalizeProcessing() { // THE FINALIZATION METHOD BODY : // Here does nothing // but this is where you should desallocate the internal/output pointers // if any } } // EO namespace bbcreaVtk