]> Creatis software - creaVtk.git/blobdiff - lib/creaVtk/creaVtkUnMosaicVectorVtkImageData.cpp
#2501 creaVtk Bug New Normal - Clean events in Vectors and Tensors visu widgets...
[creaVtk.git] / lib / creaVtk / creaVtkUnMosaicVectorVtkImageData.cpp
index 59a5235a62d63db06fde945bb140f65f683313b2..3609557e26bdedac789b54c255b7c1809a0a4daf 100644 (file)
 */
 
 #include "creaVtkUnMosaicVectorVtkImageData.h"
+
+#define _USE_MATH_DEFINES // for C
 #include <math.h>
+
 creaVtkUnMosaicVectorVtkImageData::creaVtkUnMosaicVectorVtkImageData()
 {
 }
@@ -39,16 +42,22 @@ std::vector<vtkImageData*> creaVtkUnMosaicVectorVtkImageData::unMosaicVectorVtkI
 {
        std::vector<int> nbImagesPerRow;
        std::vector<int> nbImagesInMosaic;
+       double imagesInMosaic;
 
-       for(int i = 0; i < NbImagesInMosaicVector.size(); i++){
+       for(int i = 0; i < NbImagesInMosaicVector.size(); i++)
+       {
+               imagesInMosaic = NbImagesInMosaicVector[i];
+               nbImagesPerRow.push_back( ceil(sqrt(imagesInMosaic)) );
                nbImagesInMosaic.push_back(NbImagesInMosaicVector[i]);
-               nbImagesPerRow.push_back( ceil(sqrt(NbImagesInMosaicVector[i])) );
        }
 
-       if(imageInput.size() != NbImagesInMosaicVector.size()){
-               for(int j = NbImagesInMosaicVector.size(); j < imageInput.size(); j++)  {       
+       if(imageInput.size() != NbImagesInMosaicVector.size())
+       {
+               for(int j = NbImagesInMosaicVector.size(); j < imageInput.size(); j++)  
+               {
+                       imagesInMosaic = NbImagesInMosaicVector[NbImagesInMosaicVector.size()-1];
+                       nbImagesPerRow.push_back( ceil(sqrt(imagesInMosaic)) );         
                        nbImagesInMosaic.push_back( NbImagesInMosaicVector[NbImagesInMosaicVector.size()-1] );
-                       nbImagesPerRow.push_back( ceil(sqrt(NbImagesInMosaicVector[NbImagesInMosaicVector.size()-1])) );                
                }
        }