#include <creaImageIODicomImageReader2.h>
-
+#include "gdcmStringFilter.h"
#include <creaImageIOSystem.h>
reader.SetFileName( filename.c_str() );
if (reader.Read())
{
- std::map<std::string,std::string>::iterator i;
- for (i=attr.begin();i!=attr.end();++i)
- {
- if ( i->first == "D0004_1500" )
- {
- boost::filesystem::path full_path(filename);
- std::string f = full_path.leaf();
- i->second = f;
- }
- else if ( i->first == "FullFileName" )
- {
- i->second = filename;
- }
- else if ( i->first == "FullFileDirectory" )
- {
- std::string::size_type last_pos = filename.find_last_of("//");
- //find first separator
- i->second = filename.substr(0, last_pos);
- }
- else
+ gdcm::StringFilter sf;
+ sf.SetFile(reader.GetFile());
+ std::map<std::string,std::string>::iterator i;
+ for (i=attr.begin();i!=attr.end();++i)
{
- uint16_t el;
- uint16_t gr;
-
- tree::AttributeDescriptor::GetDicomGroupElementFromKey(i->first,gr,el);
- if ( ( gr!=0 ) && ( el!=0 ) )
- {
-
- std::string val = GetStringValueFromTag(reader.GetFile().GetDataSet().GetDataElement(gdcm::Tag(gr,el)));
- i->second = irclean(val);
+ if ( i->first == "D0004_1500" )
+ {
+ boost::filesystem::path full_path(filename);
+ std::string f = full_path.leaf();
+ i->second = f;
+ }
+ else if ( i->first == "FullFileName" )
+ {
+ i->second = filename;
+ }
+ else if ( i->first == "FullFileDirectory" )
+ {
+ std::string::size_type last_pos = filename.find_last_of("//");
+ //find first separator
+ i->second = filename.substr(0, last_pos);
+ }
+ else
+ {
+ uint16_t el;
+ uint16_t gr;
+ tree::AttributeDescriptor::GetDicomGroupElementFromKey(i->first,gr,el);
+ //if ( ( gr!=0 ) && ( el!=0 ) )
+ const gdcm::Tag tag(gr, el);
+ if( reader.GetFile().GetDataSet().FindDataElement( tag ) )
+ {
+ i->second = irclean(sf.ToString(tag));
+ }
+ else
+ {
+ i->second = "";
+ }
+ }
}
- }
}
- }
}
void DicomImageReader::ReadAttributes2(const std::string& filename,
#include <gdcmReader.h>
#include <vtkGDCMImageReader.h>
#include <gdcmScanner.h>
+#include <gdcmAttribute.h>
#endif
class vtkGDCMImageReader;
}
else
{
- std::string extentx = (*sel).GetAttribute("D0028_0010");
- std::string extenty = (*sel).GetAttribute("D0028_0011");
- std::string extentz = (*sel).GetAttribute("D0028_0012");
- std::string extentt = (*sel).GetAttribute("D0028_0010");
- if( extentx == "" && extenty == "" && extentz == "")
- {
- // we try to create a vtkImageData just to get dim informations
- // Long method need to improve it!
- std::string name = (*sel).GetAttribute("FullFileName");
- if (name != "")
- {
- int dim[3];
- char c[5];
- mReader.GetImage(name)->GetDimensions(dim);
- sprintf(c,"%d", dim[0]);
- extentx = c;
- sprintf(c,"%d", dim[1]);
- extenty = c;
- sprintf(c,"%d", dim[2]);
- extentz = c;
- }
- }
+ boost::shared_ptr<ImageExtent> ie=boost::shared_ptr<ImageExtent>(new ImageExtent((*sel).GetAttribute("D0028_0010"),
+ (*sel).GetAttribute("D0028_0011"),
+ (*sel).GetAttribute("D0028_0012"),
+ ""));
- boost::shared_ptr<ImageExtent> ie=boost::shared_ptr<ImageExtent>(new ImageExtent(extentx, extenty, extentz,extentt));
if(mImageExtent==0)
{
mImageExtent=ie;
//=====================================================================
bool SQLiteTreeHandler::Open(bool writable)
{
- // std::cout << "***> SQLiteTreeHandler::Open('"<<GetFileName()<<"')"<<std::endl;
+
+ //sqlite3_exec(mDB, "PRAGMA synchronous=OFF ", NULL, 0, &errMsg);
SetWritable(writable);
return DBOpen();
}
//=====================================================================
int SQLiteTreeHandler::LoadChildren(tree::Node* parent, int maxlevel)
- {
+ {
+ //mDB->execDML("PRAGMA synchronous=ON ");
if (parent==0) parent = GetTree().GetTree();
return DBLoadChildren(parent,maxlevel);
}
try
{
mDB->open(GetFileName().c_str());
+ mDB->execDML("pragma synchronous=off;");
}
catch (CppSQLite3Exception& e)
{
<< e.errorMessage() <<std::endl);
return false;
}
-
+ mDB->execDML("pragma synchronous=off;");
// CREATING TABLES
// Sets the current directory to the home dir
mCurrentDirectory = std2wx(gimmick->GetHomeDirectory());
+
// Connect the AddProgress callback
gimmick->ConnectAddProgressObserver
( boost::bind( &WxGimmickView::OnAddProgress , this, _1 ) );
if (FD->ShowModal()==wxID_OK)
{
+ time(&mstart);
std::string dirname = wx2std (FD->GetPath());
bool recurse = isNeedRecursive(dirname);
if (recurse)
mess << "Files\tscanned\t: " << p.GetNumberScannedFiles() << "\n";
mess << "Files\thandled\t: " << p.GetNumberHandledFiles() << "\n\n";
mess << "Files\tadded \t: " << p.GetNumberAddedFiles() << "\n\n";
+ time_t end;
+ time(&end);
+ mess << "time to scan :" << difftime(end,mstart) << "sec";
wxMessageBox(std2wx(mess.str()),_T("Addition result"),wxOK,this);
}
#include <creaImageIOWxGimmickTools.h>
#include <creaImageIOListener.h>
#include <creaWx.h>
+#include <time.h>
#include "wx/progdlg.h"
/// Display a message box with the last addition statistics
void DisplayAddSummary();
-
+ time_t mstart;
/// Test a directory to know if contains sub-directory to analyze
bool isNeedRecursive(std::string i_name);