From 0865352c5b6dd13b6c590ae287413daba22614d2 Mon Sep 17 00:00:00 2001 From: "eduardo.davila@creatis.insa-lyon.fr" Date: Wed, 18 Sep 2024 17:05:40 +0200 Subject: [PATCH] Clean code --- bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget.h | 2 +- .../src/bbcreaVtkJSONDataSetWriter.cxx | 25 +++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget.h b/bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget.h index 9f5d104..3573650 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget.h @@ -53,7 +53,7 @@ class bbcreaVtk_EXPORT BoxWidget BBTK_BEGIN_DESCRIBE_BLACK_BOX(BoxWidget,bbtk::AtomicBlackBox); BBTK_NAME("BoxWidget"); BBTK_AUTHOR("InfoDev"); - BBTK_DESCRIPTION("(C++,Python) No Description."); + BBTK_DESCRIPTION("(C++,Python,JavaScript) No Description."); BBTK_CATEGORY("empty"); BBTK_INPUT(BoxWidget,Active,"(default false) true/false",bool,""); diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkJSONDataSetWriter.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkJSONDataSetWriter.cxx index 258fca0..87114e7 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkJSONDataSetWriter.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkJSONDataSetWriter.cxx @@ -44,10 +44,15 @@ void JSONDataSetWriter::Process() // vtkImageData if ( (sizeLstFileNames==1) && (bbGetInputImage()!=NULL) ) { - vtkJSONDataSetWriter *writer = vtkJSONDataSetWriter::New(); - writer->GetArchiver()->SetArchiveName( bbGetInputLstFileNames()[0].c_str() ); - writer->SetInputData( bbGetInputImage() ); - writer->Update(); + image = bbGetInputImage(); + filename = bbGetInputLstFileNames()[0]; + if (image!=NULL) + { + vtkJSONDataSetWriter *writer = vtkJSONDataSetWriter::New(); + writer->GetArchiver()->SetArchiveName( filename.c_str() ); + writer->SetInputData( image ); + writer->Update(); + } // if image } // if Image // lst vtkImageData @@ -70,10 +75,16 @@ void JSONDataSetWriter::Process() // vtkPolyData if ( (sizeLstFileNames==1) && (bbGetInputPolyData()!=NULL) ) { + polydata = bbGetInputPolyData(); + filename = bbGetInputLstFileNames()[0]; + printf("EED JSONDataSetWriter::Process filename=%s\n", filename.c_str() ); vtkJSONDataSetWriter *writer = vtkJSONDataSetWriter::New(); - writer->GetArchiver()->SetArchiveName( bbGetInputLstFileNames()[0].c_str() ); - writer->SetInputData( bbGetInputPolyData() ); - writer->Update(); + if (polydata!=NULL) + { + writer->GetArchiver()->SetArchiveName( filename.c_str() ); + writer->SetInputData( bbGetInputPolyData() ); + writer->Update(); + } // if polydata } // if PolyData -- 2.47.1