31 #include <vtkCamera.h>
32 #include <vtkRenderer.h>
33 #include <vtkImageData.h>
34 #include <creaMessageManager.h>
70 WxViewer::WxViewer(wxWindow *parent,
80 wxMutexLocker lock(
mMutex);
88 mInteractor =
new crea::creawxVTKRenderWindowInteractor(
this,-1);
91 mViewer = vtkImageViewer2::New();
100 mslide =
new wxSlider(
this,-1,0,0,1, wxDefaultPosition, wxSize(400,40), wxSL_HORIZONTAL | wxSL_LABELS);
103 mcheck =
new wxCheckBox(
this,5123,crea::std2wx(
"Cine Loop"));
124 wxMutexLocker lock(
mMutex);
143 wxMutexLocker lock(
mMutex);
147 mslide->SetMax((
int)pointers.size());
164 wxMutexLocker lock(
mMutex);
176 vtkImageData* currIm=iph->Get();
190 vtkImageData* currIm=iph->Get();
214 int x1,x2,y1,y2,z1,z2;
221 im->GetSpacing(spx,spy,spz);
223 im->GetWholeExtent (x1,x2,y1,y2,z1,z2);
255 double *range = im->GetScalarRange();
256 mViewer->SetColorWindow(range[1] - range[0]);
257 mViewer->SetColorLevel(0.5 * (range[1] + range[0]));
259 mViewer->GetRenderer()->ResetCamera();
262 vtkCamera *camera =
mViewer->GetRenderer()->GetActiveCamera();
263 camera->SetViewUp ( 0 , -1 , 0 );
264 camera->SetPosition ((x1+x2)/2 , (y1+y2)/2 , -10000);
265 camera->SetFocalPoint ((x1+x2)/2 , (y1+y2)/2 , 0 );
266 camera->SetParallelScale( (x2-x1)/3.0 );
271 mViewer->GetRenderer()->ComputeVisiblePropBounds(bounds);
273 mViewer->GetRenderer()->ResetCameraClippingRange(bounds);
274 mViewer->GetRenderer()->SetBackground(0.1,0.1,0.2);
297 wxMutexLocker lock(
mMutex);
373 while(!TestDestroy())
380 endwait = clock () + 0.2 * CLOCKS_PER_SEC ;
381 while (clock() < endwait ) {}