Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit f29fd4b1 authored by Hossain Mahmud's avatar Hossain Mahmud
Browse files

Loading can be done with genericImageReader, however, assertion fails for...

Loading can be done with genericImageReader, however, assertion fails for sliders. thread ownership issues
parent 30b3896a
......@@ -64,28 +64,10 @@ namespace campvis {
**/
virtual ~AbstractImageReader();
/**
* Provides the interface for the classes that reads images from different types
* of files into ImageRepresentationDisk representation
* \param data DataContainer to work on
*/
//virtual void process(DataContainer& data);
///// \see AbstractProcessor::getName()
//virtual const std::string getName() = 0;
///// \see AbstractProcessor::getDescription()
//virtual const std::string getDescription() = 0;
///// \see AbstractProcessor::getAuthor()
//virtual const std::string getAuthor() = 0;
///// \see AbstractProcessor::getProcessorState()
//virtual ProcessorState getProcessorState() = 0;
/// \see AbstractProcessor::getExtension()
virtual const std::string getExtension() = 0;
/// \see AbstractProcessor::getMetaProperties()
virtual PropertyCollection& getMetaProperties() = 0;
//virtual PropertyCollection& getMetaProperties() = 0;
/// functions to set the property of the readers
virtual void setURL(StringProperty p_url);
......
......@@ -50,7 +50,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 = "csv";
this->_ext = ".csv";
this->p_targetImageID.setValue("CsvdImageReader.output");
addProperty(&p_url);
......@@ -185,8 +185,8 @@ namespace campvis {
}
PropertyCollection& CsvdImageReader::getMetaProperties() {
PropertyCollection dummy;
return dummy;
}
//PropertyCollection& CsvdImageReader::getMetaProperties() {
// PropertyCollection dummy;
// return dummy;
//}
}
\ No newline at end of file
......@@ -73,7 +73,7 @@ namespace campvis {
/// \see AbstractProcessor::getExtension()
virtual const std::string getExtension() { return _ext;};
/// \see AbstractProcessor::getMetaProperties()
PropertyCollection& getMetaProperties();
//PropertyCollection& getMetaProperties();
Vec3Property p_imageOffset; ///< Image Offset in mm
Vec3Property p_voxelSize; ///< Voxel Size in mm
......
......@@ -45,76 +45,105 @@ namespace campvis {
: AbstractProcessor()
, p_url("url", "Image URL", "")
{
//CsvdImageReader *_csvdImageReader = new CsvdImageReader();
//this->_readers.push_back(_csvdImageReader);
//LtfImageReader *_ltfImageReader = new LtfImageReader();
//this->_readers.push_back(_ltfImageReader);
//MhdImageReader *_mhdImageReader = new MhdImageReader();
//this->_readers.push_back(_mhdImageReader);
//RawImageReader *_rawImageReader = new RawImageReader();
//this->_readers.push_back(_rawImageReader);
//VtkImageReader *_vtkImageReader = new VtkImageReader();
//this->_readers.push_back(_vtkImageReader);
this->_readers.push_back(new CsvdImageReader());
this->_readers.push_back(new LtfImageReader());
this->_readers.push_back(new MhdImageReader());
this->_readers.push_back(new RawImageReader());
this->_readers.push_back(new VtkImageReader());
//MhdImageReader* reader = new MhdImageReader();
//MetaProperty* meta = new MetaProperty(reader->getName()+"MetaProp", reader->getName());
//meta->addPropertyCollection(*reader);
//this->addProperty(meta);
//this->_readers.insert(std::pair<AbstractImageReader*, MetaProperty*>(reader, meta));
this->addReader(new CsvdImageReader());
this->addReader(new LtfImageReader());
this->addReader(new MhdImageReader());
this->addReader(new RawImageReader());
this->addReader(new VtkImageReader());
this->_ext = "";
this->_currentlyVisible = nullptr;
//this->_readers.push_back(new CsvdImageReader());
//this->_readers.push_back(new LtfImageReader());
//this->_readers.push_back(new MhdImageReader());
//this->_readers.push_back(new RawImageReader());
//this->_readers.push_back(new VtkImageReader());
}
GenericImageReader::~GenericImageReader() {
for(std::vector<AbstractImageReader*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
delete *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->second) delete it->second;
this->_readers.erase(it);
}
}
void GenericImageReader::process(DataContainer& data) {
for(std::vector<AbstractImageReader*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((*it)->getExtension() == this->_ext) {
(*it)->process(data);
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((it->first)->getExtension() == this->_ext) {
if(nullptr != this->_currentlyVisible) {
this->_currentlyVisible->setVisible(false);
}
(it->second)->setVisible(true);
this->_currentlyVisible = it->second;
(it->first)->process(data);
break;
}
}
return;
}
void GenericImageReader::setURL(StringProperty p_url) {
this->p_url.setValue(p_url.getValue());
for(std::vector<AbstractImageReader*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((*it)->getExtension() == this->_ext) {
(*it)->p_url.setValue(this->p_url.getValue());
break;
}
}
void GenericImageReader::setURL(std::string p_url) {
this->p_url.setValue(p_url);
std::string url = this->p_url.getValue();
unsigned extPos = (unsigned) url.rfind('.');
if (extPos != std::string::npos) {
this->_ext = url.substr(extPos);
}
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((it->first)->getExtension() == this->_ext) {
(it->first)->p_url.setValue(this->p_url.getValue());
/* if(nullptr != this->_currentlyVisible) {
this->_currentlyVisible->setVisible(false);
}
(it->second)->setVisible(true);
this->_currentlyVisible = it->second;*/
break;
}
}
return;
}
void GenericImageReader::setURL(StringProperty p_url) {
return this->setURL(p_url.getValue());
}
void GenericImageReader::setURL(const char* p_url) {
return this->setURL(std::string(p_url));
}
void GenericImageReader::setTargetImageId(DataNameProperty& targetImageId) {
for(std::vector<AbstractImageReader*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((*it)->getExtension() == this->_ext) {
(*it)->p_targetImageID.setValue(targetImageId.getValue());
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((it->first)->getExtension() == 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++) {
(*it)->p_targetImageID.addSharedProperty(*jt);
(it->first)->p_targetImageID.addSharedProperty(*jt);
}
break;
}
}
return;
}
void GenericImageReader::setTargetImageId(const char* imageId) {
return this->setTargetImageId(std::string(imageId));
}
void GenericImageReader::setTargetImageId(std::string imageId) {
for(std::vector<AbstractImageReader*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((*it)->getExtension() == this->_ext) {
(*it)->p_targetImageID.setValue(imageId);
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((it->first)->getExtension() == this->_ext) {
(it->first)->p_targetImageID.setValue(imageId);
break;
}
}
......@@ -122,17 +151,26 @@ namespace campvis {
}
void GenericImageReader::setTargetImageIdSharedProperty(DataNameProperty* sharedProperty) {
for(std::vector<AbstractImageReader*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((*it)->getExtension() == this->_ext) {
(*it)->p_targetImageID.addSharedProperty(sharedProperty);
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((it->first)->getExtension() == this->_ext) {
(it->first)->p_targetImageID.addSharedProperty(sharedProperty);
break;
}
}
return;
}
void GenericImageReader::setMetaProperties(PropertyCollection &metaProperties) {
return;
//void GenericImageReader::setMetaProperties(PropertyCollection &metaProperties) {
// return;
//}
int GenericImageReader::addReader(AbstractImageReader* reader) {
MetaProperty* meta = new MetaProperty(reader->getName()+"MetaProp", reader->getName());
meta->addPropertyCollection(*reader);
meta->setVisible(false);
this->addProperty(meta);
this->_readers.insert(std::pair<AbstractImageReader*, MetaProperty*>(reader, meta));
return 0;
}
}
\ No newline at end of file
......@@ -35,6 +35,7 @@
#include "core/pipeline/abstractprocessor.h"
#include "core/properties/datanameproperty.h"
#include "core/properties/floatingpointproperty.h"
#include "core/properties/metaproperty.h"
#include "modules/io/processors/csvdimagereader.h"
#include "modules/io/processors/ltfimagereader.h"
......@@ -77,29 +78,36 @@ namespace campvis {
virtual ProcessorState getProcessorState() const { return AbstractProcessor::TESTING; };
/// functions to set the property of the readers
void setURL(std::string p_url);
void setURL(StringProperty p_url);
void setURL(const char* p_url);
void setTargetImageId(DataNameProperty& targetImageId);
void setTargetImageId(std::string imageId);
void setTargetImageId(const char* imageId);
void setTargetImageIdSharedProperty(DataNameProperty* sharedProperty);
void setMetaProperties(PropertyCollection &metaProperties);
//void setMetaProperties(PropertyCollection &metaProperties);
protected:
static const std::string loggerCat_;
private:
std::vector<AbstractImageReader*> _readers;
//std::vector<AbstractImageReader*> _readers;
std::map<AbstractImageReader*, MetaProperty*> _readers;
StringProperty p_url;
std::string _ext;
MetaProperty* _currentlyVisible;
CsvdImageReader _csvdImageReader;
LtfImageReader _ltfImageReader;
MhdImageReader _mhdImageReader;
RawImageReader _rawImageReader;
VtkImageReader _vtkImageReader;
/**
* Adds a particular reader to the generic reader
* Creates MetaProperty wrapper for the added reader, that
* is freed from the destructor of the class
*
* /param reader pointer to the reader to be added
*/
int addReader(AbstractImageReader* reader);
//std::map<std::string, std::string> _extMap;
};
}
......
......@@ -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 = "ltf";
this->_ext = ".ltf";
this->p_targetImageID.setValue("LtfImageReader.output");
addProperty(&p_url);
......@@ -105,8 +105,8 @@ namespace campvis {
validate(INVALID_RESULT);
}
PropertyCollection& LtfImageReader::getMetaProperties() {
PropertyCollection dummy;
return dummy;
}
//PropertyCollection& LtfImageReader::getMetaProperties() {
// PropertyCollection dummy;
// return dummy;
//}
}
......@@ -75,7 +75,7 @@ namespace campvis {
/// \see AbstractProcessor::getExtension()
virtual const std::string getExtension() { return _ext;};
/// \see AbstractProcessor::getMetaProperties()
PropertyCollection& getMetaProperties();
//PropertyCollection& getMetaProperties();
IVec3Property p_size; ///< Image size
IntProperty p_numChannels; ///< Number of channels per element
......
......@@ -49,7 +49,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 = "mhd";
this->_ext = ".mhd";
this->p_targetImageID.setValue("MhdImageReader.output");
addProperty(&p_url);
addProperty(&p_targetImageID);
......@@ -203,8 +203,8 @@ namespace campvis {
validate(INVALID_RESULT);
}
PropertyCollection& MhdImageReader::getMetaProperties() {
PropertyCollection dummy;
return dummy;
}
//PropertyCollection& MhdImageReader::getMetaProperties() {
// PropertyCollection dummy;
// return dummy;
//}
}
\ No newline at end of file
......@@ -74,7 +74,7 @@ namespace campvis {
/// \see AbstractProcessor::getExtension()
virtual const std::string getExtension() { return _ext;};
/// \see AbstractProcessor::getMetaProperties()
PropertyCollection& getMetaProperties();
//PropertyCollection& getMetaProperties();
Vec3Property p_imageOffset; ///< Image Offset in mm
Vec3Property p_voxelSize; ///< Voxel Size in mm
......
......@@ -63,7 +63,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 = "raw";
this->_ext = ".raw";
this->p_targetImageID.setValue("RawImageReader.output");
addProperty(&p_url);
......@@ -95,8 +95,8 @@ namespace campvis {
validate(INVALID_RESULT);
}
PropertyCollection& RawImageReader::getMetaProperties() {
PropertyCollection dummy;
return dummy;
}
//PropertyCollection& RawImageReader::getMetaProperties() {
// PropertyCollection dummy;
// return dummy;
//}
}
......@@ -76,7 +76,7 @@ namespace campvis {
/// \see AbstractProcessor::getExtension()
virtual const std::string getExtension() { return _ext;};
/// \see AbstractProcessor::getMetaProperties()
PropertyCollection& getMetaProperties();
//PropertyCollection& getMetaProperties();
IVec3Property p_size; ///< Image size
IntProperty p_numChannels; ///< Number of channels per element
......
......@@ -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 = "vtk";
this->_ext = ".vtk";
this->p_targetImageID.setValue("VtkImageReader.output");
addProperty(&p_url);
......@@ -273,8 +273,8 @@ namespace campvis {
data.addData(p_targetImageID.getValue(), g);
}
PropertyCollection& VtkImageReader::getMetaProperties() {
PropertyCollection dummy;
return dummy;
}
//PropertyCollection& VtkImageReader::getMetaProperties() {
// PropertyCollection dummy;
// return dummy;
//}
}
\ No newline at end of file
......@@ -75,7 +75,7 @@ namespace campvis {
/// \see AbstractProcessor::getExtension()
virtual const std::string getExtension() { return _ext;};
/// \see AbstractProcessor::getMetaProperties()
PropertyCollection& getMetaProperties();
//PropertyCollection& getMetaProperties();
Vec3Property p_imageOffset; ///< Image Offset in mm
Vec3Property p_voxelSize; ///< Voxel Size in mm
......
......@@ -58,10 +58,14 @@ namespace campvis {
_ve.p_outputImage.setValue("combine");
_renderTargetID.setValue("combine");
_imageReader.p_url.setValue("D:\\Medical Data\\smallHeart.mhd");
_imageReader.p_targetImageID.setValue("reader.output");
_imageReader.p_targetImageID.addSharedProperty(&_ve.p_inputVolume);
//_imageReader.p_url.setValue("D:\\hiwi\\CAMPVis Datasets\\smallHeart.mhd");
//_imageReader.p_targetImageID.setValue("reader.output");
//_imageReader.p_targetImageID.addSharedProperty(&_ve.p_inputVolume);
_imageReader.setURL("D:\\hiwi\\CAMPVis Datasets\\smallHeart.mhd");
_imageReader.setTargetImageId("reader.output");
_imageReader.setTargetImageIdSharedProperty(&_ve.p_inputVolume);
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)));
......
......@@ -33,6 +33,7 @@
#include "core/pipeline/autoevaluationpipeline.h"
#include "core/properties/cameraproperty.h"
#include "modules/io/processors/mhdimagereader.h"
#include "modules/io/processors/genericimagereader.h"
#include "modules/vis/processors/volumeexplorer.h"
namespace campvis {
......@@ -68,7 +69,8 @@ namespace campvis {
*/
virtual void onProcessorValidated(AbstractProcessor* processor);
MhdImageReader _imageReader;
//MhdImageReader _imageReader;
GenericImageReader _imageReader;
VolumeExplorer _ve;
};
......
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