+/*# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+# pour la Sant�)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+# This software is governed by the CeCILL-B license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL-B
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+# or in the file LICENSE.txt.
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------ */
+
#include "vtkPlane2DView.h"
#include "vtkCellArray.h"
_imageResult = NULL;
// line horizontal
- _pts = NULL;
- _lineActor = NULL;
- _lineMapper = NULL;
- _pd = NULL;
+ _pts = NULL;
+ _lineActor = NULL;
+ _lineMapper = NULL;
+ _pd = NULL;
- _interactorstyleplane2D = false;
+ _interactorstyleplane2D = NULL;
}
//-------------------------------------------------------------------
vtkPlane2DView::~vtkPlane2DView()
{
ResetPlane();
-
// Horizontal Line
if (_pts != NULL) { _pts -> Delete(); }
if (_lineActor != NULL) { _lineActor -> Delete(); }
if (_lineMapper != NULL) { _lineMapper -> Delete(); }
if (_pd != NULL) { _pd -> Delete(); }
-
_transform1 -> Delete();
_transform2 -> Delete();
}
}
//-------------------------------------------------------------------
-void vtkPlane2DView::ResetPlane(){
+void vtkPlane2DView::ResetPlane()
+{
if (_pSource !=NULL) { _pSource -> Delete(); }
if (_3Dslices !=NULL) { _3Dslices -> Delete(); }
if (_stPoints !=NULL) { _stPoints -> Delete(); }
if (_change !=NULL) { _change -> Delete(); }
}
+
//-------------------------------------------------------------------
vtkMPRBaseData *vtkPlane2DView::GetVtkmprbasedata()
{
//-------------------------------------------------------------------
void vtkPlane2DView::ExtractPlane()
{
-
double x = GetVtkmprbasedata()->GetX();
double y = GetVtkmprbasedata()->GetY();
double z = GetVtkmprbasedata()->GetZ();
}
//-------------------------------------------------------------------
-
void vtkPlane2DView::Extract_One_PlaneVTK()
{
vtkImageData *imagedata = GetVtkmprbasedata()->GetImageData();
}
//-------------------------------------------------------------------
-
void vtkPlane2DView::Extract_MIP_PlaneVTK( /*double heightDefinition*/ )
{
-
int mipWidth;
double sp;
int sizeWidth = (_mip_width*2)+1 ;
int deltaPixel;
int iWidth,itmp,tmpSizeWith;
-
double spc[3];
vtkImageData *imagedata = GetVtkmprbasedata()->GetImageData();
SetPSource(_sizeIma);
imagedata->GetSpacing(spc);
-
bool heightDefinition=false;
if (_mip_width<3)
{
heightDefinition=true;
}
-
if (heightDefinition==true)
{
mipWidth = _mip_width;
sizeWidth = tmpSizeWith;
deltaPixel = 4;
}
-
-
-
std::vector< vtkProbeFilter* > slicesLST;
-
_pSource->Push( -mipWidth * sp );
_pSource->Update();
-
for ( iWidth=0 ; iWidth<sizeWidth ; iWidth++ )
{
vtkProbeFilter *slice = vtkProbeFilter::New();
slicesLST.push_back( slice );
_pSource->Push( sp );
}
-
if (_imageResult ==NULL)
{
_imageResult = vtkImageData::New();
_imageResult -> AllocateScalars();
_imageResult -> Update();
}
-
unsigned short *pTemp;
unsigned short *pResult;
pResult = (unsigned short*)_imageResult->GetScalarPointer( 0 , 0 , 0 );
-
int iPixels , sizePixels = _sizeIma*_sizeIma;
for(iPixels=0 ; iPixels<sizePixels ; iPixels=iPixels+deltaPixel)
{
-
pTemp = (unsigned short*)slicesLST[0]->GetOutput()->GetPointData()->GetScalars()->GetVoidPointer(0);
-
pResult = (unsigned short*)_imageResult->GetScalarPointer( 0 , 0 , 0 );
pResult[iPixels] = pTemp[iPixels];
-
for (iWidth=1;iWidth<sizeWidth;iWidth++)
{
pTemp = (unsigned short*)slicesLST[iWidth]->GetOutput()->GetPointData()->GetScalars()->GetVoidPointer(0);
pResult[iPixels] = pTemp[iPixels];
}
}
-
if (deltaPixel!=1)
{
for (itmp=1;itmp<deltaPixel;itmp++)
pResult[iPixels+itmp] = pResult[iPixels];
}
}
-
}
-
for (iWidth=0;iWidth<sizeWidth;iWidth++)
{
slicesLST[iWidth]->Delete();
}
-
_imageResult->Modified();
_imageViewer2XYZ->GetVtkImageViewer2()->SetInput ( _imageResult );
-
}
//-------------------------------------------------------------------
// SetActive(false);
_imageViewer2XYZ -> GetVtkImageViewer2() -> SetupInteractor ( iren );
- SetInteractorStyleImage( vtkInteractorStyleBaseView2D::New() );
+ //////////////
+ //RaC 04-2010 Look for the description of new changes in vtkInteractorStyleBaseView2D constructor.
+ //
+ // Previous version
+ // SetInteractorStyleImage( vtkInteractorStyleBaseView2D::New() );
+ //
+ // Actual version
+ vtkInteractorStyleBaseView2D *style2D = vtkInteractorStyleBaseView2D::New();
+ manualInteractorWindowLevel *_manualinteractorwindowlevel= new manualInteractorWindowLevel();
+ style2D->SetInteractorWindowLevel( _manualinteractorwindowlevel );
+ vtkInteractorScrollZ *_vtkInteractorScrollZ = new vtkInteractorScrollZ();
+ style2D->SetInteractorScrollZ(_vtkInteractorScrollZ);
+ SetInteractorStyleImage( style2D );
+
+ // RaC
+ //////////////
_interactorstyleplane2D = new vtkInteractorStylePlane2D();
((vtkInteractorStyleBaseView*)GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _interactorstyleplane2D );
_vtkInfoTextImageInteractorPlane2D->SetModelVtkInfoTextImage(_vtkInfoTextImage);
_vtkInfoTextImage->Configure();
((vtkInteractorStyleBaseView*)this->GetInteractorStyleBaseView())->AddInteractorStyleMaracas(_vtkInfoTextImageInteractorPlane2D);
-
-
}
//-------------------------------------------------------------------
vtkTransform *transform = mprbasedata->GetTransformOrientation();
_transform1->SetMatrix( transform->GetMatrix() );
}
+
//-------------------------------------------------------------------
void vtkPlane2DView::RotationDrag(double vx, double vy, bool ok_v, bool ok_ang)
{
void vtkPlane2DView::Refresh( )
{
ExtractPlane();
+ UpdateColorWindowLevel();
wxVtkBaseView::Refresh();
}
//-------------------------------------------------------------------
}
_lineActor->GetProperty()->SetOpacity(opacity);
}
+
// ----------------------------------------------------------------------------
void vtkPlane2DView::TransfromCoordViewWorld2(double &X, double &Y, double &Z)
{
double spc[3];
GetVtkmprbasedata()->GetImageData()->GetSpacing(spc);
-
double xx = X;
double yy = Y;
double zz = 0;
-
TransFromCoordScreenToWorld(xx,yy,zz);
-
-
vtkTransform *transf1 = vtkTransform::New();
transf1->Identity();
vtkTransform *transf2 = GetVtkmprbasedata()->GetTransformOrientation();
in[1] = xx - center;
in[2] = yy - center;
in[3] = 0;
-
transf1->MultiplyPoint(in,out);
transf1->Delete();
-
X = out[0] + GetVtkmprbasedata()->GetX() ;
Y = out[1] + GetVtkmprbasedata()->GetY() ;
Z = out[2] + GetVtkmprbasedata()->GetZ() ;
-
}