]> Creatis software - creaImageIO.git/blobdiff - src/creaImageIOGimmickView.cpp
#3185 creaImageIO Feature New Normal - Clean code
[creaImageIO.git] / src / creaImageIOGimmickView.cpp
index 0a76936736294655e38f4d77fa54c0a5790b89f9..672f9224b9874b4a8297f9904bb023f2fd331ad9 100644 (file)
@@ -486,14 +486,19 @@ void GimmickView::ReadImagesNotThreaded(std::vector<vtkImageData*>& s, std::vect
        void GimmickView::readImages1(std::vector<OutStrGimmick>& o_output, std::vector<std::string> im,
                         OutputAttr i_attr)
        {
+
+               i_attr.outside.push_back("D0019_100a");  // simens Number Of Images In Mosaic
+
                std::vector<std::string>::iterator it;
                for (it=im.begin(); it!=im.end(); ++it)
                {
                        OutStrGimmick out;
                        out.img = vtkImageData::New();
                        out.img->ShallowCopy(mReader.GetImage(*it));
-                       if(i_attr.mult)
+                       if(i_attr.mult) 
+                       {
                                getAttributes((*it),out.infos,i_attr);
+                       }
                        o_output.push_back(out);
                }
                // If we want only one output information structure, we set it outside the loop
@@ -520,9 +525,7 @@ void GimmickView::ReadImagesNotThreaded(std::vector<vtkImageData*>& s, std::vect
                if(ext[5] == 0)
                {
                        ext[5] = (int)im.size()-1;
-               }
-               else
-               {
+               } else {
                        ext[5] = ext[5] * (int)im.size()-1; // to deal with multiframes 
                }
                out.img->SetExtent(ext);
@@ -665,19 +668,15 @@ void GimmickView::ReadImagesNotThreaded(std::vector<vtkImageData*>& s, std::vect
                if ( size == 0)
                {
                        return;
-               }
-               else if (size == 1)
-               {
+               } else if (size == 1) {
                        // Simplest case
                        // Only one image : give it
                        // But take in count multiframe possibility
                        if ( isSingle(im.front()) || i_dim != 1)
                        {
                                 readImages1(o_output,im, i_attr);
-                       }
-                       else
-                       {
-                               readImages2(o_output,im, i_attr,i_zspc);
+                       } else {
+                                readImages2(o_output,im, i_attr,i_zspc);
                        }                       
                } else {
                        // multiple or single frame
@@ -688,40 +687,33 @@ void GimmickView::ReadImagesNotThreaded(std::vector<vtkImageData*>& s, std::vect
                                {
                                        // 2D to 3D
                                        readImages3(o_output,im, i_attr,i_zspc);
-                               }
-                               else
-                               {
+                               } else {
                                        readImages1(o_output,im, i_attr);
                                }
-                       }
-                       else
-                       {
+                       } else {
                                // we deal with multiple frames n x (2D x T)
                                // Differents outputs are avaialable
                                if(i_dim == 1)
                                {
                                        // put all in one output
                                        readImages3(o_output,im, i_attr,i_zspc);
-
-                               }
-                               else if( i_dim == 2)
-                               {
+                               } else if( i_dim == 2) {
                                        // put in a vector of n x T (2D)
                                        readImages2(o_output,im, i_attr,i_zspc);
-                               }
-                               else if( i_dim == 3)
-                               {
+                               } else if( i_dim == 3) {
                                        // put in a vector of n (2D x T)
                                        // No transformations.
                                        readImages1(o_output,im, i_attr);
-                               }
-                               else
-                               {
+                               } else {
                                        // put in a vector of T (2D x n)
                                        readImages4(o_output,im, i_attr);
-                               }
-                       }
-               }
+                               } // i_dim
+                       } //isSingle(im.front())
+               } // if size
+
+//EED UnMosaic step...  
+//How to verifie if is a mosaic file , with how many images inside??
+
        }
 
 
@@ -742,7 +734,7 @@ void GimmickView::ReadImagesNotThreadedInVector(std::vector<vtkImageData*>& s, s
        else if (im.size()>1) // Test inutile ? JPR
        {
                /// \TODO fix unused variable 'first'
-               vtkImageData* first = mReader.GetImage( im.front());
+//             vtkImageData* first = mReader.GetImage( im.front());
                if (dimension == 2)
                {
                 // n3D
@@ -752,10 +744,8 @@ void GimmickView::ReadImagesNotThreadedInVector(std::vector<vtkImageData*>& s, s
                                vtkImageData* out = vtkImageData::New();
                                out->ShallowCopy(mReader.GetImage(*it));
                                s.push_back(out);
-                       }
-               }
-               else
-               {
+                       } // for
+               } else {
                        // n2D to 3D // NO!
                        // n *2D + T in a vector :
                        
@@ -764,9 +754,9 @@ void GimmickView::ReadImagesNotThreadedInVector(std::vector<vtkImageData*>& s, s
                        {
                                vtkImageData* out = mReader.GetImage( (*it));
                                s.push_back(out);
-                       }
-               }
-       }
+                       } // for
+               } // if dimension
+       } // if im.size
 }
   //======================================================================
 
@@ -897,8 +887,9 @@ void GimmickView::Anonymize(std::vector<std::string> i_filenames, int type)
                
                // We need a gdcm::FileHelper, since we want to load the pixels        
                GDCM_NAME_SPACE::FileHelper *fh = GDCM_NAME_SPACE::FileHelper::New(file);
-       
-   uint8_t *imageData = fh->GetImageData();
+
+//Borrame
+//EED   uint8_t *imageData = fh->GetImageData();
 
           // Institution name 
           file->AddAnonymizeElement(0x0008, 0x0080, "*"); 
@@ -922,7 +913,7 @@ void GimmickView::Anonymize(std::vector<std::string> i_filenames, int type)
           fh->SetContentType(GDCM_NAME_SPACE::UNMODIFIED_PIXELS_IMAGE);
    
           fh->WriteDcmExplVR(file->GetFileName() +".ano1" );
-          std::cout << i <<"  End Anonymize" << std::cout;  
+          std::cout << i <<"  End Anonymize" << std::endl;  
           file->ClearAnonymizeList();
           file->Delete();
           fh->Delete();