20 #include <Poco/Path.h>
34 const Image *image =
dynamic_cast<const Image *
>(m_Data.GetPointer());
37 MITK_ERROR <<
" Object at " << (
const void *)this->m_Data <<
" is not an mitk::Image. Cannot serialize as image.";
41 std::string
filename(this->GetUniqueFilenameInWorkingDirectory());
42 std::cout <<
"creating file " << filename <<
" in " << m_WorkingDirectory << std::endl;
44 filename += m_FilenameHint;
46 std::string fullname(m_WorkingDirectory);
47 fullname += Poco::Path::separator();
48 fullname += filename +
".nrrd";
54 catch (std::exception &e)
56 MITK_ERROR <<
" Error serializing object at " << (
const void *)this->m_Data <<
" to " << fullname <<
": "
60 return Poco::Path(fullname).getFileName();
static void Save(const mitk::BaseData *data, const std::string &path)
Save a mitk::BaseData instance.
#define MITK_REGISTER_SERIALIZER(classname)
DataCollection - Class to facilitate loading/accessing structured data.
Serializes mitk::Image for mitk::SceneIO.
virtual ~ImageSerializer()
static const std::string filename
Image class for storing images.
virtual std::string Serialize() override
Serializes given BaseData object.