]> Creatis software - creaImageIO.git/commitdiff
#2458 creaImageIO Feature New Normal - UnMosaic Images SimpleView Gimick
authordavila <eduardo.davila@creatis.insa-lyon.fr>
Wed, 15 Oct 2014 15:16:56 +0000 (17:16 +0200)
committerdavila <eduardo.davila@creatis.insa-lyon.fr>
Wed, 15 Oct 2014 15:16:56 +0000 (17:16 +0200)
src/creaImageIOGimmickView.cpp
src/creaImageIOSimpleView.cpp
src/creaImageIOSimpleView.h
src/creaImageIOWxSimpleDlg.cpp

index 0a76936736294655e38f4d77fa54c0a5790b89f9..0281042c2c1e5e62502f8c8972c3cfb9d22f1348 100644 (file)
@@ -486,20 +486,37 @@ 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
+
+//EED Borrame
+               int i,isize=i_attr.outside.size();
+               for (i=0;i<isize;i++)
+               {
+               printf("EED GimmickView::readImages1 A  i_attr out %s \n", i_attr.outside[i].c_str());
+               }
+
+
+
                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)
+printf("EED GimmickView::readImages1 A\n ");
+                       if(i_attr.mult) 
+                       {
                                getAttributes((*it),out.infos,i_attr);
+printf("EED GimmickView::readImages1 B   %s \n ", out.infos.find("D0019_100a")->second.c_str() );                              
+                       }
                        o_output.push_back(out);
                }
                // If we want only one output information structure, we set it outside the loop
                if(!i_attr.mult)
                {
                        getAttributes(im.front(), o_output.front().infos, i_attr);
+printf("EED GimmickView::readImages1 C   %s \n ", o_output.front().infos.find("D0019_100a")->second.c_str() );
                }
                
        }
@@ -520,9 +537,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 +680,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 +699,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??
+
        }
 
 
index 019214310279cc3eea37abd862e26efcc3052ed0..96d0e7442bda4713e5f973fc01d1cf9c04df0494 100644 (file)
 
 namespace creaImageIO
 {
-       bool SimpleView::readFile(std::vector<std::string> i_filenames, std::vector<vtkImageData *> &i_img)
+       bool SimpleView::readFile(      std::vector<std::string> i_filenames,                                                                   // in information names
+                                                                               std::vector<std::string> i_attr,                                                                                        // in information attributes names
+                                                                               std::vector<std::map <std::string , std::string> > &i_imgAttr,  // out information attributes names-values
+                                                                               std::vector<vtkImageData *> &i_img)                                                                     // out information vtkImageData
        {
                        bool bresult, bfinal = true;
                        ImageReader *mReader = new ImageReader();
@@ -42,7 +45,13 @@ namespace creaImageIO
                                bresult = mReader->CanRead((*it).c_str());
                                if(bresult)
                                {
-                                       i_img.push_back(mReader->ReadImage((*it).c_str()));
+                                       std::map <std::string , std::string> mapAttr;
+                                       mReader->getAttributes( (*it).c_str() , mapAttr, i_attr ); //  filename, outMapAttr-NameValue, inVectAttributeName
+                                       i_imgAttr.push_back( mapAttr );
+
+                                       //UnMosaic step..
+
+                                       i_img.push_back( mReader->ReadImage( (*it).c_str() ) );
                                } else {
                                        printf("ERROR. Impossible to read file %s\n", (*it).c_str() );
                                        bfinal = false;
@@ -53,7 +62,10 @@ namespace creaImageIO
        }
 
 
-       bool SimpleView::readDirectory(const std::string i_pathname, std::vector<vtkImageData *> &i_imgs)
+       bool SimpleView::readDirectory( const std::string i_pathname,                                                                                   // in information names
+                                                                                               std::vector<std::string> i_attr,                                                                                        // in information attributes names
+                                                                                               std::vector<std::map <std::string , std::string> > &i_imgAttr,  // out information attributes names-values
+                                                                                               std::vector<vtkImageData *> &i_imgs)                                                                    // out information vtkImageData
        {
                        bool bresult = true;
                        ImageReader *mReader = new ImageReader();
@@ -78,7 +90,14 @@ namespace creaImageIO
                                
                                for(int i=0; i<lgr; i++)
                                {
-                                  std::cout << names[i] << std::endl;
+               std::cout << names[i] << std::endl;
+
+                                       std::map <std::string , std::string> mapAttr;
+                                       mReader->getAttributes( names[i] , mapAttr, i_attr ); //  filename, outMapAttr-NameValue, inVectAttributeName
+                                       i_imgAttr.push_back( mapAttr );
+
+                                       //UnMosaic step..
+
                                   i_imgs.push_back( mReader->ReadImage(names[i]) );  
                                }                       
                        }
index 25cff51862f798cd2b6912316981339d7a0b1c87..669af13a0ddf1b9dd5eb890fc4c3a2fad85194fe 100644 (file)
@@ -48,10 +48,19 @@ namespace creaImageIO
                ~SimpleView(){}
                
                /// read file(s) and return a vector of vtkImageData 
-               bool readFile( std::vector<std::string> i_filenames, std::vector< vtkImageData *> &i_img);
+               bool readFile( std::vector<std::string> i_filenames,                                                                                            // in information names
+                                                                               std::vector<std::string> i_attr,                                                                                        // in information attributes names
+                                                                               std::vector<std::map <std::string,std::string> > &i_imgAttr,    // out information attributes names-values
+                                                                               std::vector< vtkImageData *> &i_img);                                                                   // out information vtkImageData
 
                /// read a directory and return a vector of vtkImageData 
-               bool readDirectory(const std::string i_pathname, std::vector< vtkImageData *> &i_imgs);
+               bool readDirectory(     const std::string i_pathname,                                                                                   // in information names
+                                                                       std::vector<std::string> i_attr,                                                                                        // in information attributes names
+                                                                       std::vector<std::map <std::string , std::string> > &i_imgAttr,  // out information attributes names-values
+                                                                       std::vector<vtkImageData *> &i_imgs);                                                                   // out information vtkImageData
+
+
+
 
        };
 }
index a537b32aed81577d8345f07fd585b668115e1f27..5d053226805a45430b51785d2e0af1d1a6e2ecb9 100644 (file)
@@ -85,7 +85,7 @@ namespace creaImageIO
                                        {
                                                files.push_back( crea::wx2std(wxArray[i]));
                                        }
-                                       if(!m_view.readFile(files,m_results))
+                                       if( !m_view.readFile(files , m_attrDicomTags , m_resultsDicomAtr , m_results) )
                                        {
                                                //TO DO WARNING MESSAGE;
                                        }
@@ -113,7 +113,7 @@ namespace creaImageIO
                 {  
                         m_results.clear();
                        infoimage=_T("DIRECTORY:")+dirDlg->GetPath();
-                       if(! m_view.readDirectory(crea::wx2std(dirDlg->GetPath()),m_results))
+                       if(! m_view.readDirectory(crea::wx2std(dirDlg->GetPath()) , m_attrDicomTags , m_resultsDicomAtr , m_results))
                        {
                                //TO DO WARNING MESSAGE;
                        }