-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: Add option to enable/disable a single DRR
- Loading branch information
1 parent
16e4606
commit 2d96a12
Showing
9 changed files
with
102 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "ui/VolumeListWidgetItem.h" | ||
#include "ui/AutoscoperMainWindow.h" | ||
|
||
#include <QCheckBox> | ||
#include <QDockWidget> | ||
#include <QLabel> | ||
#include <QGridLayout> | ||
#include <QSpacerItem> | ||
|
||
#if defined(Autoscoper_RENDERING_USE_CUDA_BACKEND) | ||
#include <gpu/cuda/RayCaster.hpp> | ||
#elif defined(Autoscoper_RENDERING_USE_OpenCL_BACKEND) | ||
#include <gpu/opencl/RayCaster.hpp> | ||
#endif | ||
|
||
VolumeListWidgetItem::VolumeListWidgetItem(QListWidget* listWidget,QString name, AutoscoperMainWindow* main_window, std::vector< xromm::gpu::RayCaster*>* renderers) : QListWidgetItem(listWidget) { | ||
this->name_ = name; | ||
this->main_window_ = main_window; | ||
for (xromm::gpu::RayCaster* renderer : *renderers) { | ||
renderers_.push_back(renderer); | ||
} | ||
setup(listWidget); | ||
} | ||
|
||
void VolumeListWidgetItem::setup(QListWidget* listWidget) { | ||
// add a layout | ||
QFrame* pFrame = new QFrame(listWidget); | ||
pFrame->setMinimumHeight(32); | ||
QGridLayout* pLayout = new QGridLayout(pFrame); | ||
pLayout->addWidget(new QLabel(name_), 0, 1); | ||
visibleCheckBox_ = new QCheckBox(); | ||
visibleCheckBox_->setChecked(true); | ||
pLayout->addWidget(visibleCheckBox_, 0, 0); | ||
pLayout->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2); | ||
pLayout->setMargin(5); | ||
pFrame->setLayout(pLayout); | ||
listWidget->setItemWidget(this, pFrame); | ||
visibleCheckBox_->connect(visibleCheckBox_, SIGNAL(stateChanged(int)), this, SLOT(on_visibleCheckBox__stateChanged(int))); | ||
} | ||
|
||
void VolumeListWidgetItem::on_visibleCheckBox__stateChanged(int state) { | ||
if (renderers_.size() > 0) { | ||
for (xromm::gpu::RayCaster* renderer : renderers_) { | ||
renderer->setVisible((bool)state); | ||
} | ||
} | ||
main_window_->volume_changed(); // update the volume | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef VOLUMELISTWIDGETITEM_H | ||
#define VOLUMELISTWIDGETITEM_H | ||
|
||
#include <QListWidgetItem> | ||
#include <QObject> | ||
|
||
class AutoscoperMainWindow; | ||
class QCheckBox; | ||
namespace xromm { | ||
namespace gpu { | ||
class RayCaster; | ||
} | ||
} | ||
|
||
class VolumeListWidgetItem : public QObject, public QListWidgetItem { | ||
// List Object to display the volume name and a checkbox to toggle visibility | ||
Q_OBJECT | ||
public: | ||
VolumeListWidgetItem(QListWidget* listWidget, QString name, AutoscoperMainWindow* main_window, std::vector< xromm::gpu::RayCaster*>* renderers); | ||
private: | ||
std::vector< xromm::gpu::RayCaster*> renderers_; | ||
QCheckBox *visibleCheckBox_; | ||
QString name_; | ||
AutoscoperMainWindow* main_window_; | ||
|
||
void setup(QListWidget* listWidget); | ||
public slots: | ||
void on_visibleCheckBox__stateChanged(int state); | ||
}; | ||
#endif // !VOLUMELISTWIDGETITEM_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters