[vtkusers] point picking on vtkImageActors
shengweng
shengwen.guo at gmail.com
Sat Jul 30 12:31:27 EDT 2011
Hi,Dean,
I want to implement to display the mouse position and intensity using the
class vtkImageCoordinateWidget, but I don't understand what's the header
files "vtkLocalHybridWin32Header.h" and how to write this file.
Would you please explaining the following texts and give me an example?
#include "vtkLocalHybridWin32Header.h" // Include configuration header.
// note that you should use the build structure in /VTK/EXAMPLES/BUILD/vtkMy
// and NOT vtkLocal, I just call my build vtkLocal because I don't like
"vtkMy"
// See the readme documentation in /VTK/EXAMPLES/BUILD/vtkMy
// You may also have to rename VTK_LOCAL_HYBRID_EXPORT depending on your
// specific naming convention.
I also found somebody submitted a sample code as follow:
//////////////////////////////////////////////////////////////
#include "vtkImageActor.h"
#include "vtkImageData.h"
#include "vtkImageCoordinateWidget.h"
#include "vtkInteractorStyleImage.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkVolume16Reader.h"
#include "vtkImageCoordinateWidget.h"
#include "vtkImageViewer2.h"
void main( void )
{
char* fname = "D:/Guo/VTKData/Data/headsq/quarter";
// Start by loading some data.
//
vtkVolume16Reader* v16 = vtkVolume16Reader::New();
v16->SetDataDimensions(64, 64);
v16->SetDataByteOrderToLittleEndian();
v16->SetImageRange(1, 93);
v16->SetDataSpacing(3.2, 3.2, 1.5);
v16->SetFilePrefix(fname);
v16->ReleaseDataFlagOn();
v16->SetDataMask(0x7fff);
v16->Update();
delete[] fname;
vtkImageViewer2* viewer = vtkImageViewer2::New();
vtkInteractorStyleImage* style = vtkInteractorStyleImage::New();
vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
iren->SetInteractorStyle(style);
viewer->SetupInteractor(iren);
viewer->SetInput(v16->GetOutput());
viewer->SetSliceOrientationToXY();
viewer->SetSlice(45);
style->Delete();
// Set up the image coord widget
//
vtkImageCoordinateWidget* widget = vtkImageCoordinateWidget::New();
widget->SetDefaultRenderer(viewer->GetRenderer());
widget->SetViewProp(viewer->GetImageActor());
widget->SetInput(v16->GetOutput());
widget->SetInteractor(iren);
widget->DisplayTextOn();
widget->On();
viewer->Render();
iren->Start();
widget->Delete();
v16->Delete();
viewer->Delete();
iren->Delete();
}
Thanks,
Shengwen
--
View this message in context: http://vtk.1045678.n5.nabble.com/point-picking-on-vtkImageActors-tp1227852p4650058.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list