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 db9ae330 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Implemented reading of whole directory structure and post-processing of tissue...

Implemented reading of whole directory structure and post-processing of tissue classification into a single multi-channel image into IvusTcDemo pipeline.
parent 3c15a583
......@@ -24,8 +24,9 @@
#include "ivustcdemo.h"
#include "tgt/event/keyevent.h"
#include "tgt/filesystem.h"
#include "core/datastructures/imagedata.h"
#include "core/datastructures/genericimagerepresentationlocal.h"
#include "core/classification/geometry1dtransferfunction.h"
#include "core/classification/tfgeometry1d.h"
......@@ -34,14 +35,21 @@ namespace campvis {
IvusTcDemo::IvusTcDemo(DataContainer* dc)
: AutoEvaluationPipeline(dc)
, p_sourceDirectory("SoruceDirectory", "Source Directory", "D:/Medical Data/IVUS/H52 LAD1", StringProperty::DIRECTORY)
, p_readImagesButton("ReadImagesButton", "Read Images")
, _lsp()
, _imageReader(&_canvasSize)
, _ve(&_canvasSize)
{
// Use AbstractPipeline overload to avoid automatic evaluation of _imageReader processor
// AbstractPipeline::addProcessor(&_imageReader);
addProcessor(&_lsp);
addProcessor(&_imageReader);
addProcessor(&_ve);
addProperty(p_sourceDirectory);
addProperty(p_readImagesButton);
addEventListenerToBack(&_ve);
}
......@@ -50,6 +58,8 @@ namespace campvis {
void IvusTcDemo::init() {
AutoEvaluationPipeline::init();
_imageReader.init();
p_readImagesButton.s_clicked.connect(this, &IvusTcDemo::readAndProcessImages);
_ve.p_outputImage.setValue("combine");
_renderTargetID.setValue("combine");
......@@ -69,8 +79,68 @@ namespace campvis {
}
void IvusTcDemo::deinit() {
_imageReader.deinit();
p_readImagesButton.s_clicked.disconnect(this);
AutoEvaluationPipeline::deinit();
}
void IvusTcDemo::readAndProcessImages() {
std::string baseDir = tgt::FileSystem::cleanupPath(p_sourceDirectory.getValue());
std::string ivusDir = baseDir + "/IVUS";
std::string cmDir = baseDir + "/Confidence_Map";
std::string calcifiedDir = baseDir + "/Calcified_Map";
std::string fibroticDir = baseDir + "/Fibrotic_Map";
std::string lipidicDir = baseDir + "/Lipidic_Map";
std::string necroticDir = baseDir + "/Necrotic_Map";
std::string plaqueDir = baseDir + "/Plaque_Mask";
// read images
readImage(ivusDir, "image.ivus");
readImage(cmDir, "image.cm");
readImage(calcifiedDir, "image.calcified");
readImage(fibroticDir , "image.fibrotic" );
readImage(lipidicDir , "image.lipidic" );
readImage(necroticDir , "image.necrotic" );
readImage(plaqueDir, "image.plaque");
// fuse TC maps into single 4-channel image
typedef uint8_t ivus_t;
GenericImageRepresentationLocal<ivus_t, 1>::ScopedRepresentation calcifiedRep(getDataContainer(), "image.calcified");
GenericImageRepresentationLocal<ivus_t, 1>::ScopedRepresentation fibroticRep(getDataContainer(), "image.fibrotic");
GenericImageRepresentationLocal<ivus_t, 1>::ScopedRepresentation lipidicRep(getDataContainer(), "image.lipidic");
GenericImageRepresentationLocal<ivus_t, 1>::ScopedRepresentation necroticRep(getDataContainer(), "image.necrotic");
if ( (calcifiedRep && fibroticRep && lipidicRep && necroticRep)
&& (calcifiedRep->getSize() == fibroticRep->getSize() && fibroticRep->getSize() == lipidicRep->getSize() && lipidicRep->getSize() == necroticRep->getSize())) {
ImageData* id = new ImageData(3, calcifiedRep->getSize(), 4);
tgt::Vector4<ivus_t>* data = new tgt::Vector4<ivus_t>[tgt::hmul(calcifiedRep->getSize())];
for (size_t i = 0; i < calcifiedRep->getNumElements(); ++i) {
data[i] = tgt::Vector4<ivus_t>(calcifiedRep->getElement(i), fibroticRep->getElement(i), lipidicRep->getElement(i), necroticRep->getElement(i));
}
GenericImageRepresentationLocal<ivus_t, 4>::create(id, data);
id->setMappingInformation(calcifiedRep->getParent()->getMappingInformation());
getDataContainer().addData("image.tc", id);
}
else {
LERROR("Could not create fused TC image.");
}
getDataContainer().removeData("image.calcified");
getDataContainer().removeData("image.fibrotic" );
getDataContainer().removeData("image.lipidic" );
getDataContainer().removeData("image.necrotic" );
}
void IvusTcDemo::readImage(const std::string& baseDir, const std::string& id) {
_imageReader.p_inputDirectory.setValue(baseDir);
_imageReader.p_outputImage.setValue(id);
_imageReader.process(getDataContainer());
}
}
\ No newline at end of file
......@@ -27,7 +27,7 @@
#include "core/pipeline/autoevaluationpipeline.h"
#include "core/properties/cameraproperty.h"
#include "core/properties/allproperties.h"
#include "modules/base/processors/lightsourceprovider.h"
#include "modules/io/processors/mhdimagereader.h"
#include "modules/io/processors/genericimagereader.h"
......@@ -59,6 +59,14 @@ namespace campvis {
static const std::string getId() { return "IvusTcDemo"; };
protected:
/// reads and processes all images from the given directory
void readAndProcessImages();
void readImage(const std::string& baseDir, const std::string& id);
StringProperty p_sourceDirectory;
ButtonProperty p_readImagesButton;
LightSourceProvider _lsp;
IvusBatchReader _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