]> Creatis software - creaVtk.git/commitdiff
2319 creaVtk Feature New Normal Change in box and lib UnMosaicVectorVtkImageData...
authorctorres <carlos.torres@creatis.insa-lyon.fr>
Thu, 27 Feb 2014 09:40:04 +0000 (10:40 +0100)
committerctorres <carlos.torres@creatis.insa-lyon.fr>
Thu, 27 Feb 2014 09:40:04 +0000 (10:40 +0100)
bbtk_creaVtk_PKG/src/bbcreaVtkUnMosaicVectorVtkImageData.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkUnMosaicVectorVtkImageData.h
lib/creaVtk/creaVtkUnMosaicVectorVtkImageData.cpp
lib/creaVtk/creaVtkUnMosaicVectorVtkImageData.h

index 5790c1233fdc710554732c1f326fddaf225cd5b8..16b4d0ea1c7c2792a04a33aa9062d2b4e1e28c56 100644 (file)
@@ -16,9 +16,8 @@ BBTK_BLACK_BOX_IMPLEMENTATION(UnMosaicVectorVtkImageData,bbtk::AtomicBlackBox);
 //===== 
 void UnMosaicVectorVtkImageData::Process()
 {
-
                creaVtkUnMosaicVectorVtkImageData cvtkc;
-               bbSetOutputOut( cvtkc.unMosaicVectorVtkImageData ((unsigned int)bbGetInputNbImagesPerRow(), (unsigned int)bbGetInputNbImagesInMosaic(), bbGetInputIn() ) );  
+               bbSetOutputOut( cvtkc.unMosaicVectorVtkImageData (bbGetInputIn() , bbGetInputNbImagesInMosaicVector() ));  
 
 }
 //===== 
@@ -26,9 +25,6 @@ void UnMosaicVectorVtkImageData::Process()
 //===== 
 void UnMosaicVectorVtkImageData::bbUserSetDefaultValues()
 {
-
-               bbSetInputNbImagesPerRow(0);
-               bbSetInputNbImagesInMosaic(0);
   
 }
 //===== 
index abe3d9f8e55ebf6c66b4057245e1df84b410b3dc..4b4e2760af8a6bd1a18c36b5dc94ff89f6db1f62 100644 (file)
@@ -17,8 +17,7 @@ class bbcreaVtk_EXPORT UnMosaicVectorVtkImageData
 // 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)
 //===== 
   BBTK_DECLARE_INPUT(In,std::vector<vtkImageData*>);
-       BBTK_DECLARE_INPUT (NbImagesPerRow,int);
-  BBTK_DECLARE_INPUT (NbImagesInMosaic,int);
+  BBTK_DECLARE_INPUT (NbImagesInMosaicVector,std::vector<int>);
   BBTK_DECLARE_OUTPUT(Out,std::vector<vtkImageData*>);
   BBTK_PROCESS(Process);
   void Process();
@@ -33,8 +32,7 @@ BBTK_AUTHOR("carlos torres");
 BBTK_DESCRIPTION("No Description.");
 BBTK_CATEGORY("empty");
 BBTK_INPUT(UnMosaicVectorVtkImageData,In,"2D image list",std::vector<vtkImageData*>,"");
-BBTK_INPUT(UnMosaicVectorVtkImageData,NbImagesPerRow,"Nb of Images Per Row ",int,"");
-BBTK_INPUT(UnMosaicVectorVtkImageData,NbImagesInMosaic,"Nb of Images In Mosaic ",int,"");
+BBTK_INPUT(UnMosaicVectorVtkImageData,NbImagesInMosaicVector,"Vector of Number of Images In Mosaic ",std::vector<int>,"");
 BBTK_OUTPUT(UnMosaicVectorVtkImageData,Out,"3D image Vector",std::vector<vtkImageData*>,"");
 BBTK_END_DESCRIBE_BLACK_BOX(UnMosaicVectorVtkImageData);
 //===== 
index 2e7847c5c8141a423c6e897d74951750a262aafa..59a5235a62d63db06fde945bb140f65f683313b2 100644 (file)
@@ -26,7 +26,7 @@
 */
 
 #include "creaVtkUnMosaicVectorVtkImageData.h"
-
+#include <math.h>
 creaVtkUnMosaicVectorVtkImageData::creaVtkUnMosaicVectorVtkImageData()
 {
 }
@@ -35,21 +35,33 @@ creaVtkUnMosaicVectorVtkImageData::~creaVtkUnMosaicVectorVtkImageData()
 {
 }
 
-std::vector<vtkImageData*> creaVtkUnMosaicVectorVtkImageData::unMosaicVectorVtkImageData (int NbImagesPerRow, int NbImagesInMosaic, std::vector<vtkImageData*> bbGetInputIn)
+std::vector<vtkImageData*> creaVtkUnMosaicVectorVtkImageData::unMosaicVectorVtkImageData (std::vector<vtkImageData*> imageInput, std::vector<int> NbImagesInMosaicVector)
 {
-       int nbImagesPerRow =   NbImagesPerRow;
-       int nbImagesInMosaic = NbImagesInMosaic;        
+       std::vector<int> nbImagesPerRow;
+       std::vector<int> nbImagesInMosaic;
+
+       for(int i = 0; i < NbImagesInMosaicVector.size(); i++){
+               nbImagesInMosaic.push_back(NbImagesInMosaicVector[i]);
+               nbImagesPerRow.push_back( ceil(sqrt(NbImagesInMosaicVector[i])) );
+       }
 
-       if (nbImagesPerRow == 0 || nbImagesInMosaic == 0) 
+       if(imageInput.size() != NbImagesInMosaicVector.size()){
+               for(int j = NbImagesInMosaicVector.size(); j < imageInput.size(); j++)  {       
+                       nbImagesInMosaic.push_back( NbImagesInMosaicVector[NbImagesInMosaicVector.size()-1] );
+                       nbImagesPerRow.push_back( ceil(sqrt(NbImagesInMosaicVector[NbImagesInMosaicVector.size()-1])) );                
+               }
+       }
+       
+       if (nbImagesPerRow.size() == 0 || nbImagesInMosaic.size() == 0) 
         {
                std::cout << "VtkUnMosaicVectorVtkImageData ERROR: The number of Images by mosaic is not set " << std::endl; 
        }
 
-       std::vector<vtkImageData*> imageIn = bbGetInputIn;
+       std::vector<vtkImageData*> imageIn = imageInput;
 
        std::vector<vtkImageData*> mImageOut;
        for (int i = 0 ; i < (unsigned int)imageIn.size() ; i++) {
-                       mImageOut.push_back( unMosaic(imageIn[i], NbImagesPerRow, NbImagesInMosaic) );
+                       mImageOut.push_back( unMosaic(imageIn[i], nbImagesPerRow[i], nbImagesInMosaic[i]) );
        }
 
        return mImageOut;       
index 03362050cca98998697f9c3950ea7929bdd43406..47c18fc8c13068fba21cfa1b8083dfede38cc1c4 100644 (file)
@@ -44,7 +44,7 @@ class creaVtkUnMosaicVectorVtkImageData
 public :
   creaVtkUnMosaicVectorVtkImageData();
   ~creaVtkUnMosaicVectorVtkImageData();
-       std::vector<vtkImageData*> unMosaicVectorVtkImageData (int NbImagesPerRow, int NbImagesInMosaic, std::vector<vtkImageData*> bbGetInputIn);
+       std::vector<vtkImageData*> unMosaicVectorVtkImageData (std::vector<vtkImageData*> bbGetInputIn, std::vector<int> NbImagesInMosaicVector);
        vtkImageData * unMosaic(vtkImageData *imageIn, int nbImagesPerRow, int numberOfImagesInMosaic);
 
 //--Method template----------------------------