</property>
</widget>
</item>
+ <item>
+ <widget class="QToolButton" name="vfColorButton">
+ <property name="styleSheet">
+ <string>
+ background-color: rgb(0, 255, 0);
+ border: 0px;
+ </string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>
connect(linkPanel,SIGNAL(addLink(QString,QString)),this,SLOT(AddLink(QString,QString)));
connect(linkPanel,SIGNAL(removeLink(QString,QString)),this,SLOT(RemoveLink(QString,QString)));
- connect(overlayPanel,SIGNAL(VFPropertyUpdated(int,int,int,int)),this,SLOT(SetVFProperty(int,int,int,int)));
+ connect(overlayPanel,SIGNAL(VFPropertyUpdated(int,int,int,int,double,double,double)),this,SLOT(SetVFProperty(int,int,int,int,double,double,double)));
connect(overlayPanel,SIGNAL(OverlayPropertyUpdated(int)),this,SLOT(SetOverlayProperty(int)));
connect(overlayPanel,SIGNAL(FusionPropertyUpdated(int,int,double,double)),
this,SLOT(SetFusionProperty(int,int,double,double)));
//------------------------------------------------------------------------------
-void vvMainWindow::SetVFProperty(int subsampling, int scale, int log, int width)
+void vvMainWindow::SetVFProperty(int subsampling, int scale, int log, int width, double r, double g, double b)
{
int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
if (mSlicerManagers[index]->GetSlicer(0)->GetVF()) {
mSlicerManagers[index]->GetSlicer(i)->SetVFSubSampling(subsampling);
mSlicerManagers[index]->GetSlicer(i)->SetVFScale(scale);
mSlicerManagers[index]->GetSlicer(i)->SetVFWidth(width);
+ mSlicerManagers[index]->GetSlicer(i)->SetVFColor(r,g,b);
if (log > 0)
mSlicerManagers[index]->GetSlicer(i)->SetVFLog(1);
else
void SelectOverlayImage();
void SelectFusionImage();
- void SetVFProperty(int subsampling,int scale,int lut, int width);
+ void SetVFProperty(int subsampling,int scale,int lut, int width, double r, double g, double b);
void SetOverlayProperty(int color);
void SetFusionProperty(int opacity,int colormap,double window,double level);
#include <QtGui>
#include <Qt>
#include "QTreePushButton.h"
+#include <QColorDialog>
#include <vtksys/SystemTools.hxx>
connect(scaleSpinBox,SIGNAL(editingFinished()),this,SLOT(setVFProperty()));
connect(lutCheckBox,SIGNAL(clicked()),this,SLOT(setVFProperty()));
connect(vfWidthSpinBox,SIGNAL(editingFinished()),this,SLOT(setVFProperty()));
+ connect(vfColorButton,SIGNAL(clicked()),this,SLOT(VFColorChangeRequest()));
connect(colorHorizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(setOverlayProperty()));
connect(opacityHorizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(setFusionProperty()));
connect(fusionColorMapComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(setFusionProperty()));
void vvOverlayPanel::setVFProperty()
{
+ QColor color(vfColorButton->palette().color(QPalette::Background));
emit VFPropertyUpdated(subSamplingSpinBox->value(),
scaleSpinBox->value(),
lutCheckBox->checkState(),
- vfWidthSpinBox->value());
+ vfWidthSpinBox->value(),
+ color.redF(), color.greenF(), color.blueF());
}
void vvOverlayPanel::getCurrentVectorInfo(int visibility, double x,double y,double z, double value)
valueFusionnedLabel->setText(fusionValue);
}
+void vvOverlayPanel::VFColorChangeRequest()
+{
+ QColor color(vfColorButton->palette().color(QPalette::Background));
+ color = QColorDialog::getColor(color, this, "Choose the new color of the vector field");
+ //vfColorButton->palette().setColor(QPalette::Background, color); SR: Not working?
+ vfColorButton->setStyleSheet("* { background-color: " + color.name() + "; border: 0px }");
+ this->setVFProperty();
+}
+
#endif /* end #define _vvOverlayPanel_CXX */
void setVFProperty();
void setOverlayProperty();
void setFusionProperty();
+ void VFColorChangeRequest();
signals:
- void VFPropertyUpdated(int subsampling, int scale, int log, int width);
+ void VFPropertyUpdated(int subsampling, int scale, int log, int width, double r, double g, double b);
void OverlayPropertyUpdated(int color);
void FusionPropertyUpdated(int opacity, int colormap, double window, double level);
-
}; // end class vvOverlayPanel
//====================================================================
mScale = 1;
mVFLog = 0;
mVFWidth = 1;
+ mVFColor[0] = 0;
+ mVFColor[1] = 1;
+ mVFColor[2] = 0;
std::string text = "F1 = sagital; F2 = coronal; F3 = axial\n";
text += "F5 = horizontal flip; F6 = vertical flip\n\n";
mGlyphFilter->SetVectorModeToUseVector();
mGlyphFilter->SetColorModeToColorByVector();
+ if (!mVFColorLUT)
+ mVFColorLUT = vtkSmartPointer<vtkLookupTable>::New();
+
+ double mVFColorHSV[3];
+ vtkMath::RGBToHSV(mVFColor, mVFColorHSV);
+ mVFColorLUT->SetHueRange(mVFColorHSV[0], mVFColorHSV[0]);
+ mVFColorLUT->SetSaturationRange(mVFColorHSV[1],mVFColorHSV[1]);
+ mVFColorLUT->SetValueRange(mVFColorHSV[2], mVFColorHSV[2]);
+
if (!mVFMapper)
mVFMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
- //mVFMapper->SetInputConnection(mGlyphFilter->GetOutputPort());
mVFMapper->SetInput(mGlyphFilter->GetOutput());
mVFMapper->ImmediateModeRenderingOn();
+ mVFMapper->SetLookupTable(mVFColorLUT);
if (!mVFActor)
mVFActor = vtkSmartPointer<vtkActor>::New();
}
//----------------------------------------------------------------------------
-
-
-
+//----------------------------------------------------------------------------
+void vvSlicer::SetVFColor(double r, double g, double b)
+{
+ double mVFColorHSV[3];
+ mVFColor[0] = r;
+ mVFColor[1] = g;
+ mVFColor[2] = b;
+
+ vtkMath::RGBToHSV(mVFColor, mVFColorHSV);
+ mVFColorLUT->SetHueRange(mVFColorHSV[0], mVFColorHSV[0]);
+ mVFColorLUT->SetSaturationRange(mVFColorHSV[1],mVFColorHSV[1]);
+ mVFColorLUT->SetValueRange(mVFColorHSV[2], mVFColorHSV[2]);
+
+ this->Render();
+}
#include <vtkSmartPointer.h>
#include <vtkImageViewer2.h>
+#include <vtkColor.h>
class vtkActor;
class vtkActor2D;
int GetOrientation();
int * GetExtent();
+ double* GetVFColor() {
+ return mVFColor;
+ }
+ void SetVFColor(double r, double g, double b);
+
protected:
vvSlicer();
~vvSlicer();
vtkSmartPointer<vtkExtractVOI> mVOIFilter;
vtkSmartPointer<vvGlyph2D> mGlyphFilter;
vtkSmartPointer<vtkPolyDataMapper> mVFMapper;
+ vtkSmartPointer<vtkLookupTable> mVFColorLUT;
vtkSmartPointer<vtkActor> mVFActor;
vtkSmartPointer<vtkGlyph3D> mLandGlyph;
vtkSmartPointer<vtkCursor3D> mCross;
int mScale;
int mVFLog;
int mVFWidth;
+ double mVFColor[3];
bool mUseReducedExtent;
int * mReducedExtent;
int * mInitialExtent;