Add directory_path as new Descriptor Attribute.
First implementation of SaveAs
// << "'"
// <<std::endl;
+ GDCM_NAME_SPACE::Document*doc;
GDCM_NAME_SPACE::File* file = GDCM_NAME_SPACE::File::New();
file->SetLoadMode( GDCM_NAME_SPACE::LD_ALL);
file->SetFileName(filename.c_str());
file->Load();
bool ok = file->IsReadable();
+ if(!ok)
+ {
+ doc = (GDCM_NAME_SPACE::Document*)file;
+ ok = doc->IsReadable();
+ }
file->Delete();
return ok;
}
GimmickMessage(2,"Reading attributes from DICOM file '"
<<filename<<"'"<<std::endl);
- GDCM_NAME_SPACE::File* file = GDCM_NAME_SPACE::File::New();
+ GDCM_NAME_SPACE::File* file = GDCM_NAME_SPACE::File::New();
+
+ GDCM_NAME_SPACE::Document *doc= GDCM_NAME_SPACE::File::New();
+ doc->SetLoadMode( GDCM_NAME_SPACE::LD_ALL);
+ doc->SetFileName(filename.c_str());
+ doc->Load();
file->SetLoadMode( GDCM_NAME_SPACE::LD_ALL);
file->SetFileName(filename.c_str());
file->Load();
- if (file->IsReadable())
+ if (file->IsReadable() ||((GDCM_NAME_SPACE::Document*) file)->IsReadable())
{
std::map<std::string,std::string>::iterator i;
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
{
#include <creaImageIOSystem.h>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
-
+#include "io.h"
#ifndef PATH_MAX // If not defined yet : do it
# define PATH_MAX 2048
#endif
virtual void CreateEditFieldsDialog(tree::Node* node, std::vector<std::string> names, std::vector<std::string> keys)
{ GimmickError("INTERNAL ERROR : EditFields not implemented"); }
+ ///Copies selected files
+ virtual void SaveAs(const std::vector<std::string>& filenames)
+ { GimmickError("INTERNAL ERROR : SaveAs not implemented"); }
+
+
///Validates the dimension compliance of the images with the maximum and minimum given, and between their sizes
bool ValidateSelected (tree::Node* sel, int min_dim, int max_dim);
#ifndef __creaImageIOImagePointerHolder_INCLUDED__
#define __creaImageIOImagePointerHolder_INCLUDED__
-#include <creaImageIOSystem.h>
-#ifdef USE_WXWIDGETS
-// wx
-#include <creaWx.h>
-#include <wx/image.h>
-#include <wx/imaglist.h>
-#include <wx/splitter.h>
+#include <creaImageIOSystem.h>
#include <vtkImageData.h>
+#include <boost/thread/mutex.hpp>
+
+
namespace creaImageIO
{
// The class that holds the pointer to the images to show
mImage(im)
{}
ImagePointerHolder();
- void Set(vtkImageData* im){wxMutexLocker lock(mMutex);mImage=im;}
- vtkImageData* Get(){wxMutexLocker lock(mMutex);return mImage;}
+ void Set(vtkImageData* im){boost::mutex::scoped_lock lock(mMutex);mImage=im;}
+ vtkImageData* Get(){boost::mutex::scoped_lock lock(mMutex);return mImage;}
private:
vtkImageData* mImage;
/// The mutex
- wxMutex mMutex;
+ boost::mutex mMutex;
};
}
#endif
-#endif
+
// CTor
Listener::Listener()
{
- wxMutexLocker lock(mMutex);
+
+ boost::mutex::scoped_lock lock(mMutex);
GimmickDebugMessage(6,"Listener::Listener"
<<std::endl);
mDrive="E:";
/// Destructor
Listener::~Listener()
{
- wxMutexLocker lock(mMutex);
+ boost::mutex::scoped_lock lock(mMutex);
GimmickDebugMessage(6,"Listener::~Listener"
<<std::endl);
}
#include <creaImageIOSystem.h>
#include <stdio.h>
#include <time.h>
-#include <wx/thread.h>
+
// Signal/slot mechanism
#include <boost/signal.hpp>
#include <boost/bind.hpp>
+#include <boost/thread/mutex.hpp>
namespace creaImageIO
{
///Thread method called upon exiting
void OnExit();
///Sets the new state of adding files
- void SetAddFilesState(bool addFiles){wxMutexLocker lock(mMutex);mAddFiles=addFiles;}
+ void SetAddFilesState(bool addFiles){boost::mutex::scoped_lock lock(mMutex);mAddFiles=addFiles;}
///Sets the new state of removing files
- void SetRemoveFilesState(bool removeFiles){wxMutexLocker lock(mMutex);mRemoveFiles=removeFiles;}
+ void SetRemoveFilesState(bool removeFiles){boost::mutex::scoped_lock lock(mMutex);mRemoveFiles=removeFiles;}
///Sets the new monitored drive
- void SetMonitoredDrive(const std::string& dr){wxMutexLocker lock(mMutex);mDrive=dr;}
+ void SetMonitoredDrive(const std::string& dr){boost::mutex::scoped_lock lock(mMutex);mDrive=dr;}
///Puts the name of the monitored drive in the given string
void GetMonitoredDrive(std::string& drive){drive=mDrive;}
private:
/// The mutex
- wxMutex mMutex;
+ boost::mutex mMutex;
/// Boolean that declares if the files that are read on CD mount should be added
bool mAddFiles;
/// Boolean that declares if, on CD unmount, the files that were in the drive should be removed
#include <deque>
-#include "wx/wx.h"
-#include <wx/dir.h>
-#include <wx/filename.h>
-
-
//#include <icons/close.xpm>
#include <creaWx.h>
sql +="'";
// sql += " LIMIT 1";
UPDATEDB(sql);
+ return true;
}
//=====================================================================
#include <deque>
-#include "wx/wx.h"
-#include <wx/dir.h>
-#include <wx/filename.h>
-
-#include <creaWx.h>
-using namespace crea;
-
#include <boost/filesystem.hpp>
#include <boost/algorithm/string/replace.hpp>
}
}
+ void TreeHandlerImageAdder::SaveAs(const std::vector<std::string>& filenames, std::vector<vtkImageData *> i_images)
+ {
+ std::vector<std::string>::const_iterator it_file = filenames.begin();
+ std::vector<vtkImageData *>::iterator it_image = i_images.begin();
+ /* mWriter.CanWrite(".jpeg");
+ for(; it_file != filenames.end(); ++it_file, ++it_image)
+ mWriter.WriteImage(it_file->c_str(), (vtkImageData &)it_image);*/
+ }
+
//=======================================================================
void TreeHandlerImageAdder::FindNodePartial(tree::Node* parent, int level, const std::string& searchParam, const std::string& searchVal, tree::Node*& node)
{
#include <creaImageIOTimestampDatabaseHandler.h>
#include <creaImageIOSynchron.h>
#include <creaImageIOImageReader.h>
-#include <wx/wx.h>
-#include <wx/progdlg.h>
-#include <creaWx.h>
+//#include <creaImageIOImageWriter.h>
+
// Signal/slot mechanism for progress events
#include <boost/signal.hpp>
#include <boost/bind.hpp>
std::vector<std::string> & newfiles);
///Copies the files indicated in the vector and updates all databases
void CopyFiles(const std::vector<std::string>& filenames, const std::string directory );
+
+ ///Saves as the files indicated in the vector in a specific directory
+ void SaveAs(const std::vector<std::string>& filenames, std::vector<vtkImageData *> i_images);
///Finds the node that matches the specified parameters
void FindNode(tree::Node* parent, int level,
const std::string& searchParam,
TimestampDatabaseHandler* mTimestampHandler;
Synchronizer* mSynchronizer;
ImageReader mReader;
+ //ImageWriter mWriter;
std::string mCurrentDB;
Progress mProgress;
{
i->second = planes;
}
-
+ if ( (i = attr.find("FullFileDirectory")) != attr.end())
+ {
+ std::string::size_type last_pos = filename.find_last_of("//");
+ i->second = filename.substr(0, last_pos);
+ }
+
GimmickMessage(2,"Attributes map:"<<std::endl<<attr<<std::endl);
}
//=====================================================================
//=====================================================================
//=====================================================================
- class CREAIMAGEIO_EXPORT WxGimmickReaderDialog : public wxDialog
+ class CREAIMAGEIO_EXPORT WxGimmickReaderDialog : public wxDialog
{
public:
WxGimmickReaderDialog();