From 4ae048dd3d78ddea21ded374e4bf51340df8384b Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Mon, 16 Sep 2019 15:25:30 +0200 Subject: [PATCH] #3307 creaVtk Bug New Normal - StructuredPoint init --- bbtk_creaVtk_PKG/src/bbcreaVtkGrayLevel.cxx | 14 ---------- .../bbcreaVtkImageDataStructuredPoints.cxx | 28 +++++++++---------- bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx | 25 +++++++++++------ lib/creaVtk/vtkImageDataStrucPoints.cpp | 15 ++-------- 4 files changed, 34 insertions(+), 48 deletions(-) diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkGrayLevel.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkGrayLevel.cxx index 11e6c3a..75ae894 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkGrayLevel.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkGrayLevel.cxx @@ -13,9 +13,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(GrayLevel,bbtk::AtomicBlackBox); //===== void GrayLevel::Process() { - -printf ("EED GrayLevel::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 @@ -30,13 +27,10 @@ printf ("EED GrayLevel::Process Start\n"); // vtkImageData *m_image = vtkImageData::New(); // m_image = bbGetInputImage(); - double grayLevel = -9999; std::vector coord = bbGetInputCoordinate(); - int ext[6]; int maxX,maxY,maxZ; - double px,py,pz; if (bbGetInputImage()!=NULL) { @@ -46,7 +40,6 @@ printf ("EED GrayLevel::Process Start\n"); maxX = ext[1]-ext[0]+1; maxY = ext[3]-ext[2]+1; maxZ = ext[5]-ext[4]+1; - if (coord.size()==3) { if (bbGetInputWithSpacing()==true) @@ -59,7 +52,6 @@ printf ("EED GrayLevel::Process Start\n"); py = coord[1]; pz = coord[2]; }// if - px=round(px); py=round(py); pz=round(pz); @@ -69,8 +61,6 @@ printf ("EED GrayLevel::Process Start\n"); } else { grayLevel = -9991; } // if px py pz - - } // coord std::vector lstGL; std::vector lstX = bbGetInputLstPointsX(); @@ -101,15 +91,11 @@ printf ("EED GrayLevel::Process Start\n"); } else { lstGL.push_back( -9991 ); } - }// for bbSetOutputLstGrayLevel(lstGL); } // if size of Lst } // InputImage bbSetOutputGrayLevel(grayLevel); - -printf ("EED GrayLevel::Process End\n"); - } //===== diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageDataStructuredPoints.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkImageDataStructuredPoints.cxx index b8e8f8e..9f0ccec 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkImageDataStructuredPoints.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageDataStructuredPoints.cxx @@ -13,26 +13,26 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ImageDataStructuredPoints,bbtk::AtomicBlackBox); //===== void ImageDataStructuredPoints::Process() { - vtkImageDataStrucPoints idsp; - idsp.joinComponents(bbGetInputX(), bbGetInputY(), bbGetInputZ(), - bbGetInputData1(), bbGetInputData2(), bbGetInputData3(), - bbGetInputData4(), bbGetInputData5(), bbGetInputData6() ); - bbSetOutputImageEnsemble( idsp.getStructuredPoints() ); + vtkImageDataStrucPoints idsp; + idsp.joinComponents(bbGetInputX(), bbGetInputY(), bbGetInputZ(), + bbGetInputData1(), bbGetInputData2(), bbGetInputData3(), + bbGetInputData4(), bbGetInputData5(), bbGetInputData6() ); + bbSetOutputImageEnsemble( idsp.getStructuredPoints() ); } //===== // 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 ImageDataStructuredPoints::bbUserSetDefaultValues() { - bbSetInputX(NULL); - bbSetInputY(NULL); - bbSetInputZ(NULL); - bbSetInputData1(NULL); - bbSetInputData2(NULL); - bbSetInputData3(NULL); - bbSetInputData4(NULL); - bbSetInputData5(NULL); - bbSetInputData6(NULL); + bbSetInputX(NULL); + bbSetInputY(NULL); + bbSetInputZ(NULL); + bbSetInputData1(NULL); + bbSetInputData2(NULL); + bbSetInputData3(NULL); + bbSetInputData4(NULL); + bbSetInputData5(NULL); + bbSetInputData6(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) diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx index 59b6821..91de0a6 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx @@ -44,14 +44,23 @@ void PlaneWidget::Process() // * TYPE is the C++ type of the input/output // (the one provided in the attribute 'type' of the tag 'input') - _boxcreavtkplanewidget.SetActive( bbGetInputActive() ); - _boxcreavtkplanewidget.SetImage( bbGetInputIn() ); - _boxcreavtkplanewidget.SetResolution( bbGetInputResolution() ); - _boxcreavtkplanewidget.SetRenderer( bbGetInputRenderer() ); - _boxcreavtkplanewidget.Process(); - bbSetOutputOut( _boxcreavtkplanewidget.GetPlaneSource()->GetOutput() ); - bbSetOutputCenter( _boxcreavtkplanewidget.GetCenter() ); - bbSetOutputNormal( _boxcreavtkplanewidget.GetNormal() ); + if ((bbGetInputIn()==NULL) || (bbGetInputRenderer()==NULL)) + { + bbSetOutputOut( NULL ); + std::vector center; + std::vector normal; + bbSetOutputCenter( center ); + bbSetOutputNormal( normal ); + } else { + _boxcreavtkplanewidget.SetActive( bbGetInputActive() ); + _boxcreavtkplanewidget.SetImage( bbGetInputIn() ); + _boxcreavtkplanewidget.SetResolution( bbGetInputResolution() ); + _boxcreavtkplanewidget.SetRenderer( bbGetInputRenderer() ); + _boxcreavtkplanewidget.Process(); + bbSetOutputOut( _boxcreavtkplanewidget.GetPlaneSource()->GetOutput() ); + bbSetOutputCenter( _boxcreavtkplanewidget.GetCenter() ); + bbSetOutputNormal( _boxcreavtkplanewidget.GetNormal() ); + } } //===== // 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) diff --git a/lib/creaVtk/vtkImageDataStrucPoints.cpp b/lib/creaVtk/vtkImageDataStrucPoints.cpp index 0649c5e..79c9fb6 100644 --- a/lib/creaVtk/vtkImageDataStrucPoints.cpp +++ b/lib/creaVtk/vtkImageDataStrucPoints.cpp @@ -31,6 +31,7 @@ vtkImageDataStrucPoints::vtkImageDataStrucPoints() { + _structuredPoints=NULL; } vtkImageDataStrucPoints::~vtkImageDataStrucPoints() @@ -41,8 +42,6 @@ void vtkImageDataStrucPoints::joinComponents(vtkImageData* imageX, vtkImageData vtkImageData* Data1, vtkImageData* Data2, vtkImageData* Data3 , vtkImageData* Data4, vtkImageData* Data5, vtkImageData* Data6 ) { -printf("EED vtkImageDataStrucPoints::joinComponents Start \n"); - if ((imageX!=NULL) && (imageY!=NULL) && (imageZ!=NULL) ) { int ext[6]; @@ -61,8 +60,7 @@ printf("EED vtkImageDataStrucPoints::joinComponents Start \n"); dim[2]=ext[5]-ext[4]+1; imageY->GetSpacing(spc); double *ptrX=NULL, *ptrY=NULL, *ptrZ=NULL; - double *ptrD1=NULL, *ptrD2=NULL, *ptrD3=NULL, *ptrD4=NULL, *ptrD5=NULL, *ptrD6=NULL; - + double *ptrD1=NULL, *ptrD2=NULL, *ptrD3=NULL, *ptrD4=NULL, *ptrD5=NULL, *ptrD6=NULL; if (imageX!=NULL) ptrX = (double *)imageX->GetScalarPointer(); if (imageY!=NULL) ptrY = (double *)imageY->GetScalarPointer(); if (imageZ!=NULL) ptrZ = (double *)imageZ->GetScalarPointer(); @@ -72,7 +70,6 @@ printf("EED vtkImageDataStrucPoints::joinComponents Start \n"); if (Data4 !=NULL) ptrD4 = (double *)Data4->GetScalarPointer(); if (Data5 !=NULL) ptrD5 = (double *)Data5->GetScalarPointer(); if (Data6 !=NULL) ptrD6 = (double *)Data6->GetScalarPointer(); - long int sizeimage = dim[0]*dim[1]*dim[2]; int components=3; // if ((Data1!=NULL) && (Data2==NULL) && (Data3==NULL) && (Data4==NULL) && (Data5==NULL) && (Data6==NULL) ) { components=4; } @@ -89,14 +86,12 @@ printf("EED vtkImageDataStrucPoints::joinComponents Start \n"); array2->SetNumberOfComponents(1); array2->Allocate(sizeimage*1, 100 ); // ??? array2->SetName("angle"); - printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents Limpiar este codigo ........ \n"); printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents Limpiar este codigo ........ \n"); printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents Limpiar este codigo ........ \n"); printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents Limpiar este codigo ........ \n"); printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents Limpiar este codigo ........ \n"); printf("EED Warnning .... vtkImageDataStrucPoints::joinComponents Limpiar este codigo ........ \n"); - double vx,vy,vz,d1=0,d2=0,d3=0,d4=0,d5=0,d6=0; int i; for( i = 0 ; i < sizeimage ; i++ ) @@ -156,12 +151,8 @@ printf("EED vtkImageDataStrucPoints::joinComponents Start \n"); } else { printf("EED Warnning! vtkImageDataStrucPoints::joinComponents imageX or image Y or image Z is EMPTY\n"); + _structuredPoints=NULL; } // imageX imageY imageZ - - - -printf("EED vtkImageDataStrucPoints::joinComponents End\n"); - } vtkStructuredPoints* vtkImageDataStrucPoints::getStructuredPoints() -- 2.47.1