]> Creatis software - creaVtk.git/commitdiff
Clean code
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Wed, 18 Sep 2024 15:05:40 +0000 (17:05 +0200)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Wed, 18 Sep 2024 15:05:40 +0000 (17:05 +0200)
bbtk_creaVtk_PKG/src/bbcreaVtkBoxWidget.h
bbtk_creaVtk_PKG/src/bbcreaVtkJSONDataSetWriter.cxx

index 9f5d104cb531159e2bda64f42778ed25bc874e53..357365042c3f58eff686b6d8a2f3d2fc182ea449 100644 (file)
@@ -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,"");
index 258fca0b2ae139ee6a7d4fe3282ca987a054b76d..87114e7f87ed45b68ac4616a01fd2e03b994be66 100644 (file)
@@ -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