]> Creatis software - creaVtk.git/commitdiff
N#3508 IFTI read multiple images
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Fri, 2 Jun 2023 09:06:09 +0000 (11:06 +0200)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Fri, 2 Jun 2023 09:06:09 +0000 (11:06 +0200)
bbtk_creaVtk_PKG/.DS_Store
bbtk_creaVtk_PKG/src/bbcreaVtkMarchingCubes2.h
bbtk_creaVtk_PKG/src/bbcreaVtkNIFTIImageReader.cxx

index 220c1c2cdfc67b69cd7b97f6d1a94f5743e0a976..041e49fd4f90ee4e9cc1d0577b3467ea8abf6373 100644 (file)
Binary files a/bbtk_creaVtk_PKG/.DS_Store and b/bbtk_creaVtk_PKG/.DS_Store differ
index b4d44c46c2a702b13a9531291e5e3a4936a24955..21fcca2401d1b7abcbe666fbbd4de8f29642f7d8 100644 (file)
@@ -40,7 +40,7 @@ class bbcreaVtk_EXPORT MarchingCubes2
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(MarchingCubes2,bbtk::AtomicBlackBox);
     BBTK_NAME("MarchingCubes2");
     BBTK_AUTHOR("InfoDev");
-    BBTK_DESCRIPTION("No Description.");
+    BBTK_DESCRIPTION("No Description. (JavaScript)");
     BBTK_CATEGORY("empty");
 
     BBTK_INPUT(MarchingCubes2,Active,"(default true) Active",bool,"");
index fbb3ebb68adfd37a160f633cb17945cd152ba984..42ebdd5b3cce61821013cdae8c6ee5709517ed84 100644 (file)
@@ -32,45 +32,47 @@ void NIFTIImageReader::Process()
 //    bbSetOutputOut( bbGetInputIn() );
 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
   
+    std::vector<vtkImageData*> lstImages;
 
-       std::vector<vtkImageData*> lstImages;
+    if ( bbGetInputFileNames().size()>0 )
+    {
+        if (bbGetInputType()==0)
+        {
+            vtkNIFTIImageReader* reader=vtkNIFTIImageReader::New();
+            if ( bbGetInputFileNames().size()==1)
+            {
+                reader->SetFileName( bbGetInputFileNames()[0].c_str() );
+                reader->Update();
+            } else         {
+                vtkStringArray *lstFileNames=vtkStringArray::New();
+                int i,size=bbGetInputFileNames().size();
+                for (i=0;i<size;i++)
+                {
+                    lstFileNames->InsertNextValue( bbGetInputFileNames()[i].c_str() );
+                } // for i
+                reader->SetFileNames( lstFileNames );
+                reader->Update();
+            } // FileNames
+            lstImages.push_back( reader->GetOutput() );
+        } // Type 0
 
-       if (bbGetInputType()==0) 
-       {
-               vtkNIFTIImageReader* reader=vtkNIFTIImageReader::New();
-               if ( bbGetInputFileNames().size()==1)
-               {
-                       reader->SetFileName( bbGetInputFileNames()[0].c_str() );
-                       reader->Update();
-               } else          {
-                       vtkStringArray *lstFileNames=vtkStringArray::New();
-                       int i,size=bbGetInputFileNames().size();
-                       for (i=0;i<size;i++)
-                       {
-printf("EED Warnning, somethin is not working ????   NIFTIImageReader::Process()    %s\n ", bbGetInputFileNames()[i].c_str()  );
-                               lstFileNames->InsertNextValue( bbGetInputFileNames()[i].c_str() );
-                       } // for i
-                       reader->SetFileNames( lstFileNames );
-                       reader->Update();
-               } // FileNames
-               lstImages.push_back( reader->GetOutput() );
-       } // Type 0
-
-       if (bbGetInputType()==1) 
-       {
-               int i,size=bbGetInputFileNames().size();
-               for (i=0;i<size;i++)
-               {
-                       vtkNIFTIImageReader* reader=vtkNIFTIImageReader::New();
-                       reader->SetFileName( bbGetInputFileNames()[i].c_str() );
-                       reader->Update();
-                       lstImages.push_back( reader->GetOutput() );
-               } // for i
-       } // Type 1
+        if (bbGetInputType()==1)
+        {
+            int i,size=bbGetInputFileNames().size();
+            for (i=0;i<size;i++)
+            {
+                vtkNIFTIImageReader* reader=vtkNIFTIImageReader::New();
+                reader->SetFileName( bbGetInputFileNames()[i].c_str() );
+                reader->Update();
+                lstImages.push_back( reader->GetOutput() );
+            } // for i
+        } // Type 1
 
+    } // if
        
        if (lstImages.size()>=1) { bbSetOutputOut( lstImages[0] ); } else {bbSetOutputOut( NULL ); }
        bbSetOutputOutVector( lstImages );
+    
 }
 //===== 
 // 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)