//===== // 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 "bbcreaVtkVoiMPR.h" #include "bbcreaVtkPackage.h" namespace bbcreaVtk { BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,VoiMPR) BBTK_BLACK_BOX_IMPLEMENTATION(VoiMPR,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 VoiMPR::Process() { // 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') // bbSetOutputOut( bbGetInputIn() ); // std::cout << "Output value = " < vecVOI = bbGetInputIn(); std::vector spc = bbGetInputSpacing(); vecVOI[0] = vecVOI[0]*spc[0]; vecVOI[1] = vecVOI[1]*spc[0]; vecVOI[2] = vecVOI[2]*spc[1]; vecVOI[3] = vecVOI[3]*spc[1]; vecVOI[4] = vecVOI[4]*spc[2]; vecVOI[5] = vecVOI[5]*spc[2]; int dep; std::vector vecPoint = bbGetInputActualPoint(); vecPoint[0] = vecPoint[0]*spc[0]; vecPoint[1] = vecPoint[1]*spc[1]; vecPoint[2] = vecPoint[2]*spc[2]; if (vecPoint.size()==3) { if ((vecPoint[0]>=vecVOI[0]) && (vecPoint[0]<=vecVOI[1]) ) { showActorYZ=bbGetInputActive() && true; } else { showActorYZ=bbGetInputActive() && false; } if ((vecPoint[1]>=vecVOI[2]) && (vecPoint[1]<=vecVOI[3]) ) { showActorXZ=bbGetInputActive() && true; } else { showActorXZ=bbGetInputActive() && false; } if ((vecPoint[2]>=vecVOI[4]) && (vecPoint[2]<=vecVOI[5]) ) { showActorXY=bbGetInputActive() && true; } else { showActorXY=bbGetInputActive() && false; } } else { showActorXY=bbGetInputActive(); showActorYZ=bbGetInputActive(); showActorXZ=bbGetInputActive(); } if (bbGetInputXYrender()!=NULL) { dep=-900; pointsXY->SetPoint(0, vecVOI[0], vecVOI[2], dep); pointsXY->SetPoint(1, vecVOI[0], vecVOI[3], dep); pointsXY->SetPoint(2, vecVOI[1], vecVOI[3], dep); pointsXY->SetPoint(3, vecVOI[1], vecVOI[2], dep); pointsXY-> Modified(); if ( showActorXY==true ) { if (actorAddedXY==false) { bbGetInputXYrender()->AddActor(polygonActorXY); actorAddedXY=true; } // } else { if (actorAddedXY==true) { bbGetInputXYrender()->RemoveActor(polygonActorXY); actorAddedXY=false; } // }// Active } // if XYrender if (bbGetInputYZrender()!=NULL) { dep=900; pointsYZ->SetPoint(0, dep,vecVOI[2], vecVOI[4] ); pointsYZ->SetPoint(1, dep,vecVOI[2], vecVOI[5] ); pointsYZ->SetPoint(2, dep,vecVOI[3], vecVOI[5] ); pointsYZ->SetPoint(3, dep,vecVOI[3], vecVOI[4] ); pointsYZ-> Modified(); if ( showActorYZ==true ) { if (actorAddedYZ==false) { bbGetInputYZrender()->AddActor(polygonActorYZ); actorAddedYZ=true; } // } else { if (actorAddedYZ==true) { bbGetInputYZrender()->RemoveActor(polygonActorYZ); actorAddedYZ=false; } // }// Active } // if XYrender if (bbGetInputXZrender()!=NULL) { dep=-900; pointsXZ->SetPoint(0, vecVOI[0],dep, vecVOI[4] ); pointsXZ->SetPoint(1, vecVOI[0],dep, vecVOI[5] ); pointsXZ->SetPoint(2, vecVOI[1],dep, vecVOI[5] ); pointsXZ->SetPoint(3, vecVOI[1],dep, vecVOI[4] ); pointsXZ-> Modified(); if ( showActorXZ==true ) { if (actorAddedXZ==false) { bbGetInputXZrender()->AddActor(polygonActorXZ); actorAddedXZ=true; } // } else { if (actorAddedXZ==true) { bbGetInputXZrender()->RemoveActor(polygonActorXZ); actorAddedXZ=false; } // }// Active } // if XYrender } // In size } //===== // 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 VoiMPR::bbUserSetDefaultValues() { // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 actorAddedXY = false; actorAddedXZ = false; actorAddedYZ = false; bbSetInputActive(true); bbSetInputXYrender(NULL); bbSetInputYZrender(NULL); bbSetInputXZrender(NULL); std::vector spc; spc.push_back(1); spc.push_back(1); spc.push_back(1); bbSetInputSpacing(spc); } //===== // 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 VoiMPR::bbUserInitializeProcessing() { // THE INITIALIZATION METHOD BODY : // Here does nothing // but this is where you should allocate the internal/output pointers // if any pointsXY = vtkPoints ::New(); linesXY = vtkCellArray ::New(); polygonXY = vtkPolyData ::New(); polygonMapperXY = vtkPolyDataMapper ::New(); polygonActorXY = vtkActor ::New(); pointsXY -> SetNumberOfPoints(4); pointsXY -> SetPoint(0, 0, 0, 0); pointsXY -> SetPoint(1, 0, 0, 0); pointsXY -> SetPoint(2, 0, 0, 0); pointsXY -> SetPoint(3, 0, 0, 0); linesXY -> InsertNextCell(5); linesXY -> InsertCellPoint(0); linesXY -> InsertCellPoint(1); linesXY -> InsertCellPoint(2); linesXY -> InsertCellPoint(3); linesXY -> InsertCellPoint(0); polygonXY -> SetPoints(pointsXY); polygonXY -> SetLines(linesXY); polygonMapperXY -> SetInputData(polygonXY); polygonMapperXY -> Update(); polygonActorXY -> SetMapper(polygonMapperXY); pointsXZ = vtkPoints ::New(); linesXZ = vtkCellArray ::New(); polygonXZ = vtkPolyData ::New(); polygonMapperXZ = vtkPolyDataMapper ::New(); polygonActorXZ = vtkActor ::New(); pointsXZ -> SetNumberOfPoints(4); pointsXZ -> SetPoint(0, 0, 0, 0); pointsXZ -> SetPoint(1, 0, 0, 0); pointsXZ -> SetPoint(2, 0, 0, 0); pointsXZ -> SetPoint(3, 0, 0, 0); linesXZ -> InsertNextCell(5); linesXZ -> InsertCellPoint(0); linesXZ -> InsertCellPoint(1); linesXZ -> InsertCellPoint(2); linesXZ -> InsertCellPoint(3); linesXZ -> InsertCellPoint(0); polygonXZ -> SetPoints(pointsXZ); polygonXZ -> SetLines(linesXZ); polygonMapperXZ -> SetInputData(polygonXZ); polygonMapperXZ -> Update(); polygonActorXZ -> SetMapper(polygonMapperXZ); pointsYZ = vtkPoints ::New(); linesYZ = vtkCellArray ::New(); polygonYZ = vtkPolyData ::New(); polygonMapperYZ = vtkPolyDataMapper ::New(); polygonActorYZ = vtkActor ::New(); pointsYZ ->SetNumberOfPoints(4); pointsYZ ->SetPoint(0, 0, 0, 0); pointsYZ ->SetPoint(1, 0, 0, 0); pointsYZ ->SetPoint(2, 0, 0, 0); pointsYZ ->SetPoint(3, 0, 0, 0); linesYZ ->InsertNextCell(5); linesYZ ->InsertCellPoint(0); linesYZ ->InsertCellPoint(1); linesYZ ->InsertCellPoint(2); linesYZ ->InsertCellPoint(3); linesYZ ->InsertCellPoint(0); polygonYZ -> SetPoints(pointsYZ); polygonYZ -> SetLines(linesYZ); polygonMapperYZ -> SetInputData(polygonYZ); polygonMapperYZ -> Update(); polygonActorYZ -> SetMapper(polygonMapperYZ); } //===== // 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 VoiMPR::bbUserFinalizeProcessing() { // THE FINALIZATION METHOD BODY : // Here does nothing // but this is where you should desallocate the internal/output pointers // if any } } // EO namespace bbcreaVtk