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() );
}
}
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);
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
{
// 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??
+
}
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();
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;
}
- 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();
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]) );
}
}
~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
+
+
+
};
}
{
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;
}
{
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;
}