Commit 4db817d3 authored by KLOCZKO Thibaud's avatar KLOCZKO Thibaud

Avoid volume and slice to decorate 2D images.

parent d274af04
......@@ -273,7 +273,12 @@ dtkVisualizationDecoratorSlices::~dtkVisualizationDecoratorSlices(void)
bool dtkVisualizationDecoratorSlices::isDecorating(void)
{
if (!vtkImageData::SafeDownCast(d_func()->dataset)) {
auto img = vtkImageData::SafeDownCast(d_func()->dataset);
if (!img) {
return false;
}
auto dims = img->GetDimensions();
if (dims[0] == 1 || dims[1] == 1 || dims[2] == 1) {
return false;
}
......@@ -292,12 +297,12 @@ void dtkVisualizationDecoratorSlices::setData(const QVariant& data)
d_func()->retrieveScalarPoints(dataset);
d_func()->retrieveScalarCells(dataset);
d_func()->dataset = dataset;
if (!this->isDecorating()) {
dtkWarn() << Q_FUNC_INFO << "vtkDataSet has no field to decorate. Nothing is done.";
d_func()->clear();
return;
}
d_func()->dataset = dataset;
d->c2p_filter->SetInputData(dataset);
this->restoreSettings();
......
......@@ -121,7 +121,12 @@ dtkVisualizationDecoratorVolume::~dtkVisualizationDecoratorVolume(void)
bool dtkVisualizationDecoratorVolume::isDecorating(void)
{
if (!vtkImageData::SafeDownCast(d_func()->dataset)) {
auto img = vtkImageData::SafeDownCast(d_func()->dataset);
if (!img) {
return false;
}
auto dims = img->GetDimensions();
if (dims[0] == 1 || dims[1] == 1 || dims[2] == 1) {
return false;
}
......
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