From: ctorres Date: Thu, 27 Feb 2014 09:40:04 +0000 (+0100) Subject: 2319 creaVtk Feature New Normal Change in box and lib UnMosaicVectorVtkImageData... X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=b352f0ac5f33f441b7ed53cea159c4e5ebd34639;p=creaVtk.git 2319 creaVtk Feature New Normal Change in box and lib UnMosaicVectorVtkImageData 2014-02-27 10:39 --- diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkUnMosaicVectorVtkImageData.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkUnMosaicVectorVtkImageData.cxx index 5790c12..16b4d0e 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkUnMosaicVectorVtkImageData.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkUnMosaicVectorVtkImageData.cxx @@ -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); } //===== diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkUnMosaicVectorVtkImageData.h b/bbtk_creaVtk_PKG/src/bbcreaVtkUnMosaicVectorVtkImageData.h index abe3d9f..4b4e276 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkUnMosaicVectorVtkImageData.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkUnMosaicVectorVtkImageData.h @@ -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); - BBTK_DECLARE_INPUT (NbImagesPerRow,int); - BBTK_DECLARE_INPUT (NbImagesInMosaic,int); + BBTK_DECLARE_INPUT (NbImagesInMosaicVector,std::vector); BBTK_DECLARE_OUTPUT(Out,std::vector); 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,""); -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,""); BBTK_OUTPUT(UnMosaicVectorVtkImageData,Out,"3D image Vector",std::vector,""); BBTK_END_DESCRIBE_BLACK_BOX(UnMosaicVectorVtkImageData); //===== diff --git a/lib/creaVtk/creaVtkUnMosaicVectorVtkImageData.cpp b/lib/creaVtk/creaVtkUnMosaicVectorVtkImageData.cpp index 2e7847c..59a5235 100644 --- a/lib/creaVtk/creaVtkUnMosaicVectorVtkImageData.cpp +++ b/lib/creaVtk/creaVtkUnMosaicVectorVtkImageData.cpp @@ -26,7 +26,7 @@ */ #include "creaVtkUnMosaicVectorVtkImageData.h" - +#include creaVtkUnMosaicVectorVtkImageData::creaVtkUnMosaicVectorVtkImageData() { } @@ -35,21 +35,33 @@ creaVtkUnMosaicVectorVtkImageData::~creaVtkUnMosaicVectorVtkImageData() { } -std::vector creaVtkUnMosaicVectorVtkImageData::unMosaicVectorVtkImageData (int NbImagesPerRow, int NbImagesInMosaic, std::vector bbGetInputIn) +std::vector creaVtkUnMosaicVectorVtkImageData::unMosaicVectorVtkImageData (std::vector imageInput, std::vector NbImagesInMosaicVector) { - int nbImagesPerRow = NbImagesPerRow; - int nbImagesInMosaic = NbImagesInMosaic; + std::vector nbImagesPerRow; + std::vector 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 imageIn = bbGetInputIn; + std::vector imageIn = imageInput; std::vector 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; diff --git a/lib/creaVtk/creaVtkUnMosaicVectorVtkImageData.h b/lib/creaVtk/creaVtkUnMosaicVectorVtkImageData.h index 0336205..47c18fc 100644 --- a/lib/creaVtk/creaVtkUnMosaicVectorVtkImageData.h +++ b/lib/creaVtk/creaVtkUnMosaicVectorVtkImageData.h @@ -44,7 +44,7 @@ class creaVtkUnMosaicVectorVtkImageData public : creaVtkUnMosaicVectorVtkImageData(); ~creaVtkUnMosaicVectorVtkImageData(); - std::vector unMosaicVectorVtkImageData (int NbImagesPerRow, int NbImagesInMosaic, std::vector bbGetInputIn); + std::vector unMosaicVectorVtkImageData (std::vector bbGetInputIn, std::vector NbImagesInMosaicVector); vtkImageData * unMosaic(vtkImageData *imageIn, int nbImagesPerRow, int numberOfImagesInMosaic); //--Method template----------------------------