* Added Number of Channels label to DataContainerInspectorWidget

* Added assertion in ImageRepresentationGL constructor checking for matching number of channels
parent 32045906
......@@ -73,6 +73,7 @@ namespace campvis {
, _infoWidget(0)
, _infoWidgetLayout(0)
, _lblName(0)
, _lblNumChannels(0)
, _lblLocalMemoryFootprint(0)
, _lblVideoMemoryFootprint(0)
, _lblTimestamp(0)
......@@ -162,15 +163,18 @@ namespace campvis {
_lblTimestamp = new QLabel("Timestamp: ", _infoWidget);
_infoWidgetLayout->addWidget(_lblTimestamp, 0, 1);
_lblLocalMemoryFootprint = new QLabel(QString("Local Memory: "), _infoWidget);
_infoWidgetLayout->addWidget(_lblLocalMemoryFootprint, 1, 0);
_lblNumChannels = new QLabel("Number of Channels: ", _infoWidget);
_infoWidgetLayout->addWidget(_lblNumChannels, 1, 0);
_lblVideoMemoryFootprint = new QLabel(QString("Video Memory: "), _infoWidget);
_infoWidgetLayout->addWidget(_lblVideoMemoryFootprint, 1, 1);
_lblLocalMemoryFootprint = new QLabel(QString("Local Memory: "), _infoWidget);
_infoWidgetLayout->addWidget(_lblLocalMemoryFootprint, 1, 1);
_lblSize = new QLabel(tr("Size: "), _infoWidget);
_infoWidgetLayout->addWidget(_lblSize, 2, 0);
_lblVideoMemoryFootprint = new QLabel(QString("Video Memory: "), _infoWidget);
_infoWidgetLayout->addWidget(_lblVideoMemoryFootprint, 2, 1);
_lblBounds = new QLabel(tr("World Bounds:"), _infoWidget);
_infoWidgetLayout->addWidget(_lblBounds, 3, 0, 1, 2);
......@@ -274,6 +278,9 @@ namespace campvis {
if (const ImageData* tester = dynamic_cast<const ImageData*>(handles.front().second.getData())) {
_canvas->p_transferFunction.setImageHandle(handles.front().second);
_lblNumChannels->setText(tr("Number of Channels: ") + QString::number(tester->getNumChannels()));
std::ostringstream ss;
ss << tester->getSize();
......@@ -293,6 +300,7 @@ namespace campvis {
}
else if (const GeometryData* tester = dynamic_cast<const GeometryData*>(handles.front().second.getData())) {
_lblSize->setText(tr("Size: n/a"));
_lblNumChannels->setText(tr("Number of Channels: n/a"));
std::ostringstream ss;
ss << tester->getWorldBounds();
......@@ -309,6 +317,8 @@ namespace campvis {
else if (const RenderData* tester = dynamic_cast<const RenderData*>(handles.front().second.getData())) {
const ImageData* id = tester->getNumColorTextures() > 0 ? tester->getColorTexture() : tester->getDepthTexture();
if (id != 0) {
_lblNumChannels->setText(tr("Number of Channels: ") + QString::number(id->getNumChannels()));
std::ostringstream ss;
ss << id->getSize();
_lblSize->setText(tr("Size: ") + QString::fromStdString(ss.str()));
......@@ -318,6 +328,7 @@ namespace campvis {
_lblBounds->setText(tr("World Bounds: ") + QString::fromStdString(ss.str()));
}
else {
_lblNumChannels->setText(tr("Number of Channels: n/a"));
_lblSize->setText(tr("Size: n/a"));
_lblBounds->setText(tr("World Bounds: n/a"));
}
......@@ -332,6 +343,7 @@ namespace campvis {
}
#ifdef CAMPVIS_HAS_MODULE_COLUMBIA
else if (const FiberData* tester = dynamic_cast<const FiberData*>(handles.front().second.getData())) {
_lblNumChannels->setText(tr("Number of Channels: n/a"));
std::ostringstream ss;
ss << "Size: " << tester->numFibers() << " Fibers with " << tester->numSegments() << " Segments.";
_lblSize->setText(QString::fromStdString(ss.str()));
......@@ -342,7 +354,7 @@ namespace campvis {
}
#endif
else {
_lblNumChannels->setText(tr("Number of Channels: n/a"));
_lblSize->setText(tr("Size: n/a"));
_lblBounds->setText(tr("World Bounds: n/a"));
}
......
......@@ -188,6 +188,7 @@ namespace campvis {
QGridLayout* _infoWidgetLayout; ///< Layout for the _infoWidget
QLabel* _lblName;
QLabel* _lblNumChannels;
QLabel* _lblLocalMemoryFootprint;
QLabel* _lblVideoMemoryFootprint;
QLabel* _lblTimestamp;
......
......@@ -59,11 +59,13 @@ namespace campvis {
tgtAssert(texture != 0, "Given texture must not be 0.");
tgtAssert(parent->getDimensionality() >= 3 || texture->getDimensions().z == 1, "Dimensionality of Parent and texture mismatch!");
tgtAssert(parent->getDimensionality() >= 2 || texture->getDimensions().y == 1, "Dimensionality of Parent and texture mismatch!");
tgtAssert(parent->getNumChannels() == texture->getNumChannels(), "Number of Channels of parent and texture mismatch!");
}
ImageRepresentationGL::ImageRepresentationGL(ImageData* parent, const WeaklyTypedPointer& wtp)
: GenericAbstractImageRepresentation<ImageRepresentationGL>(parent)
{
tgtAssert(wtp._numChannels == parent->getNumChannels(), "Number of Channels of parent and texture mismatch!");
createTexture(wtp);
}
......
......@@ -106,7 +106,7 @@ namespace campvis {
_shader->deactivate();
// put resulting image into DataContainer
ImageData* id = new ImageData(3, size, 1);
ImageData* id = new ImageData(3, size, 3);
ImageRepresentationGL::create(id, resultTexture);
id->setMappingInformation(img->getParent()->getMappingInformation());
data.addData(p_outputImage.getValue(), id);
......
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