7 #include "ioVTK/SImageSeriesWriter.hpp" 9 #include "ioVTK/SImageWriter.hpp" 11 #include <fwCom/HasSignals.hpp> 12 #include <fwCom/Signal.hpp> 13 #include <fwCom/Signal.hxx> 15 #include <fwCore/base.hpp> 17 #include <fwData/Image.hpp> 18 #include <fwData/location/Folder.hpp> 19 #include <fwData/location/SingleFile.hpp> 21 #include <fwDataIO/reader/IObjectReader.hpp> 23 #include <fwGui/Cursor.hpp> 24 #include <fwGui/dialog/LocationDialog.hpp> 25 #include <fwGui/dialog/MessageDialog.hpp> 26 #include <fwGui/dialog/ProgressDialog.hpp> 28 #include <fwIO/IWriter.hpp> 30 #include <fwJobs/IJob.hpp> 31 #include <fwJobs/Job.hpp> 33 #include <fwMedData/ImageSeries.hpp> 35 #include <fwServices/macros.hpp> 37 #include <fwTools/Failed.hpp> 39 #include <fwVtkIO/ImageWriter.hpp> 40 #include <fwVtkIO/MetaImageWriter.hpp> 41 #include <fwVtkIO/VtiImageWriter.hpp> 43 #include <boost/algorithm/string.hpp> 50 static const ::fwCom::Signals::SignalKeyType JOB_CREATED_SIGNAL =
"jobCreated";
56 m_sigJobCreated = newSignal< JobCreatedSignalType >( JOB_CREATED_SIGNAL );
71 static ::boost::filesystem::path _sDefaultPath(
"");
78 dialogFile.
addFilter(
"MetaImage",
"*.mhd");
79 dialogFile.
setOption(::fwGui::dialog::ILocationDialog::WRITE);
81 ::fwData::location::SingleFile::sptr result;
82 result = ::fwData::location::SingleFile::dynamicCast( dialogFile.
show() );
85 _sDefaultPath = result->getPath().parent_path();
87 this->
setFile(result->getPath());
121 _sstream <<
"SImageSeriesWriter::info";
133 ::fwMedData::ImageSeries::csptr imageSeries = this->getInput< ::fwMedData::ImageSeries >(::fwIO::s_DATA_KEY);
137 imageSeries = this->getObject< ::fwMedData::ImageSeries >();
139 SLM_ASSERT(
"ImageSeries is not instanced", imageSeries);
140 SLM_ASSERT(
"Image from ImageSeries is not instanced", imageSeries->getImage());
143 cursor.
setCursor(::fwGui::ICursor::BUSY);
152 FW_RAISE_EXCEPTION(e);
154 cursor.setDefaultCursor();
#define FW_DEPRECATED_KEY(newKey, access, version)
Use this macro when deprecating a service key to warn the developer.
virtual FWGUI_API void setCursor(::fwGui::ICursor::CursorType cursor) override
Set the cursor.
#define SLM_TRACE_FUNC()
Trace contextual function signature.
virtual IOVTK_API void starting() override
Starting method.
IOVTK_API void info(std::ostream &_sstream) override
Info method.
virtual FWGUI_API void setDefaultLocation(::fwData::location::ILocation::sptr loc) override
Set the initial location for the dialog.
IOVTK_API void updating() override
Updating method.
FWGUI_API::fwGui::dialog::ILocationDialog & setOption(::fwGui::dialog::ILocationDialog::Options option) override
allow to set option to the file dialog mode=READ/WRITE, check=FILE_MUST_EXIST
FWGUI_API::fwData::location::ILocation::sptr show() override
Display the dialog.
#define OSLM_TRACE(message)
FWGUI_API void addFilter(const std::string &filterName, const std::string &wildcardList) override
specify some filtering when browsing files:
IOVTK_API SImageSeriesWriter() noexcept
Constructor. Do nothing.
FWIO_API void setFile(const ::boost::filesystem::path &file)
Sets file path.
virtual IOVTK_API void configureWithIHM() override
Configure the image path.
virtual FWIO_API void configuring() override
This method proposes to parse xml configuration to retrieve file/files/folder paths.
FWIO_APIconst::boost::filesystem::path & getFile() const
Returns the file path set by the user or set during service configuration.
static IOVTK_API bool saveImage(const ::boost::filesystem::path &imgFile, const std::shared_ptr< const ::fwData::Image > &image, const std::shared_ptr< JobCreatedSignalType > &sigJobCreated)
Save a VTK image.
FWIO_API void clearLocations()
Clear any location set by the setFile/setFiles/setFolder setter.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
virtual IOVTK_API void stopping() override
Stopping method.
IOPathType
IOPathType defines different type of paths used by service readers/writers.
Writer service API. It manages extension points definition and extension configuration.
FWGUI_API void setTitle(const std::string &title) override
Set the title for the dialog.
Defines the generic file/folder selector dialog for IHM.
Defines the generic cursor for IHM. Use the Delegate design pattern.
FWGUI_API void saveDefaultLocation(::fwData::location::ILocation::sptr loc) override
Save the specified default location for the dialog in preferences (if available)
virtual IOVTK_API void configuring() override
Configuring method.
The namespace ioVTK contains reader, writer and helper using the fwVtkIO lib for output and input act...
FWIO_API bool hasLocationDefined() const
Returns if a location has been defined ( by the configuration process or directly by user ) ...
std::string m_windowTitle
Title of the window that will open when the configureWithIHM slot is called.
virtual IOVTK_API::fwIO::IOPathType getIOPathType() const override
This method must be implemented by concrete service writers that use path file system to write data...