//=====
void UnMosaicVectorVtkImageData::Process()
{
-
creaVtkUnMosaicVectorVtkImageData cvtkc;
- bbSetOutputOut( cvtkc.unMosaicVectorVtkImageData ((unsigned int)bbGetInputNbImagesPerRow(), (unsigned int)bbGetInputNbImagesInMosaic(), bbGetInputIn() ) );
+ bbSetOutputOut( cvtkc.unMosaicVectorVtkImageData (bbGetInputIn() , bbGetInputNbImagesInMosaicVector() ));
}
//=====
//=====
void UnMosaicVectorVtkImageData::bbUserSetDefaultValues()
{
-
- bbSetInputNbImagesPerRow(0);
- bbSetInputNbImagesInMosaic(0);
}
//=====
// 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();
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);
//=====
*/
#include "creaVtkUnMosaicVectorVtkImageData.h"
-
+#include <math.h>
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;
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----------------------------