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 { ...@@ -41,13 +41,6 @@ namespace campvis {
void AbstractImageReader::setURL(StringProperty p_url) { void AbstractImageReader::setURL(StringProperty p_url) {
this->p_url.setValue(p_url.getValue()); 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) { void AbstractImageReader::setTargetImageId(DataNameProperty& targetImageId) {
...@@ -66,4 +59,13 @@ namespace campvis { ...@@ -66,4 +59,13 @@ namespace campvis {
this->p_targetImageID.addSharedProperty(sharedProperty); 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 @@ ...@@ -37,12 +37,6 @@
#include "core/properties/datanameproperty.h" #include "core/properties/datanameproperty.h"
#include "core/properties/floatingpointproperty.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 { namespace campvis {
/** /**
* Reads an image file into the pipeline. This is mainly a wrapper class. It uses * Reads an image file into the pipeline. This is mainly a wrapper class. It uses
...@@ -64,8 +58,8 @@ namespace campvis { ...@@ -64,8 +58,8 @@ namespace campvis {
**/ **/
virtual ~AbstractImageReader(); virtual ~AbstractImageReader();
/// \see AbstractProcessor::getExtension() /// \see AbstractProcessor::acceptsExtension()
virtual const std::string getExtension() = 0; virtual bool acceptsExtension(const std::string& extenstion);
/// functions to set the property of the readers /// functions to set the property of the readers
virtual void setURL(StringProperty p_url); virtual void setURL(StringProperty p_url);
...@@ -78,7 +72,7 @@ namespace campvis { ...@@ -78,7 +72,7 @@ namespace campvis {
DataNameProperty p_targetImageID; ///< image ID for read image DataNameProperty p_targetImageID; ///< image ID for read image
protected: protected:
std::string _ext; std::vector<std::string> _ext;
static const std::string loggerCat_; static const std::string loggerCat_;
......
...@@ -40,12 +40,10 @@ namespace campvis { ...@@ -40,12 +40,10 @@ namespace campvis {
CsvdImageReader::CsvdImageReader() CsvdImageReader::CsvdImageReader()
: AbstractImageReader() : 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_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)) , 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"); this->p_targetImageID.setValue("CsvdImageReader.output");
addProperty(&p_url); addProperty(&p_url);
......
...@@ -65,9 +65,6 @@ namespace campvis { ...@@ -65,9 +65,6 @@ namespace campvis {
/// \see AbstractProcessor::getProcessorState() /// \see AbstractProcessor::getProcessorState()
virtual ProcessorState getProcessorState() const { return AbstractProcessor::EXPERIMENTAL; }; 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_imageOffset; ///< Image Offset in mm
Vec3Property p_voxelSize; ///< Voxel Size in mm Vec3Property p_voxelSize; ///< Voxel Size in mm
......
...@@ -66,12 +66,11 @@ namespace campvis { ...@@ -66,12 +66,11 @@ namespace campvis {
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) { 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->first) delete it->first;
if (nullptr != it->second) delete it->second; if (nullptr != it->second) delete it->second;
// this->_readers.erase(it);
} }
} }
void GenericImageReader::process(DataContainer& data) { void GenericImageReader::process(DataContainer& data) {
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) { 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) { if(nullptr != this->_currentlyVisible) {
this->_currentlyVisible->setVisible(false); this->_currentlyVisible->setVisible(false);
} }
...@@ -93,7 +92,7 @@ namespace campvis { ...@@ -93,7 +92,7 @@ namespace campvis {
} }
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) { 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()); (it->first)->p_url.setValue(this->p_url.getValue());
break; break;
} }
...@@ -111,7 +110,7 @@ namespace campvis { ...@@ -111,7 +110,7 @@ namespace campvis {
void GenericImageReader::setTargetImageId(DataNameProperty& targetImageId) { void GenericImageReader::setTargetImageId(DataNameProperty& targetImageId) {
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) { 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()); (it->first)->p_targetImageID.setValue(targetImageId.getValue());
std::set<AbstractProperty*> sharedProperties = targetImageId.getSharedProperties(); std::set<AbstractProperty*> sharedProperties = targetImageId.getSharedProperties();
for(std::set<AbstractProperty*>::iterator jt = sharedProperties.begin(); jt != sharedProperties.end(); jt++) { for(std::set<AbstractProperty*>::iterator jt = sharedProperties.begin(); jt != sharedProperties.end(); jt++) {
...@@ -128,7 +127,7 @@ namespace campvis { ...@@ -128,7 +127,7 @@ namespace campvis {
} }
void GenericImageReader::setTargetImageId(std::string imageId) { void GenericImageReader::setTargetImageId(std::string imageId) {
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) { 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); (it->first)->p_targetImageID.setValue(imageId);
break; break;
} }
...@@ -138,7 +137,7 @@ namespace campvis { ...@@ -138,7 +137,7 @@ namespace campvis {
void GenericImageReader::setTargetImageIdSharedProperty(DataNameProperty* sharedProperty) { void GenericImageReader::setTargetImageIdSharedProperty(DataNameProperty* sharedProperty) {
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) { 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); (it->first)->p_targetImageID.addSharedProperty(sharedProperty);
break; break;
} }
......
...@@ -91,14 +91,10 @@ namespace campvis { ...@@ -91,14 +91,10 @@ namespace campvis {
void setTargetImageId(const char* imageId); void setTargetImageId(const char* imageId);
void setTargetImageIdSharedProperty(DataNameProperty* sharedProperty); void setTargetImageIdSharedProperty(DataNameProperty* sharedProperty);
//void setMetaProperties(PropertyCollection &metaProperties);
protected: protected:
static const std::string loggerCat_; static const std::string loggerCat_;
private: private:
//std::vector<AbstractImageReader*> _readers;
std::map<AbstractImageReader*, MetaProperty*> _readers; std::map<AbstractImageReader*, MetaProperty*> _readers;
StringProperty p_url; StringProperty p_url;
std::string _ext; std::string _ext;
......
...@@ -53,7 +53,7 @@ namespace campvis { ...@@ -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_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)) , 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"); this->p_targetImageID.setValue("LtfImageReader.output");
addProperty(&p_url); addProperty(&p_url);
......
...@@ -67,9 +67,6 @@ namespace campvis { ...@@ -67,9 +67,6 @@ namespace campvis {
/// \see AbstractProcessor::getProcessorState() /// \see AbstractProcessor::getProcessorState()
virtual ProcessorState getProcessorState() const { return AbstractProcessor::EXPERIMENTAL; }; virtual ProcessorState getProcessorState() const { return AbstractProcessor::EXPERIMENTAL; };
/// \see AbstractProcessor::getExtension()
virtual const std::string getExtension() { return _ext;};
IVec3Property p_size; ///< Image size IVec3Property p_size; ///< Image size
IntProperty p_numChannels; ///< Number of channels per element IntProperty p_numChannels; ///< Number of channels per element
GenericOptionProperty<WeaklyTypedPointer::BaseType> p_baseType; ///< Base type GenericOptionProperty<WeaklyTypedPointer::BaseType> p_baseType; ///< Base type
...@@ -81,7 +78,6 @@ namespace campvis { ...@@ -81,7 +78,6 @@ namespace campvis {
static const std::string loggerCat_; static const std::string loggerCat_;
}; };
} }
#endif // LTFIMAGEREADER_H__ #endif // LTFIMAGEREADER_H__
...@@ -44,7 +44,7 @@ namespace campvis { ...@@ -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_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)) , 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"); this->p_targetImageID.setValue("MhdImageReader.output");
addProperty(&p_url); addProperty(&p_url);
addProperty(&p_targetImageID); addProperty(&p_targetImageID);
......
...@@ -65,9 +65,6 @@ namespace campvis { ...@@ -65,9 +65,6 @@ namespace campvis {
virtual const std::string getAuthor() const { return "Christian Schulte zu Berge <christian.szb@in.tum.de>"; }; virtual const std::string getAuthor() const { return "Christian Schulte zu Berge <christian.szb@in.tum.de>"; };
/// \see AbstractProcessor::getProcessorState() /// \see AbstractProcessor::getProcessorState()
virtual ProcessorState getProcessorState() const { return AbstractProcessor::TESTING; }; 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_imageOffset; ///< Image Offset in mm
Vec3Property p_voxelSize; ///< Voxel Size in mm Vec3Property p_voxelSize; ///< Voxel Size in mm
......
...@@ -58,7 +58,7 @@ namespace campvis { ...@@ -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_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)) , 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"); this->p_targetImageID.setValue("RawImageReader.output");
addProperty(&p_url); addProperty(&p_url);
......
...@@ -68,9 +68,6 @@ namespace campvis { ...@@ -68,9 +68,6 @@ namespace campvis {
/// \see AbstractProcessor::getProcessorState() /// \see AbstractProcessor::getProcessorState()
virtual ProcessorState getProcessorState() const { return AbstractProcessor::EXPERIMENTAL; }; virtual ProcessorState getProcessorState() const { return AbstractProcessor::EXPERIMENTAL; };
/// \see AbstractProcessor::getExtension()
virtual const std::string getExtension() { return _ext;};
IVec3Property p_size; ///< Image size IVec3Property p_size; ///< Image size
IntProperty p_numChannels; ///< Number of channels per element IntProperty p_numChannels; ///< Number of channels per element
GenericOptionProperty<WeaklyTypedPointer::BaseType> p_baseType; ///< Base type GenericOptionProperty<WeaklyTypedPointer::BaseType> p_baseType; ///< Base type
......
...@@ -48,7 +48,7 @@ namespace campvis { ...@@ -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_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)) , 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"); this->p_targetImageID.setValue("VtkImageReader.output");
addProperty(&p_url); addProperty(&p_url);
......
...@@ -67,9 +67,6 @@ namespace campvis { ...@@ -67,9 +67,6 @@ namespace campvis {
/// \see AbstractProcessor::getProcessorState() /// \see AbstractProcessor::getProcessorState()
virtual ProcessorState getProcessorState() const { return AbstractProcessor::EXPERIMENTAL; }; 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_imageOffset; ///< Image Offset in mm
Vec3Property p_voxelSize; ///< Voxel Size in mm Vec3Property p_voxelSize; ///< Voxel Size in mm
......
...@@ -55,23 +55,23 @@ namespace campvis { ...@@ -55,23 +55,23 @@ namespace campvis {
AutoEvaluationPipeline::init(); AutoEvaluationPipeline::init();
_imageReader.s_validated.connect(this, &VolumeExplorerDemo::onProcessorValidated); _imageReader.s_validated.connect(this, &VolumeExplorerDemo::onProcessorValidated);
_ve.p_outputImage.setValue("combine"); _ve.p_outputImage.setValue("combine");
_renderTargetID.setValue("combine"); _renderTargetID.setValue("combine");
//_imageReader.p_url.setValue("D:\\hiwi\\CAMPVis Datasets\\smallHeart.mhd"); //_imageReader.p_url.setValue("D:\\hiwi\\CAMPVis Datasets\\smallHeart.mhd");
//_imageReader.p_targetImageID.setValue("reader.output"); //_imageReader.p_targetImageID.setValue("reader.output");
//_imageReader.p_targetImageID.addSharedProperty(&_ve.p_inputVolume); //_imageReader.p_targetImageID.addSharedProperty(&_ve.p_inputVolume);
_imageReader.setURL("D:\\hiwi\\CAMPVis Datasets\\smallHeart.mhd"); _imageReader.setURL("D:\\hiwi\\CAMPVis Datasets\\smallHeart.mhd");
_imageReader.setTargetImageId("reader.output"); _imageReader.setTargetImageId("reader.output");
_imageReader.setTargetImageIdSharedProperty(&_ve.p_inputVolume); _imageReader.setTargetImageIdSharedProperty(&_ve.p_inputVolume);
Geometry1DTransferFunction* dvrTF = new Geometry1DTransferFunction(128, tgt::vec2(0.f, .05f)); Geometry1DTransferFunction* dvrTF = new Geometry1DTransferFunction(128, tgt::vec2(0.f, .05f));
dvrTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.1f, .125f), tgt::col4(255, 0, 0, 32), tgt::col4(255, 0, 0, 32))); dvrTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.1f, .125f), tgt::col4(255, 0, 0, 32), tgt::col4(255, 0, 0, 32)));
dvrTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.4f, .5f), tgt::col4(0, 255, 0, 128), tgt::col4(0, 255, 0, 128))); dvrTF->addGeometry(TFGeometry1D::createQuad(tgt::vec2(.4f, .5f), tgt::col4(0, 255, 0, 128), tgt::col4(0, 255, 0, 128)));
static_cast<TransferFunctionProperty*>(_ve.getProperty("TransferFunction"))->replaceTF(dvrTF); static_cast<TransferFunctionProperty*>(_ve.getProperty("TransferFunction"))->replaceTF(dvrTF);
_canvasSize.s_changed.connect<VolumeExplorerDemo>(this, &VolumeExplorerDemo::onRenderTargetSizeChanged); _canvasSize.s_changed.connect<VolumeExplorerDemo>(this, &VolumeExplorerDemo::onRenderTargetSizeChanged);
} }
......
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