//=====
void SetwxVtkBaseViewSetOpacityAxis::Process()
{
-
// THE MAIN PROCESSING METHOD BODY
// Here we simply set the input 'In' value to the output 'Out'
// And print out the output value
// (the one provided in the attribute 'type' of the tag 'input')
// bbSetOutputOut( bbGetInputIn() );
// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
-
if (bbGetInputwxVtkBaseView()!=NULL)
{
vtkMPRBaseData* vtkmprbasedata = (vtkMPRBaseData*) (bbGetInputwxVtkBaseView()->GetVtkBaseData());
//=====
void SetwxVtkBaseViewSetOpacityAxis::bbUserSetDefaultValues()
{
-
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
// Here we initialize the input 'In' to 0
bbSetInputOpacity( 1 ) ;
bbSetInputwxVtkBaseView( NULL ) ;
}
-//=====
+
+//=====
// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
//=====
void SetwxVtkBaseViewSetOpacityAxis::bbUserInitializeProcessing()
{
-
// THE INITIALIZATION METHOD BODY :
// Here does nothing
// but this is where you should allocate the internal/output pointers
-// if any
-
-
+// if any
}
-//=====
+
+//=====
// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
//=====
void SetwxVtkBaseViewSetOpacityAxis::bbUserFinalizeProcessing()
{
-
// THE FINALIZATION METHOD BODY :
// Here does nothing
// but this is where you should desallocate the internal/output pointers
// if any
-
-}
}
-// EO namespace bbcreaMaracasVisu
+
+}// EO namespace bbcreaMaracasVisu
}
//-------------------------------------------------------------------
-
manualInteractorWindowLevel::~manualInteractorWindowLevel()
{
}
//-------------------------------------------------------------------
-
bool manualInteractorWindowLevel::OnMouseMove() // virtual
{
if (_stateWindowLevel==true)
{
+
+// char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
+// int ctrlkey = _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey();
+
int tmpPx,tmpPy;
crea::wxVTKRenderWindowInteractor *wxVTKiren;
wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
wxVTKiren->GetEventPosition( tmpPx , tmpPy );
+
+// int keyCode = (int)(wxVTKiren->GetKeyCode());
+ int ctrlkey = wxVTKiren->GetControlKey();
+// printf("EED manualInteractorWindowLevel::OnMouseMove keyCode=%d ctrlkey=%d\n", keyCode,ctrlkey);
+
double colorWin;
double colorLev;
vtkImageData* imgrange = ((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->GetVtkBaseData()->GetImageData();
if(imgrange != NULL)
{
- double* scalarrange = imgrange->GetScalarRange();
- double scalarr;
- if (scalarrange[1] == scalarrange[0])
- {
- scalarr=scalarrange[1];
- if (scalarrange[1]==0) {scalarr=100;}
- } else {
- scalarr = scalarrange[1] - scalarrange[0];
- }
- //std::cout<<"scalar r="<<scalarr<<std::endl;
- int w, h;
- ((wxWindow*)wxVTKiren)->GetSize(&w, &h);
- double dw=w,dh=h;
- double dx = (scalarr*( _backPx - tmpPx ))/dw;
- double dy = (scalarr*( _backPy - tmpPy ))/dh;
- //colorWin=_backWindow - (scalarr)*( _backPx - tmpPx );
- colorWin=_backWindow - dx;
- colorLev=_backLevel + dy;
+ double* scalarrange = imgrange->GetScalarRange();
+ if (ctrlkey==0) {
+ double scalarr;
+ if (scalarrange[1] == scalarrange[0])
+ {
+ scalarr=scalarrange[1];
+ if (scalarrange[1]==0) {scalarr=100;}
+ } else {
+ scalarr = scalarrange[1] - scalarrange[0];
+ }
+ //std::cout<<"scalar r="<<scalarr<<std::endl;
+ int w, h;
+ ((wxWindow*)wxVTKiren)->GetSize(&w, &h);
+ double dw=w,dh=h;
+ double dx = (scalarr*( _backPx - tmpPx ))/dw;
+ double dy = (scalarr*( _backPy - tmpPy ))/dh;
+ //colorWin=_backWindow - (scalarr)*( _backPx - tmpPx );
+ colorWin=_backWindow - dx;
+ colorLev=_backLevel + dy;
+ } else { // ctrlkey == 1
+ colorWin = scalarrange[1] - scalarrange[0];
+ colorLev = (scalarrange[1] + scalarrange[0])/2;
+ _backWindow = colorWin;
+ _backLevel = colorLev;
+ }
} else {
colorWin=_backWindow - 2*( _backPx - tmpPx );
colorLev=_backLevel + 2*( _backPy - tmpPy );
}
//-------------------------------------------------------------------
-
bool manualInteractorWindowLevel::OnMiddleButtonUp() // virtual
{
if (_stateWindowLevel==true)
vtkImageData *imageData = GetVtkBaseData()->GetMarImageData()->GetImageData();
if (imageData!=NULL)
{
-
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
imageData->UpdateInformation();
#else
//...
#endif
-
if (okimage==true){
imageData->GetSpacing (spx,spy,spz);
imageData->GetExtent (x1,x2,y1,y2,z1,z2);
SetImageToVtkViewer(imageData);
_imageViewer2XYZ->SetExtentDimension(x1,x2,y1,y2,z1,z2);
-
/*EED Borrame, now is syncroniced in vtkBaseData for all windows
double range[2];
imageData->GetScalarRange(range);
_imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow( 1000 );
_imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel( 500 );
}
-*/
-
+*/
// EED 31 Janvier 2007
//vtkImageActor *vtkimageactor = _imageViewer2XYZ->GetVtkImageViewer2()->GetImageActor ();
//vtkimageactor->InterpolateOff ();
// EED 17 Oct 2007
// SetInteractorStyleImage( vtkInteractorStyleBaseView2D::New() );
-
vtkImageViewer2 *IV2 = _imageViewer2XYZ->GetVtkImageViewer2();
vtkCamera *camera = IV2->GetRenderer()->GetActiveCamera();
camera->SetFocalPoint ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*0 );
*/
-
camera->SetClippingRange( 0.01 , 1000000 );
camera->ComputeViewPlaneNormal();
-
double cameraparallelScale=spx*(x2-x1)/3.0;
camera->SetParallelScale( cameraparallelScale );
GetVtkBaseData()->SetCameraParallelScale( cameraparallelScale );
// text information over the graphic window
- if(_vtkIinfoTextImage == NULL){
+ if(_vtkIinfoTextImage == NULL)
+ {
_vtkIinfoTextImage = new vtkInfoTextImage();
_vtkIinfoTextImageInteractor = new vtkInfoTextImageInteractor();
((vtkInteractorStyleBaseView*)this->GetInteractorStyleBaseView())->AddInteractorStyleMaracas(_vtkIinfoTextImageInteractor);
_vtkIinfoTextImage->SetMarImageData( GetVtkBaseData()->GetMarImageData() );
_vtkIinfoTextImageInteractor->SetModelVtkInfoTextImage(_vtkIinfoTextImage);
_vtkIinfoTextImage->Configure();
-
} // okimage
} // imageData
-
}
//-------------------------------------------------------------------
-
int wxVtk2DBaseView::GetActualSlice() // virtual
{
return (int)(GetVtkBaseData()->GetZ());