//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+void vvBinaryImageOverlayActor::SetOpacity(double d) {
+ mAlpha = d;
+ // TODO !!lut->SetTableValue(1, mColor[0], mColor[1], mColor[2], mAlpha); // FG
+}
+//------------------------------------------------------------------------------
+
+
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::setImage(vvImage::Pointer image, double bg) {
mImage = image;
void setColor(double r, double g, double b);
void setImage(vvImage::Pointer image, double bg);
void initialize();
+ void SetOpacity(double d);
protected:
vvSlicer * mSlicer;
void vvImageContour::updateActor(vtkActor * actor,
vtkMarchingSquares * squares,
vtkImageClip * clipper,
- int threshold, int orientation, int slice) {
-
+ double threshold, int orientation, int slice) {
+
// Set parameter for the MarchigSquare
squares->SetValue(0, threshold);
if (mHiddenImage) delete extent2;
// Move the actor to be visible
- DD(orientation);
- DD(slice);
+ // DD(orientation);
+// DD(slice);
//TO SIMPLiFY :!!!!!!!!! == ???????
// actor->SetPosition(-1,-1,-1);
switch (orientation) {
case 0:
- DD(mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[0]);
+ // DD(mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[0]);
if (mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[0] > slice) {
actor->SetPosition(1,0,0);
}
}
break;
case 1:
- DD(mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[1]);
+ // DD(mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[1]);
if (mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[1] > slice) {
actor->SetPosition(0,1,0);
}
}
break;
case 2:
- DD(mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[2]);
+ // DD(mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[2]);
if (mSlicer->GetRenderer()->GetActiveCamera()->GetPosition()[2] > slice) {
- DD("1");
+ // DD("1");
actor->SetPosition(0,0,1);
}
else {
- DD("-1");
+ // DD("-1");
actor->SetPosition(0,0,-1);
}
break;
void updateActor(vtkActor * actor,
vtkMarchingSquares * squares,
vtkImageClip * clipper,
- int threshold, int orientation, int slice);
+ double threshold, int orientation, int slice);
void createActor(int orientation, int slice);
int computeCurrentOrientation();
vvROIActor::vvROIActor() {
mImageContour.clear();
mOverlayActors.clear();
+ mIsVisible = true;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+void vvROIActor::SetVisible(bool b) {
+ mIsVisible = b;
+ if (!b) { // remove actor
+ for(unsigned int i= 0; i<mOverlayActors.size(); i++)
+ mOverlayActors[i]->hideActors();
+ }
+ else {
+ for(unsigned int i= 0; i<mOverlayActors.size(); i++)
+ mOverlayActors[i]->showActors();
+ }
+ Update();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+bool vvROIActor::IsVisible() {
+ return mIsVisible;
+}
+//------------------------------------------------------------------------------
+
+
//------------------------------------------------------------------------------
void vvROIActor::Initialize() {
if (mROI->GetImage()) {
//------------------------------------------------------------------------------
void vvROIActor::UpdateSlice(int slicer, int slices) {
- if (!mROI->GetImage()) return;
+ if (!mROI->GetImage()) return;
+
+ if (!mIsVisible) return;
if (!mSlicerManager) {
std::cerr << "Error. No mSlicerManager ?" << std::endl;
// mSlicerManager->GetSlicer(slicer)->GetRenderWindow()->Render();
}
//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvROIActor::SetOpacity(double d) {
+ mOpacity = d;
+ for(unsigned int i=0; mOverlayActors.size(); i++) {
+ mOverlayActors[i]->SetOpacity(d);
+ }
+}
+//------------------------------------------------------------------------------
+
void SetSlicerManager(vvSlicerManager * s);
void Update();
void Initialize();
+ void SetVisible(bool b);
+ bool IsVisible();
+ void SetOpacity(double x);
public slots:
void UpdateSlice(int slicer, int slices);
vvSlicerManager * mSlicerManager;
std::vector<vvImageContour *> mImageContour;
std::vector<vvBinaryImageOverlayActor *> mOverlayActors;
+
+ bool mIsVisible;
+ double mOpacity;
}; // end class vvROIActor
//------------------------------------------------------------------------------
SetContourSlice();
this->Modified();
this->UpdateDisplayExtent();
+
+ // DD("SetSlice de slicer = Render");
+
this->Render();
}
//----------------------------------------------------------------------------
//------------------------------------------------------------------------------
vvROIActor * vvStructureSetActor::GetROIActor(int n) {
+ DD(n);
if (mMapROIIndex.find(n) == mMapROIIndex.end()) {
std::cerr << "No ROI number " << n << std::endl;
return NULL;
}
+ DD(mMapROIIndex[n]);
return mROIActors[mMapROIIndex[n]];
}
//------------------------------------------------------------------------------
// connect(m, SIGNAL(LeftButtonReleaseSignal(int)), SLOT(LeftButtonReleaseEvent(int)));
connect(mTree, SIGNAL(itemSelectionChanged()), this, SLOT(selectedItemChangedInTree()));
-}
-//------------------------------------------------------------------------------
-
-
-//------------------------------------------------------------------------------
-void vvToolStructureSetManager::selectedItemChangedInTree() {
- DD("selectedItemChangedInTree");
- QList<QTreeWidgetItem *> l = mTree->selectedItems();
- DD(l.size());
- QTreeWidgetItem * w = l[0];
- if (mMapTreeWidgetToROI.find(w) == mMapTreeWidgetToROI.end()) return; // Search for SS (first)
- clitk::DicomRT_ROI * roi = mMapTreeWidgetToROI[w];
- DD(roi->GetName());
- setCurrentSelectedROI(roi);
-}
-//------------------------------------------------------------------------------
-
-
-//------------------------------------------------------------------------------
-void vvToolStructureSetManager::setCurrentSelectedROI(clitk::DicomRT_ROI * roi) {
- // mCheckBoxShow = // get roi actor .../
+ connect(mCheckBoxShow, SIGNAL(toggled(bool)), this, SLOT(visibleROIToggled(bool)));
+ // TODO connect(mOpacitySlider, SIGNAL(valueChanged(int), this, SLOT(opacityChanged(int))));
}
//------------------------------------------------------------------------------
mCurrentStructureSet = mStructureSetsList[index];
mCurrentStructureSetActor = mStructureSetActorsList[index];
mCurrentStructureSetIndex = index;
+ DD(mCurrentStructureSetIndex);
DD(mCurrentStructureSet->GetName());
// Open images
close();
}
//------------------------------------------------------------------------------
+
+
+
+//------------------------------------------------------------------------------
+// CURRENT ROI INTERACTION
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolStructureSetManager::selectedItemChangedInTree() {
+ DD("selectedItemChangedInTree");
+ QList<QTreeWidgetItem *> l = mTree->selectedItems();
+ DD(l.size());
+ QTreeWidgetItem * w = l[0];
+ if (mMapTreeWidgetToROI.find(w) == mMapTreeWidgetToROI.end()) return; // Search for SS (first)
+ clitk::DicomRT_ROI * roi = mMapTreeWidgetToROI[w];
+ DD(roi->GetName());
+ //setCurrentSelectedROI(roi);
+
+ mROInameLabel->setText(roi->GetName().c_str());
+ DD(roi->GetROINumber());
+ DD(mCurrentStructureSetIndex);
+ vvROIActor * actor = mStructureSetActorsList[mCurrentStructureSetIndex]->GetROIActor(roi->GetROINumber());
+ mCurrentROI = roi;
+ mCurrentROIActor = actor;
+
+ DD(actor);
+ DD(actor->IsVisible());
+ mCheckBoxShow->setChecked(actor->IsVisible());
+
+ //actor->SetSelected(true); // remove old selection
+
+ DD("ici");
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolStructureSetManager::visibleROIToggled(bool b) {
+ DD(b);
+ mCurrentROIActor->SetVisible(b);
+ //mCurrentROIActor->Update();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolStructureSetManager::opacityChanged(int v) {
+ DD(v);
+ mCurrentROIActor->SetOpacity((double)v/100.0);
+ mCurrentROIActor->Update();
+}
+//------------------------------------------------------------------------------
+
+
+
+
+//------------------------------------------------------------------------------
+//void vvToolStructureSetManager::getActorFromROI() {
+// mStructureSetActorsList[mCurrentStructureSetIndex]->GetROIActor(n);
+//}
+//------------------------------------------------------------------------------
+
+
#include "vvToolWidgetBase.h"
#include "clitkDicomRT_StructureSet.h"
#include "ui_vvToolStructureSetManager.h"
+#include "vvROIActor.h"
class vvStructureSetActor;
void LeftButtonReleaseEvent(int slicer);
void openBinaryImage();
void selectedItemChangedInTree();
+ void visibleROIToggled(bool b);
+ void opacityChanged(int v);
protected:
Ui::vvToolStructureSetManager ui;
clitk::DicomRT_StructureSet * mCurrentStructureSet;
vvStructureSetActor * mCurrentStructureSetActor;
int mCurrentStructureSetIndex;
+ clitk::DicomRT_ROI * mCurrentROI;
+ vvROIActor * mCurrentROIActor;
vtkLookupTable * mDefaultLUTColor;
void setCurrentSelectedROI(clitk::DicomRT_ROI * roi);