sphereActor->SetMapper(sphereMapper);
sphereActor->SetOrigin(0, 0, 0);
double spc[3];
+ if(mimage==NULL){
+ wxMessageDialog dialog(this, _T("Image Not Set"),_T("Image Not Set"),wxICON_ERROR);
+ dialog.ShowModal();
+ return;
+ }
mimage->GetSpacing(spc);
sphereActor->SetPosition( spc[0]*x , spc[1]*y , spc[2]*z );
sphereActor->GetProperty()->SetColor( mcolour[0] , mcolour[1] , mcolour[2] );
sphereActor->GetProperty()->SetOpacity( mopacity );
lstActorsSphere.push_back(sphereActor);
+ if(renderer==NULL){
+ wxMessageDialog dialog(this, _T("Renderer Not Set"),_T("Renderer Not Set"),wxICON_ERROR);
+ dialog.ShowModal();
+ return;
+ }
renderer->AddActor( sphereActor );
// Actor
{
mwxwidget = NULL;
- bbSetInputRadio(0.5);
+ bbSetInputRadio(1);
bbSetInputOpacity(1);
std::vector<double> colour;
_tfun = NULL;
_ctfun = NULL;
+ bbSetOutputOpacityFunction(0);
+ bbSetOutputColorFunction(0);
+
}
if(!compareVectors(type, currenttype)){
mwxwidget->SetType(&type);
- mwxwidget->UpdateLayout(img);
+ mwxwidget->UpdateLayout(img);
}else if (img != currentimg){
mwxwidget->SetImage(img);
//mwxwidget->UpdateLayout(img);
- }
+ }
currenttype = type;
currentimg = img;
if (wvbv2!=NULL) { bbSetOutputRenderer2( wvbv2->GetRenderer() ); }
if (wvbv3!=NULL) { bbSetOutputRenderer3( wvbv3->GetRenderer() ); }
if (wvbv4!=NULL) { bbSetOutputRenderer4( wvbv4->GetRenderer() ); }
+
+ if(bbGetInputColorFunction()!=NULL){
+ mwxwidget->setColorTransferFunction(bbGetInputColorFunction());
+ }
}
}
bbSetOutputRenderer2( NULL );
bbSetOutputRenderer3( NULL );
bbSetOutputRenderer4( NULL );
+ bbSetInputColorFunction(NULL);
}
//-----------------------------------------------------------------
BBTK_DECLARE_INPUT(Title,std::string);
BBTK_DECLARE_INPUT(In, vtkImageData *);
BBTK_DECLARE_INPUT(nTypeView, std::vector<int> );
+ BBTK_DECLARE_INPUT(ColorFunction, vtkColorTransferFunction* );
BBTK_DECLARE_OUTPUT(wxVtkBaseView1,wxVtkBaseView*);
BBTK_DECLARE_OUTPUT(wxVtkBaseView2,wxVtkBaseView*);
BBTK_DECLARE_OUTPUT(wxVtkBaseView3,wxVtkBaseView*);
BBTK_INPUT(ViewerNV,Title,"Title prepended to the text",std::string,"");
BBTK_INPUT(ViewerNV,In,"Input image",vtkImageData*,"");
BBTK_INPUT(ViewerNV,nTypeView,"vector of viewer types (default 5 0 1 3 ): -1=Z_2DwithOutAxis 0=Z_2D 1=X_2D 2=Y_2D 3=Plane 4=Sphere 5=3D 6=3Dplane",std::vector<int>,"");
+ BBTK_INPUT(ViewerNV,ColorFunction,"Optional: set a different color for the viewers 2D",vtkColorTransferFunction*,"");
BBTK_OUTPUT(ViewerNV,wxVtkBaseView1,"wxVtkBaseView 1",wxVtkBaseView *,"");
BBTK_OUTPUT(ViewerNV,wxVtkBaseView2,"wxVtkBaseView 2",wxVtkBaseView *,"");
BBTK_OUTPUT(ViewerNV,wxVtkBaseView3,"wxVtkBaseView 3",wxVtkBaseView *,"");
_vtkimageviewer2= vtkImageViewer2::New();
_vtkimageviewer2->GetRenderer()->GradientBackgroundOn();
_vtkimageviewer2->GetRenderer()->SetBackground( 0.33 , 0.33 , 0.33 );
- _vtkimageviewer2->GetRenderer()->SetBackground2( 0.66 , 0.66 , 0.66 );
+ _vtkimageviewer2->GetRenderer()->SetBackground2( 0.66 , 0.66 , 0.66 );
}
//-------------------------------------------------------------------
vtkImageViewer2_XYZ::~vtkImageViewer2_XYZ()
{
return _vtkimageviewer2;
}
+
+void vtkImageViewer2_XYZ::setColorTransferFunction(vtkColorTransferFunction* colortable){
+
+ vtkImageMapToWindowLevelColors* imagemaptowindowlevel = _vtkimageviewer2->GetWindowLevel();
+
+ if(colortable!=NULL&&colortable->GetSize()>0){
+ imagemaptowindowlevel->SetLookupTable(colortable);
+ }
+
+}
//------------------------------------------------------------------
#include "marTypes.h"
#include "vtkImageViewer2.h"
+#include "vtkImageMapToWindowLevelColors.h"
+#include "vtkColorTransferFunction.h"
class creaMaracasVisu_EXPORT vtkImageViewer2_XYZ{
public:
int GetZSlice();
vtkImageViewer2 *GetVtkImageViewer2();
+ void setColorTransferFunction(vtkColorTransferFunction* colortable);
+
private:
int _x1,_x2,_y1,_y2,_z1,_z2;
vtkImageViewer2 *_vtkimageviewer2;
Program: wxMaracas
Module: $RCSfile: wxMaracas_N_ViewersWidget.cxx,v $
Language: C++
- Date: $Date: 2009/06/05 06:07:39 $
- Version: $Revision: 1.10 $
+ Date: $Date: 2009/07/27 07:58:20 $
+ Version: $Revision: 1.11 $
Copyright: (c) 2002, 2003
License:
// return wxwindow1->GetZ();
}
+void wxMaracas_N_ViewersWidget::setColorTransferFunction(vtkColorTransferFunction* colortable){
+ if (wxwindow1!=NULL) {
+ wxwindow1->setColorTransferFunction(colortable);
+ }
+ if (wxwindow2!=NULL) {
+ wxwindow2->setColorTransferFunction(colortable);
+ }
+ if (wxwindow3!=NULL) {
+ wxwindow3->setColorTransferFunction(colortable);
+ }
+ if (wxwindow4!=NULL) {
+ wxwindow4->setColorTransferFunction(colortable);
+ }
+}
Program: wxMaracas
Module: $RCSfile: wxMaracas_N_ViewersWidget.h,v $
Language: C++
- Date: $Date: 2009/06/05 06:07:39 $
- Version: $Revision: 1.6 $
+ Date: $Date: 2009/07/27 07:58:20 $
+ Version: $Revision: 1.7 $
Copyright: (c) 2002, 2003
License:
double GetY();
double GetZ();
+ void setColorTransferFunction(vtkColorTransferFunction* colortable);
+
//------------------------------------------------------------------------------------------------------------
// Attributes
//------------------------------------------------------------------------------------------------------------
Program: wxMaracas
Module: $RCSfile: wxMaracas_ViewerWidget.cxx,v $
Language: C++
- Date: $Date: 2009/06/22 10:31:44 $
- Version: $Revision: 1.14 $
+ Date: $Date: 2009/07/27 07:58:20 $
+ Version: $Revision: 1.15 $
Copyright: (c) 2002, 2003
License:
// return mvtk2Dbaseview->GetVtkBaseData()->GetZ();
}
+ void wxMaracas_ViewerWidget::setColorTransferFunction(vtkColorTransferFunction* colortable){
+ if(mvtkmpr2Dview_X!=NULL){
+ mvtkmpr2Dview_X->setColorTransferFunction(colortable);
+ }
+ if(mvtkmpr2Dview_Y!=NULL){
+ mvtkmpr2Dview_Y->setColorTransferFunction(colortable);
+ }
+ if(mvtkmpr2Dview_Z!=NULL){
+ mvtkmpr2Dview_Z->setColorTransferFunction(colortable);
+ }
+ }
\ No newline at end of file
Program: wxMaracas
Module: $RCSfile: wxMaracas_ViewerWidget.h,v $
Language: C++
- Date: $Date: 2009/06/05 06:07:39 $
- Version: $Revision: 1.6 $
+ Date: $Date: 2009/07/27 07:58:20 $
+ Version: $Revision: 1.7 $
Copyright: (c) 2002, 2003
License:
// Attributes
//------------------------------------------------------------------------------------------------------------
+ void setColorTransferFunction(vtkColorTransferFunction* colortable);
private:
int mType;
imageData->GetSpacing(spc);
}
+void wxVtk2DBaseView::setColorTransferFunction(vtkColorTransferFunction* colortable){
+ if(_imageViewer2XYZ!=NULL){
+ _imageViewer2XYZ->setColorTransferFunction(colortable);
+ }
+}
virtual void TransformCoordinate_spacing_ModelToView(double &X,double &Y, double &Z);
virtual void GetSpacing(double spc[3]);
+ void setColorTransferFunction(vtkColorTransferFunction* colortable);
private:
vtkBaseData *_vtkbasedata;
_visibleAxis = true;
// Axe A
- _ptsA = vtkPoints::New();
- _ptsA->SetNumberOfPoints(2);
- _ptsA->SetPoint(0, -1000 , -1000 , -1000 );
- _ptsA->SetPoint(1, 1000 , 1000 , 1000 );
- vtkCellArray *linesA;
- linesA = vtkCellArray::New();
- linesA->InsertNextCell(2);
- linesA->InsertCellPoint(0);
- linesA->InsertCellPoint(1);
- _pdA = vtkPolyData::New();
- _pdA->SetPoints( _ptsA );
- _pdA->SetLines( linesA );
- linesA->Delete(); //do not delete lines ??
- _lineAActor = vtkActor::New();
- _lineAMapper = vtkPolyDataMapper::New();
- _lineAMapper->SetInput(_pdA);
- _lineAMapper->ImmediateModeRenderingOn();
- _lineAActor->SetMapper(_lineAMapper);
-// _lineAActor->GetProperty()->BackfaceCullingOn();
- _lineAActor->GetProperty()->SetDiffuseColor(1,0,0);
- _lineAActor->GetProperty()->SetLineWidth(2);
- _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineAActor );
+ if(_lineAActor==NULL){
+ _ptsA = vtkPoints::New();
+ _ptsA->SetNumberOfPoints(2);
+ _ptsA->SetPoint(0, -1000 , -1000 , -1000 );
+ _ptsA->SetPoint(1, 1000 , 1000 , 1000 );
+ vtkCellArray *linesA;
+ linesA = vtkCellArray::New();
+ linesA->InsertNextCell(2);
+ linesA->InsertCellPoint(0);
+ linesA->InsertCellPoint(1);
+ _pdA = vtkPolyData::New();
+ _pdA->SetPoints( _ptsA );
+ _pdA->SetLines( linesA );
+ linesA->Delete(); //do not delete lines ??
+ _lineAActor = vtkActor::New();
+ _lineAMapper = vtkPolyDataMapper::New();
+
+ _lineAMapper->SetInput(_pdA);
+ _lineAMapper->ImmediateModeRenderingOn();
+ _lineAActor->SetMapper(_lineAMapper);
+ // _lineAActor->GetProperty()->BackfaceCullingOn();
+ _lineAActor->GetProperty()->SetDiffuseColor(1,0,0);
+ _lineAActor->GetProperty()->SetLineWidth(2);
+ _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineAActor );
+ }
+
+
+
// Axe B
- _ptsB = vtkPoints::New();
- _ptsB->SetNumberOfPoints(2);
- _ptsB->SetPoint(0, -1000 , -1000 , -1000 );
- _ptsB->SetPoint(1, 1000 , 1000 , 1000 );
- vtkCellArray *linesB;
- linesB = vtkCellArray::New();
- linesB->InsertNextCell(2);
- linesB->InsertCellPoint(0);
- linesB->InsertCellPoint(1);
- _pdB = vtkPolyData::New();
- _pdB->SetPoints( _ptsB );
- _pdB->SetLines( linesB );
- linesB->Delete(); //do not delete lines ??
- _lineBActor = vtkActor::New();
- _lineBMapper = vtkPolyDataMapper::New();
- _lineBMapper->SetInput(_pdB);
- _lineBMapper->ImmediateModeRenderingOn();
- _lineBActor->SetMapper(_lineBMapper);
-// _lineBActor->GetProperty()->BackfaceCullingOn();
- _lineBActor->GetProperty()->SetDiffuseColor(1,0,0);
- _lineBActor->GetProperty()->SetLineWidth(2);
- _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineBActor );
+ if(_lineBActor==NULL){
+ _ptsB = vtkPoints::New();
+ _ptsB->SetNumberOfPoints(2);
+ _ptsB->SetPoint(0, -1000 , -1000 , -1000 );
+ _ptsB->SetPoint(1, 1000 , 1000 , 1000 );
+ vtkCellArray *linesB;
+ linesB = vtkCellArray::New();
+ linesB->InsertNextCell(2);
+ linesB->InsertCellPoint(0);
+ linesB->InsertCellPoint(1);
+ _pdB = vtkPolyData::New();
+ _pdB->SetPoints( _ptsB );
+ _pdB->SetLines( linesB );
+ linesB->Delete(); //do not delete lines ??
+ _lineBActor = vtkActor::New();
+ _lineBMapper = vtkPolyDataMapper::New();
+ _lineBMapper->SetInput(_pdB);
+ _lineBMapper->ImmediateModeRenderingOn();
+ _lineBActor->SetMapper(_lineBMapper);
+ // _lineBActor->GetProperty()->BackfaceCullingOn();
+ _lineBActor->GetProperty()->SetDiffuseColor(1,0,0);
+ _lineBActor->GetProperty()->SetLineWidth(2);
+ _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineBActor );
+ }
vtkCamera *camera =_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->GetActiveCamera();