7 #include "fwDataIO/reader/TagReader.hpp" 9 #include "fwDataIO/reader/registry/macros.hpp" 11 #include <fwData/location/SingleFile.hpp> 12 #include <fwData/Point.hpp> 13 #include <fwData/PointList.hpp> 14 #include <fwData/Tag.hpp> 16 #include <fwMath/IntrasecTypes.hpp> 46 assert( ::std::dynamic_pointer_cast< ::fwData::location::SingleFile >(
m_location) );
47 ::boost::filesystem::path path =
50 OSLM_INFO(
"[TagReader::read] Tag file: " << path);
51 assert( path.empty() == false );
56 file.open(path.string().c_str(), std::fstream::in);
59 OSLM_ERROR(
"Tag file loading error for " << path.string());
60 std::string str =
"Unable to open ";
62 throw std::ios_base::failure(str);
66 std::string name, type;
74 if(type ==
"ARTAG" || type ==
"CHESSBOARD" || type ==
"ARToolKitPlus_MARKER_ID_BCH")
82 for(
int i = 0; i < nbPts; i++)
84 ::fwData::Point::sptr p;
86 file>>vPoint[0]>>vPoint[1]>>vPoint[2]>>radius;
88 tag->getPointList()->getPoints().push_back(p);
93 SLM_ERROR(
"Tag file loading error for " + path.string() +
" with type " + type);
94 std::string str =
"Unable to open ";
96 throw std::ios_base::failure(str);
virtual FWDATAIO_API ~TagReader()
Destructor. Do nothing.
This class defines a single file location.
FWDATAIO_API TagReader(::fwDataIO::reader::IObjectReader::Key key)
Constructor. Do nothing.
This namespace fwDataIO contains reader and writer for several framework's data.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
#define OSLM_INFO(message)
#define SLM_ERROR(message)
#define OSLM_ERROR(message)
virtual std::shared_ptr< DataType > getConcreteObject()
m_object getter.
virtual FWDATAIO_API void read() override
Read the file .tag.
Base class for all object readers.
Contains the representation of the data objects used in the framework.
FWDATAIO_API std::string extension() override
Defines extension supported by this reader ".tag".
::fwData::location::ILocation::sptr m_location
Object location ( file path, directory path, url, etc )
Tag Reader. Read file format .tag.