--- /dev/null
+//=====
+// 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)
+//=====
+#include "bbcreaVtkImage3DVector.h"
+#include "bbcreaVtkPackage.h"
+#include "creaVtkIma3DVector.h"
+#include "vtkImageData.h"
+
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,Image3DVector)
+BBTK_BLACK_BOX_IMPLEMENTATION(Image3DVector,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+void Image3DVector::Process()
+{
+
+ creaVtkIma3DVector cvtkc;
+ bbSetOutputOut( cvtkc.Ima3DVectorM ((unsigned int)bbGetInputNbImagesPerRow(), (unsigned int)bbGetInputNbImagesInMosaic(), bbGetInputIn() ) );
+
+}
+//=====
+// 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)
+//=====
+void Image3DVector::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)
+//=====
+void Image3DVector::bbUserInitializeProcessing()
+{
+
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// if any
+
+
+}
+//=====
+// 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)
+//=====
+void Image3DVector::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaVtk
+
+
--- /dev/null
+//=====
+// 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)
+//=====
+#include "bbcreaVtkImage3DVector.h"
+#include "bbcreaVtkPackage.h"
+#include "creaVtkClass.h"
+#include "vtkImageData.h"
+
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,Image3DVector)
+BBTK_BLACK_BOX_IMPLEMENTATION(Image3DVector,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+void Image3DVector::Process()
+{
+
+ creaVtkClass cvtkc;
+ bbSetOutputOut( cvtkc.Ima3DVectorM ((unsigned int)bbGetInputNbImagesPerRow(), (unsigned int)bbGetInputNbImagesInMosaic(), bbGetInputIn() ) );
+
+}
+//=====
+// 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)
+//=====
+void Image3DVector::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)
+//=====
+void Image3DVector::bbUserInitializeProcessing()
+{
+
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// if any
+
+
+}
+//=====
+// 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)
+//=====
+void Image3DVector::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaVtk
+
+
--- /dev/null
+//=====
+// 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)
+//=====
+#ifndef __bbcreaVtkImage3DVector_h_INCLUDED__
+#define __bbcreaVtkImage3DVector_h_INCLUDED__
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkImageData.h"
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT Image3DVector
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(Image3DVector,bbtk::AtomicBlackBox);
+//=====
+// 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_OUTPUT(Out,std::vector<vtkImageData*>);
+ BBTK_PROCESS(Process);
+ void Process();
+//=====
+// 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_BEGIN_DESCRIBE_BLACK_BOX(Image3DVector,bbtk::AtomicBlackBox);
+BBTK_NAME("Image3DVector");
+BBTK_AUTHOR("Carlos torres");
+BBTK_DESCRIPTION("carlos.torres@insa-lyon.fr -");
+BBTK_CATEGORY("empty");
+BBTK_INPUT(Image3DVector,In,"2D image list",std::vector<vtkImageData*>,"");
+BBTK_INPUT(Image3DVector,NbImagesPerRow,"Nb of Images Per Row ",int,"");
+BBTK_INPUT(Image3DVector,NbImagesInMosaic,"Nb of Images In Mosaic ",int,"");
+BBTK_OUTPUT(Image3DVector,Out,"3D image Vector",std::vector<vtkImageData*>,"");
+BBTK_END_DESCRIBE_BLACK_BOX(Image3DVector);
+//=====
+// 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)
+//=====
+}
+// EO namespace bbcreaVtk
+
+#endif // __bbcreaVtkImage3DVector_h_INCLUDED__
+
--- /dev/null
+//=====
+// 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)
+//=====
+#ifndef __bbcreaVtkImage3DVector_h_INCLUDED__
+#define __bbcreaVtkImage3DVector_h_INCLUDED__
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT Image3DVector
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(Image3DVector,bbtk::AtomicBlackBox);
+//=====
+// 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_OUTPUT(Out,std::vector<vtkImageData*>);
+ BBTK_PROCESS(Process);
+ void Process();
+//=====
+// 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_BEGIN_DESCRIBE_BLACK_BOX(Image3DVector,bbtk::AtomicBlackBox);
+BBTK_NAME("Image3DVector");
+BBTK_AUTHOR("Carlos torres");
+BBTK_DESCRIPTION("carlos.torres@insa-lyon.fr -");
+BBTK_CATEGORY("empty");
+BBTK_INPUT(Image3DVector,In,"2D image list",std::vector<vtkImageData*>,"");
+BBTK_INPUT(Image3DVector,NbImagesPerRow,"Nb of Images Per Row ",int,"");
+BBTK_INPUT(Image3DVector,NbImagesInMosaic,"Nb of Images In Mosaic ",int,"");
+BBTK_OUTPUT(Image3DVector,Out,"3D image Vector",std::vector<vtkImageData*>,"");
+BBTK_END_DESCRIBE_BLACK_BOX(Image3DVector);
+//=====
+// 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)
+//=====
+}
+// EO namespace bbcreaVtk
+
+#endif // __bbcreaVtkImage3DVector_h_INCLUDED__
+
--- /dev/null
+/*
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+# pour la Sante)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+# This software is governed by the CeCILL-B license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL-B
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+# or in the file LICENSE.txt.
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------
+*/
+
+#include "creaVtkIma3DVector.h"
+
+creaVtkIma3DVector::creaVtkIma3DVector()
+{
+}
+
+creaVtkIma3DVector::~creaVtkIma3DVector()
+{
+}
+
+std::vector<vtkImageData*> creaVtkIma3DVector::Ima3DVectorM (int NbImagesPerRow, int NbImagesInMosaic, std::vector<vtkImageData*> bbGetInputIn)
+{
+ int nbImagesPerRow = NbImagesPerRow;
+ int nbImagesInMosaic = NbImagesInMosaic;
+
+ if (nbImagesPerRow == 0 || nbImagesInMosaic == 0) {
+ std::cout << "Not possible" << std::endl;
+ }
+
+ std::vector<vtkImageData*> imageIn = bbGetInputIn;
+
+ std::vector<vtkImageData*> mImageOut;
+ for (int i = 0 ; i < (unsigned int)imageIn.size() ; i++) {
+ mImageOut.push_back( unMosaic(imageIn[i], NbImagesPerRow, NbImagesInMosaic) );
+ }
+
+ return mImageOut;
+}
+
+vtkImageData * creaVtkIma3DVector::unMosaic(vtkImageData *imageIn, int nbImagesPerRow, int numberOfImagesInMosaic)
+{
+ int inputdims[3];
+ int outputdims[3];
+ imageIn->GetDimensions (inputdims);
+ unsigned short *input = (unsigned short *)(imageIn->GetScalarPointer());
+ imageIn->Update();
+
+ unsigned int div = (unsigned int)ceil(sqrt( (double)numberOfImagesInMosaic ) );
+ outputdims[0] = inputdims[0] / div;
+ outputdims[1] = inputdims[1] / div;
+ outputdims[2] = numberOfImagesInMosaic;
+
+ vtkImageData *vtkImageOut;
+ vtkImageOut = vtkImageData::New();
+ vtkImageOut->SetDimensions( outputdims );
+ vtkImageOut->SetExtent(0,outputdims[0]-1,0,outputdims[1]-1,0,outputdims[2]-1);
+ vtkImageOut->SetWholeExtent(0,outputdims[0]-1,0,outputdims[1]-1,0,outputdims[2]-1);
+ vtkImageOut->SetNumberOfScalarComponents(1);
+//vtkImageOut->SetSpacing( blabla );
+ vtkImageOut->SetScalarType( VTK_UNSIGNED_SHORT );
+ vtkImageOut->AllocateScalars();
+ vtkImageOut->Update();
+
+ unsigned short *output =(unsigned short *)(vtkImageOut->GetScalarPointer());
+
+ unsigned short *dest = output;
+ int dimXImageElem = outputdims[0];
+ int dimYImageElem = outputdims[1];
+ int lgrImage = dimXImageElem*dimYImageElem;
+ int debImage;
+ for (int i=0; i<numberOfImagesInMosaic; i++)
+ {
+ debImage=(i/nbImagesPerRow) * lgrImage*nbImagesPerRow + (i%nbImagesPerRow)*dimXImageElem;
+ for(int j=0; j<dimYImageElem; j++)
+ {
+ memcpy(dest, input+debImage, dimXImageElem*sizeof(unsigned short));
+ debImage += dimXImageElem*nbImagesPerRow;
+ dest += dimXImageElem;
+ }
+ }
+ return vtkImageOut;
+}
+
+//---------------------------------------------
+//Method template
+//---------------------------------------------
+/*
+void creaVtkIma3DVector::FunctionName(int& parameterA)
+{
+ parameterA = 2 * parameterA;
+ return;
+}
+*/
--- /dev/null
+/*
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+# pour la Sante)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+# This software is governed by the CeCILL-B license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL-B
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+# or in the file LICENSE.txt.
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------
+*/
+
+#include "creaVtkIma3DVector.h"
+
+creaVtkIma3DVector::creaVtkIma3DVector()
+{
+}
+
+creaVtkIma3DVector::~creaVtkIma3DVector()
+{
+}
+
+//---------------------------------------------
+//Method template
+//---------------------------------------------
+/*
+void creaVtkIma3DVector::FunctionName(int& parameterA)
+{
+ parameterA = 2 * parameterA;
+ return;
+}
+*/
--- /dev/null
+/*
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+# pour la Sante)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+# This software is governed by the CeCILL-B license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL-B
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+# or in the file LICENSE.txt.
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------
+*/
+
+#ifndef _CREAVTKIMA3DVECTOR_H_
+#define _CREAVTKIMA3DVECTOR_H_
+#include <vector>
+#include "iostream"
+#include "vtkImageData.h"
+
+//---------------------------------------------
+// Class Name: creaVtkIma3DVector
+// [classdescription]
+//---------------------------------------------
+
+class creaVtkIma3DVector
+{
+
+//---------------------------------------------
+//Methods and attributes exposed to other classes
+//---------------------------------------------
+public :
+ creaVtkIma3DVector();
+ ~creaVtkIma3DVector();
+ std::vector<vtkImageData*> Ima3DVectorM (int NbImagesPerRow, int NbImagesInMosaic, std::vector<vtkImageData*> bbGetInputIn);
+ vtkImageData * unMosaic(vtkImageData *imageIn, int nbImagesPerRow, int numberOfImagesInMosaic);
+
+//--Method template----------------------------
+// void FunctionName(int& parameterA);
+
+
+//---------------------------------------------
+//Methods and attributes exposed only to classes
+//that are derived from this class
+//---------------------------------------------
+protected:
+
+//---------------------------------------------
+//Methods and attributes only visible by this class
+//---------------------------------------------
+private:
+
+};
+
+//-end of _CREAVTKIMA3DVECTOR_H_------------------------------------------------------
+#endif
--- /dev/null
+/*
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+# pour la Sante)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+# This software is governed by the CeCILL-B license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL-B
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+# or in the file LICENSE.txt.
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------
+*/
+
+#ifndef _CREAVTKIMA3DVECTOR_H_
+#define _CREAVTKIMA3DVECTOR_H_
+
+//---------------------------------------------
+// Class Name: creaVtkIma3DVector
+// [classdescription]
+//---------------------------------------------
+
+class creaVtkIma3DVector
+{
+
+//---------------------------------------------
+//Methods and attributes exposed to other classes
+//---------------------------------------------
+public :
+ creaVtkIma3DVector();
+ ~creaVtkIma3DVector();
+
+//--Method template----------------------------
+// void FunctionName(int& parameterA);
+
+
+//---------------------------------------------
+//Methods and attributes exposed only to classes
+//that are derived from this class
+//---------------------------------------------
+protected:
+
+//---------------------------------------------
+//Methods and attributes only visible by this class
+//---------------------------------------------
+private:
+
+};
+
+//-end of _CREAVTKIMA3DVECTOR_H_------------------------------------------------------
+#endif