Commit 153431d2 authored by Hossain Mahmud's avatar Hossain Mahmud
Browse files

handled all merge notes except functor

parent 7434135c
......@@ -41,13 +41,6 @@ namespace campvis {
void AbstractImageReader::setURL(StringProperty p_url) {
this->p_url.setValue(p_url.getValue());
std::string url = this->p_url.getValue();
unsigned extPos = (unsigned) url.rfind('.');
if (extPos != std::string::npos) {
this->_ext = url.substr(extPos);
}
}
void AbstractImageReader::setTargetImageId(DataNameProperty& targetImageId) {
......@@ -66,4 +59,13 @@ namespace campvis {
this->p_targetImageID.addSharedProperty(sharedProperty);
}
bool AbstractImageReader::acceptsExtension(const std::string& extension) {
for(std::vector<std::string>::iterator it = this->_ext.begin(); it != this->_ext.end(); it++) {
if(*it == extension) {
return true;
}
}
return false;
}
}
\ No newline at end of file
......@@ -37,12 +37,6 @@
#include "core/properties/datanameproperty.h"
#include "core/properties/floatingpointproperty.h"
#define EXT_MHD_FILE ".mhd"
#define EXT_CSV_FILE ".csv"
#define EXT_LTF_FILE ".ltf"
#define EXT_VTK_FILE ".vtk"
#define EXT_RQW_FILE ".raw"
namespace campvis {
/**
* Reads an image file into the pipeline. This is mainly a wrapper class. It uses
......@@ -64,8 +58,8 @@ namespace campvis {
**/
virtual ~AbstractImageReader();
/// \see AbstractProcessor::getExtension()
virtual const std::string getExtension() = 0;
/// \see AbstractProcessor::acceptsExtension()
virtual bool acceptsExtension(const std::string& extenstion);
/// functions to set the property of the readers
virtual void setURL(StringProperty p_url);
......@@ -78,7 +72,7 @@ namespace campvis {
DataNameProperty p_targetImageID; ///< image ID for read image
protected:
std::string _ext;
std::vector<std::string> _ext;
static const std::string loggerCat_;
......
......@@ -40,12 +40,10 @@ namespace campvis {
CsvdImageReader::CsvdImageReader()
: AbstractImageReader()
//, p_url("url", "Image URL", "")
//, p_targetImageID("targetImageName", "Target Image ID", "CsvdImageReader.output", DataNameProperty::WRITE)
, p_imageOffset("ImageOffset", "Image Offset in mm", tgt::vec3(0.f), tgt::vec3(-10000.f), tgt::vec3(10000.f), tgt::vec3(0.1f))
, p_voxelSize("VoxelSize", "Voxel Size in mm", tgt::vec3(1.f), tgt::vec3(-100.f), tgt::vec3(100.f), tgt::vec3(0.1f))
{
this->_ext = EXT_CSV_FILE;
this->_ext.push_back(".csv");
this->p_targetImageID.setValue("CsvdImageReader.output");
addProperty(&p_url);
......
......@@ -65,9 +65,6 @@ namespace campvis {
/// \see AbstractProcessor::getProcessorState()
virtual ProcessorState getProcessorState() const { return AbstractProcessor::EXPERIMENTAL; };
/// \see AbstractProcessor::getExtension()
virtual const std::string getExtension() { return _ext;};
Vec3Property p_imageOffset; ///< Image Offset in mm
Vec3Property p_voxelSize; ///< Voxel Size in mm
......
......@@ -66,12 +66,11 @@ namespace campvis {
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if (nullptr != it->first) delete it->first;
if (nullptr != it->second) delete it->second;
// this->_readers.erase(it);
}
}
void GenericImageReader::process(DataContainer& data) {
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((it->first)->getExtension() == this->_ext) {
if((it->first)->acceptsExtension(this->_ext)) {
if(nullptr != this->_currentlyVisible) {
this->_currentlyVisible->setVisible(false);
}
......@@ -93,7 +92,7 @@ namespace campvis {
}
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((it->first)->getExtension() == this->_ext) {
if((it->first)->acceptsExtension(this->_ext)) {
(it->first)->p_url.setValue(this->p_url.getValue());
break;
}
......@@ -111,7 +110,7 @@ namespace campvis {
void GenericImageReader::setTargetImageId(DataNameProperty& targetImageId) {
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((it->first)->getExtension() == this->_ext) {
if((it->first)->acceptsExtension(this->_ext)) {
(it->first)->p_targetImageID.setValue(targetImageId.getValue());
std::set<AbstractProperty*> sharedProperties = targetImageId.getSharedProperties();
for(std::set<AbstractProperty*>::iterator jt = sharedProperties.begin(); jt != sharedProperties.end(); jt++) {
......@@ -128,7 +127,7 @@ namespace campvis {
}
void GenericImageReader::setTargetImageId(std::string imageId) {
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((it->first)->getExtension() == this->_ext) {
if((it->first)->acceptsExtension(this->_ext)) {
(it->first)->p_targetImageID.setValue(imageId);
break;
}
......@@ -138,7 +137,7 @@ namespace campvis {
void GenericImageReader::setTargetImageIdSharedProperty(DataNameProperty* sharedProperty) {
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((it->first)->getExtension() == this->_ext) {
if((it->first)->acceptsExtension(this->_ext)) {
(it->first)->p_targetImageID.addSharedProperty(sharedProperty);
break;
}
......
......@@ -91,14 +91,10 @@ namespace campvis {
void setTargetImageId(const char* imageId);
void setTargetImageIdSharedProperty(DataNameProperty* sharedProperty);
//void setMetaProperties(PropertyCollection &metaProperties);
protected:
static const std::string loggerCat_;
private:
//std::vector<AbstractImageReader*> _readers;
std::map<AbstractImageReader*, MetaProperty*> _readers;
StringProperty p_url;
std::string _ext;
......
......@@ -53,7 +53,7 @@ namespace campvis {
, p_imageOffset("ImageOffset", "Image Offset in mm", tgt::vec3(0.f), tgt::vec3(-10000.f), tgt::vec3(10000.f), tgt::vec3(0.1f))
, p_voxelSize("VoxelSize", "Voxel Size in mm", tgt::vec3(1.f), tgt::vec3(-100.f), tgt::vec3(100.f), tgt::vec3(0.1f))
{
this->_ext = EXT_LTF_FILE;
this->_ext.push_back(".ltf");
this->p_targetImageID.setValue("LtfImageReader.output");
addProperty(&p_url);
......
......@@ -67,9 +67,6 @@ namespace campvis {
/// \see AbstractProcessor::getProcessorState()
virtual ProcessorState getProcessorState() const { return AbstractProcessor::EXPERIMENTAL; };
/// \see AbstractProcessor::getExtension()
virtual const std::string getExtension() { return _ext;};
IVec3Property p_size; ///< Image size
IntProperty p_numChannels; ///< Number of channels per element
GenericOptionProperty<WeaklyTypedPointer::BaseType> p_baseType; ///< Base type
......@@ -81,7 +78,6 @@ namespace campvis {
static const std::string loggerCat_;
};
}
#endif // LTFIMAGEREADER_H__
......@@ -44,7 +44,7 @@ namespace campvis {
, p_imageOffset("ImageOffset", "Image Offset in mm", tgt::vec3(0.f), tgt::vec3(-10000.f), tgt::vec3(10000.f), tgt::vec3(0.1f))
, p_voxelSize("VoxelSize", "Voxel Size in mm", tgt::vec3(1.f), tgt::vec3(-100.f), tgt::vec3(100.f), tgt::vec3(0.1f))
{
this->_ext = EXT_MHD_FILE;
this->_ext.push_back(".mhd");
this->p_targetImageID.setValue("MhdImageReader.output");
addProperty(&p_url);
addProperty(&p_targetImageID);
......
......@@ -66,9 +66,6 @@ namespace campvis {
/// \see AbstractProcessor::getProcessorState()
virtual ProcessorState getProcessorState() const { return AbstractProcessor::TESTING; };
/// \see AbstractProcessor::getExtension()
virtual const std::string getExtension() { return _ext;};
Vec3Property p_imageOffset; ///< Image Offset in mm
Vec3Property p_voxelSize; ///< Voxel Size in mm
......
......@@ -58,7 +58,7 @@ namespace campvis {
, p_imageOffset("ImageOffset", "Image Offset in mm", tgt::vec3(0.f), tgt::vec3(-10000.f), tgt::vec3(10000.f), tgt::vec3(0.1f))
, p_voxelSize("VoxelSize", "Voxel Size in mm", tgt::vec3(1.f), tgt::vec3(-100.f), tgt::vec3(100.f), tgt::vec3(0.1f))
{
this->_ext = EXT_RQW_FILE;
this->_ext.push_back(".raw");
this->p_targetImageID.setValue("RawImageReader.output");
addProperty(&p_url);
......
......@@ -68,9 +68,6 @@ namespace campvis {
/// \see AbstractProcessor::getProcessorState()
virtual ProcessorState getProcessorState() const { return AbstractProcessor::EXPERIMENTAL; };
/// \see AbstractProcessor::getExtension()
virtual const std::string getExtension() { return _ext;};
IVec3Property p_size; ///< Image size
IntProperty p_numChannels; ///< Number of channels per element
GenericOptionProperty<WeaklyTypedPointer::BaseType> p_baseType; ///< Base type
......
......@@ -48,7 +48,7 @@ namespace campvis {
, p_imageOffset("ImageOffset", "Image Offset in mm", tgt::vec3(0.f), tgt::vec3(-10000.f), tgt::vec3(10000.f), tgt::vec3(0.1f))
, p_voxelSize("VoxelSize", "Voxel Size in mm", tgt::vec3(1.f), tgt::vec3(-100.f), tgt::vec3(100.f), tgt::vec3(0.1f))
{
this->_ext = EXT_VTK_FILE;
this->_ext.push_back(".vtk");
this->p_targetImageID.setValue("VtkImageReader.output");
addProperty(&p_url);
......
......@@ -67,9 +67,6 @@ namespace campvis {
/// \see AbstractProcessor::getProcessorState()
virtual ProcessorState getProcessorState() const { return AbstractProcessor::EXPERIMENTAL; };
/// \see AbstractProcessor::getExtension()
virtual const std::string getExtension() { return _ext;};
Vec3Property p_imageOffset; ///< Image Offset in mm
Vec3Property p_voxelSize; ///< Voxel Size in mm
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment