<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">It would help if you wrote a bit about yourself, your constraints, and especially what you would like to do – not just that you want VTK DLLs.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">VTK is bundled with many application frameworks (ParaView, 3D Slicer, etc.), therefore - as others suggested - an obvious solution would be to use those to build your custom application. These frameworks contain not just VTK but other libraries
necessary to build a complete application. You don’t need <i>any </i>compiler, don’t need to worry about GUI toolkit, etc. since all features are available and extensible using Python.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Andras<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> vtkusers <vtkusers-bounces@public.kitware.com> <b>
On Behalf Of </b>A Z<br>
<b>Sent:</b> Wednesday, December 19, 2018 8:47 PM<br>
<b>To:</b> vtkusers@public.kitware.com<br>
<b>Subject:</b> Re: [vtkusers] vtkusers Digest, Vol 176, Issue 22<br>
<b>Importance:</b> High<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">I'm in a situation where I'm in a secure environment,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">and I can't use Visual Studio or other sorts of tools<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">to compile and build the VTK. Particularly,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">this is an issue if I need VTK in 64 bit (for Windows).<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">The other thing is that high speed internet through<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">the hardware of the phone network is not all that great<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">where we are. We are prepared to download the VTK once,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">byt not Visual Studio, who who knows what else<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Cygwin might need. :(<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">What I think I simply finally and just plain need<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">is for the VTK to buld the 64 bit Windows .dlls for me,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">and offer them for download via an internet site.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Can someone who is part of the VTK team acomplish this for me,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">but for other similar members of the public as well?<o:p></o:p></span></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="3" width="98%" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> vtkusers <<a href="mailto:vtkusers-bounces@public.kitware.com">vtkusers-bounces@public.kitware.com</a>> on behalf of
<a href="mailto:vtkusers-request@public.kitware.com">vtkusers-request@public.kitware.com</a> <<a href="mailto:vtkusers-request@public.kitware.com">vtkusers-request@public.kitware.com</a>><br>
<b>Sent:</b> Thursday, 20 December 2018 4:00 AM<br>
<b>To:</b> <a href="mailto:vtkusers@public.kitware.com">vtkusers@public.kitware.com</a><br>
<b>Subject:</b> vtkusers Digest, Vol 176, Issue 22</span> <o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">Send vtkusers mailing list submissions to<br>
<a href="mailto:vtkusers@public.kitware.com">vtkusers@public.kitware.com</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163032570&sdata=eY%2Fun8%2F4MIe5fiVHeDW1qawqKxiV6dqg9lcw2jx62Rc%3D&reserved=0">
https://public.kitware.com/mailman/listinfo/vtkusers</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:vtkusers-request@public.kitware.com">vtkusers-request@public.kitware.com</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:vtkusers-owner@public.kitware.com">vtkusers-owner@public.kitware.com</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of vtkusers digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Problem with displaying cross-hairs on 2D views when using<br>
vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack pipeline<br>
(ochampao)<br>
2. The SetRate() function of vtkFFMPEGWriter is not working<br>
(=?ISO-8859-1?B?eWlydWkxMjEw?=)<br>
3. Re: Visualizing normal vectors (Andaharoo)<br>
4. Re: Problem with displaying cross-hairs on 2D views when<br>
using vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack<br>
pipeline (Andras Lasso)<br>
5. Re: Visualizing normal vectors (mozendi)<br>
6. Re: Visualizing normal vectors (Andaharoo)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Tue, 18 Dec 2018 11:40:46 -0700 (MST)<br>
From: ochampao <<a href="mailto:ochampao@hotmail.com">ochampao@hotmail.com</a>><br>
To: <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
Subject: [vtkusers] Problem with displaying cross-hairs on 2D views<br>
when using vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack<br>
pipeline<br>
Message-ID: <<a href="mailto:1545158446707-0.post@n5.nabble.com">1545158446707-0.post@n5.nabble.com</a>><br>
Content-Type: text/plain; charset=us-ascii<br>
<br>
Hi vtkUsers, <br>
<br>
I am developing a four-pane viewer for displaying medical images. The 3<br>
views display slices of the volumes in the 3 standard anatomical views<br>
(axial, coronal, sagittal) whereas the 4th one displays some 3D surface<br>
rendering of the volume. For now, I will only focus on the 2D views.<br>
<br>
The 2D views use the following pipeline: vtkImageResliceMapper -><br>
vtkImageSlice -> vtkImageStack. This allows the application to overlay<br>
slices from multiple volumes simultaneously. The attached code is a minimal<br>
example of the 2D pipeline I use in my application. The slices displayed are<br>
determined by the focal point of the camera in each 2D view.<br>
<br>
What I would like to do is display a set of cross-hairs on each of the 2D<br>
views, but I don't know how to achieve this using the pipeline I am<br>
currently using.<br>
<br>
I am aware of the classes: <br>
vtkResliceCursorWidget, <br>
vtkResliceCursor, <br>
vtkResliceCursorLineRepresentation, <br>
vtkImagePlaneWidget, <br>
vtkResliceImageViewer<br>
<br>
I have tried using these classes (see commented code in attached source<br>
code), but they don't seem compatible with my current pipeline. For example,<br>
when using vtkResliceCursorWidget the cross-hairs are visible and I can<br>
interact with them but slicing stops working. I also see some weird<br>
artefacts around the border of the slice. Also, to use these classes I need<br>
to specify the volume which the reslice cursor will be slicing<br>
(vtkResliceCursor->SetImage(imageData)), but in my case I have multiple<br>
volumes.<br>
<br>
I am also aware of and tried using vtkCursor2D/vtkCursor3D. Although they<br>
are close to what I have in mind, they allow very limited customization of<br>
their look.<br>
<br>
Essentially what I would like to implement is something that looks like the<br>
cursor of vtkResliceCursorWidget/vtkImagePlaneWidget/vtkResliceImageViewer<br>
but does not handle slicing.<br>
<br>
Can someone recommend how can I achieve this, or point me to some<br>
classes/examples? Is their a way of using<br>
vtkResliceCursorWidget/vtkImagePlaneWidget/vtkResliceImageViewer with my<br>
current pipeline, or would I need to change it?<br>
<br>
Thanks a lot for your help.<br>
Panos<br>
<br>
========================================================<br>
Basic Pipeline Minimal Example<br>
========================================================<br>
#include <vtkCamera.h><br>
#include <vtkDICOMImageReader.h><br>
#include <vtkImageChangeInformation.h><br>
#include <vtkImageData.h><br>
#include <vtkImageProperty.h><br>
#include <vtkImageResliceMapper.h><br>
#include <vtkImageSlice.h><br>
#include <vtkImageStack.h><br>
#include <vtkInteractorStyleImage.h><br>
#include <vtkMath.h><br>
#include <vtkNIFTIImageReader.h><br>
#include <vtkRenderer.h><br>
#include <vtkRenderWindow.h><br>
#include <vtkRenderWindowInteractor.h><br>
#include <vtkSmartPointer.h><br>
<br>
#include <vtkResliceCursor.h><br>
#include <vtkResliceCursorActor.h><br>
#include <vtkResliceCursorLineRepresentation.h><br>
#include <vtkResliceCursorPolyDataAlgorithm.h><br>
#include <vtkResliceCursorWidget.h><br>
<br>
void setupCamera(vtkCamera* camera);<br>
vtkSmartPointer<vtkImageData> loadDicom(const char* filename);<br>
vtkSmartPointer<vtkImageData> loadNifti(const char* filename);<br>
<br>
int main(int, char*[])<br>
{<br>
// Setup renderer<br>
vtkNew<vtkRenderer> renderer;<br>
renderer->SetBackground(0.0, 0.0, 0.0); <br>
renderer->GetActiveCamera()->ParallelProjectionOn();<br>
renderer->ResetCameraClippingRange();<br>
renderer->ResetCamera();<br>
<br>
// Setup renderWindow<br>
vtkNew<vtkRenderWindow> renderWindow;<br>
renderWindow->AddRenderer(renderer);<br>
<br>
// Setup interaction style<br>
vtkNew<vtkInteractorStyleImage> interactorStyle;<br>
interactorStyle->SetInteractionModeToImageSlicing();<br>
<br>
// Setup window interactor<br>
vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;<br>
renderWindowInteractor->SetRenderWindow(renderWindow);<br>
renderWindowInteractor->SetInteractorStyle(interactorStyle);<br>
<br>
// Setup camera<br>
setupCamera(renderer->GetActiveCamera());<br>
<br>
// Load data from DICOM series<br>
// vtkSmartPointer<vtkImageData> imageData = <br>
// loadDicom("<path_to_DICOM_series>"");<br>
<br>
// Load data from Nifti file<br>
vtkSmartPointer<vtkImageData> imageData =<br>
loadNifti("<path_to_nii_file>");<br>
<br>
// setup slice mapper<br>
vtkNew<vtkImageResliceMapper> resliceMapper;<br>
resliceMapper->SetInputData(imageData);<br>
resliceMapper->SliceFacesCameraOn();<br>
resliceMapper->SliceAtFocalPointOn();<br>
resliceMapper->JumpToNearestSliceOn();<br>
resliceMapper->BorderOff();<br>
<br>
// Set to full window and centered level:<br>
double window = imageData->GetScalarRange()[1] -<br>
imageData->GetScalarRange()[0];<br>
double level = imageData->GetScalarRange()[0] + window / 2.0;<br>
<br>
// Setup prop holding the slice<br>
vtkNew<vtkImageSlice> imageSlice;<br>
imageSlice->SetMapper(resliceMapper);<br>
imageSlice->GetProperty()->SetColorWindow(window);<br>
imageSlice->GetProperty()->SetColorLevel(level);<br>
imageSlice->GetProperty()->SetLayerNumber(0);<br>
imageSlice->GetProperty()->SetInterpolationTypeToNearest();<br>
<br>
// Setup prop holding the multiple slices<br>
vtkNew<vtkImageStack> imageStack;<br>
imageStack->SetActiveLayer(imageSlice->GetProperty()->GetLayerNumber());<br>
imageStack->AddImage(imageSlice); // add slice<br>
<br>
vtkNew<vtkResliceCursor> resliceCursor;<br>
resliceCursor->SetCenter(imageData->GetCenter());<br>
resliceCursor->SetThickMode(0);<br>
resliceCursor->SetImage(imageData);<br>
<br>
vtkNew<vtkResliceCursorLineRepresentation> cursorRepresentation;<br>
cursorRepresentation->GetResliceCursorActor()-><br>
GetCursorAlgorithm()->SetResliceCursor(resliceCursor);<br>
cursorRepresentation->GetResliceCursorActor()-><br>
BasicPipeline.cxx<br>
<<a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2Ffile%2Ft341857%2FBasicPipeline.cxx&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163032570&sdata=aPM215BfRYQdhtY2KpItrlC4x0wlNWOMeAHxs81q74o%3D&reserved=0">http://vtk.1045678.n5.nabble.com/file/t341857/BasicPipeline.cxx</a>>
<br>
GetCursorAlgorithm()->SetReslicePlaneNormal(2);<br>
<br>
vtkNew<vtkResliceCursorWidget> resliceCursorWidget;<br>
resliceCursorWidget->SetInteractor(renderWindowInteractor);<br>
resliceCursorWidget->SetDefaultRenderer(renderer);<br>
resliceCursorWidget->SetRepresentation(cursorRepresentation);<br>
resliceCursorWidget->SetManageWindowLevel(false);<br>
resliceCursorWidget->EnabledOn();<br>
//resliceCursorWidget->ProcessEventsOff();<br>
<br>
// Add actors to renderer<br>
renderer->AddViewProp(imageStack);<br>
renderer->ResetCamera(); <br>
<br>
// Start interaction<br>
renderWindowInteractor->Initialize();<br>
renderWindow->Render();<br>
renderWindowInteractor->Start();<br>
<br>
return EXIT_SUCCESS;<br>
}<br>
<br>
void setupCamera(vtkCamera* camera)<br>
{<br>
double viewUp[3] = { 0, 1, 0 };<br>
double leftToRight[3] = { 1, 0, 0 };<br>
<br>
// compute the view plane normal<br>
double normal[3];<br>
vtkMath::Cross(leftToRight, viewUp, normal);<br>
<br>
// get the camera focus<br>
double focus[3];<br>
camera->GetFocalPoint(focus);<br>
<br>
// get the camera distance from the focus<br>
double d = camera->GetDistance();<br>
<br>
// position the camera on view plane normal keeping the focus and the<br>
distance from it fixed<br>
camera->SetPosition(<br>
focus[0] + d*normal[0],<br>
focus[1] + d*normal[1],<br>
focus[2] + d*normal[2]);<br>
<br>
// make sure focus is the same<br>
camera->SetFocalPoint(focus);<br>
<br>
// setup view up vector<br>
camera->SetViewUp(viewUp);<br>
camera->OrthogonalizeViewUp();<br>
}<br>
<br>
vtkSmartPointer<vtkImageData> loadDicom(const char* filename)<br>
{<br>
vtkNew<vtkDICOMImageReader> reader;<br>
reader->FileLowerLeftOn();<br>
reader->SetDirectoryName(filename);<br>
reader->UpdateInformation();<br>
<br>
vtkNew<vtkImageChangeInformation> imageInfo;<br>
imageInfo->SetOutputOrigin(0.0, 0.0, 0.0);<br>
imageInfo->SetOutputSpacing(reader->GetPixelSpacing());<br>
imageInfo->SetInputConnection(reader->GetOutputPort());<br>
imageInfo->Update();<br>
<br>
return imageInfo->GetOutput();<br>
}<br>
<br>
vtkSmartPointer<vtkImageData> loadNifti(const char* filename)<br>
{<br>
vtkNew<vtkNIFTIImageReader> niftiiReader;<br>
niftiiReader->SetFileName(filename);<br>
<br>
vtkNew<vtkImageChangeInformation> imageInfo;<br>
imageInfo->SetOutputOrigin(0.0, 0.0, 0.0);<br>
imageInfo->SetInputConnection(niftiiReader->GetOutputPort());<br>
imageInfo->Update();<br>
<br>
return imageInfo->GetOutput();//data;<br>
}<br>
<br>
<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2FVTK-Users-f1224199.html&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163042579&sdata=DPM9VHPGQFDUia39o70QklgJeD3%2BdRhq5RCCSD4iED8%3D&reserved=0">
http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html</a><br>
<br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Wed, 19 Dec 2018 08:25:13 +0800<br>
From: "=?ISO-8859-1?B?eWlydWkxMjEw?=" <<a href="mailto:523480317@qq.com">523480317@qq.com</a>><br>
To: "=?ISO-8859-1?B?dnRrdXNlcnM=?=" <<a href="mailto:vtkusers@public.kitware.com">vtkusers@public.kitware.com</a>><br>
Subject: [vtkusers] The SetRate() function of vtkFFMPEGWriter is not<br>
working<br>
Message-ID: <<a href="mailto:tencent_C1E9E5F99AB683BA70FF9EF4DCFA1923C109@qq.com">tencent_C1E9E5F99AB683BA70FF9EF4DCFA1923C109@qq.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Hello, VTKer<br>
<br>
<br>
I am using vtkFFMPEGWriter to write a video, no matter the frame rate I set, the output video is still 600 frames/sec.<br>
<br>
The code I used has been attached. Can anybody check the problem for me? Thank you so much.<br>
<br>
<br>
Regards,<br>
YiRui<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fpipermail%2Fvtkusers%2Fattachments%2F20181219%2F8caa3726%2Fattachment-0001.html&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163042579&sdata=NzlPwB9Db9V7YJq6a2HRXVBmPnfwgIy6HOM4NjWE9sA%3D&reserved=0">https://public.kitware.com/pipermail/vtkusers/attachments/20181219/8caa3726/attachment-0001.html</a>><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: <a href="mailto:64066463@168E0131.E98F195C.png.jpg">64066463@168E0131.E98F195C.png.jpg</a><br>
Type: image/jpeg<br>
Size: 5053 bytes<br>
Desc: not available<br>
URL: <<a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fpipermail%2Fvtkusers%2Fattachments%2F20181219%2F8caa3726%2Fattachment-0001.jpg&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163052583&sdata=D%2Fptkwwa0RmSNAoVRJbeCOtZsMVM3xq1%2ByaGVwY%2B4zM%3D&reserved=0">https://public.kitware.com/pipermail/vtkusers/attachments/20181219/8caa3726/attachment-0001.jpg</a>><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: 1.png<br>
Type: application/octet-stream<br>
Size: 5053 bytes<br>
Desc: not available<br>
URL: <<a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fpipermail%2Fvtkusers%2Fattachments%2F20181219%2F8caa3726%2Fattachment-0003.obj&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163052583&sdata=RKv6sMASEMcF0%2BR6GxeXoheq0xW2w3KuHAy8B4lazfw%3D&reserved=0">https://public.kitware.com/pipermail/vtkusers/attachments/20181219/8caa3726/attachment-0003.obj</a>><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: CMakeLists.txt<br>
Type: application/octet-stream<br>
Size: 303 bytes<br>
Desc: not available<br>
URL: <<a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fpipermail%2Fvtkusers%2Fattachments%2F20181219%2F8caa3726%2Fattachment-0004.obj&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163062592&sdata=SZ6k0d45utn0pkeYzIFy4nmxsoFu4MI0NcGe6%2FpLSro%3D&reserved=0">https://public.kitware.com/pipermail/vtkusers/attachments/20181219/8caa3726/attachment-0004.obj</a>><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: FFMPEG.cxx<br>
Type: application/octet-stream<br>
Size: 1027 bytes<br>
Desc: not available<br>
URL: <<a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fpipermail%2Fvtkusers%2Fattachments%2F20181219%2F8caa3726%2Fattachment-0005.obj&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163472878&sdata=uPmvYxoboloUaJ6g48aZQCgsWC23us2F6pfX8NZiSEs%3D&reserved=0">https://public.kitware.com/pipermail/vtkusers/attachments/20181219/8caa3726/attachment-0005.obj</a>><br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Tue, 18 Dec 2018 18:37:04 -0700 (MST)<br>
From: Andaharoo <<a href="mailto:Andx_roo@live.com">Andx_roo@live.com</a>><br>
To: <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
Subject: Re: [vtkusers] Visualizing normal vectors<br>
Message-ID: <<a href="mailto:1545183424782-0.post@n5.nabble.com">1545183424782-0.post@n5.nabble.com</a>><br>
Content-Type: text/plain; charset=us-ascii<br>
<br>
I'd recommend using vtkOpenGLGlyph3DMapper instead. Much faster, assuming you<br>
have some gpu. Just make sure the normal array/orientation array is in the<br>
input polyData's point data.<br>
<br>
IE:<br>
polyData->GetPointData()->AddArray(your normal array)<br>
<br>
Then just specify the array the mapper should use with<br>
SetOrientationArray(your arrays name here). It will then search for the<br>
array in the input polydata. I frequently use this to draw thousands of<br>
oriented arrows with VTK.<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2FVTK-Users-f1224199.html&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163482887&sdata=D%2FGVwMDEpSraZksSHbj4KPv1yIj1LqwvR0IN8ONZSKg%3D&reserved=0">
http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html</a><br>
<br>
<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Wed, 19 Dec 2018 06:31:31 +0000<br>
From: Andras Lasso <<a href="mailto:lasso@queensu.ca">lasso@queensu.ca</a>><br>
To: ochampao <<a href="mailto:ochampao@hotmail.com">ochampao@hotmail.com</a>>, "<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>"<br>
<<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>><br>
Subject: Re: [vtkusers] Problem with displaying cross-hairs on 2D<br>
views when using vtkImageResliceMapper -> vtkImageSlice -><br>
vtkImageStack pipeline<br>
Message-ID:<br>
<<a href="mailto:YTXPR0101MB1870ABE4ABBF6595CEEDB4FDD8BE0@YTXPR0101MB1870.CANPRD01.PROD.OUTLOOK.COM">YTXPR0101MB1870ABE4ABBF6595CEEDB4FDD8BE0@YTXPR0101MB1870.CANPRD01.PROD.OUTLOOK.COM</a>><br>
<br>
Content-Type: text/plain; charset="us-ascii"<br>
<br>
It is great that you are interested in medical imaging and has chosen to work with VTK. I would recommend to put your talent and effort into contributing to an existing open-source medical image viewer instead of spending time with redeveloping basic features.
You could work on more interesting things, develop new features, and you would very quickly become a useful, valued member of a community.<br>
<br>
If you are interested in answers to your question (and your future questions) you can have a look at source code of existing VTK-based open-source medical image viewers, such as 3D Slicer, MITK, medInria, Horos, Ibis, CustusX, CamiTK, Invesalius, etc.<br>
<br>
Andras<br>
<br>
-----Original Message-----<br>
From: vtkusers <<a href="mailto:vtkusers-bounces@public.kitware.com">vtkusers-bounces@public.kitware.com</a>> On Behalf Of ochampao<br>
Sent: Tuesday, December 18, 2018 1:41 PM<br>
To: <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
Subject: [vtkusers] Problem with displaying cross-hairs on 2D views when using vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack pipeline<br>
<br>
Hi vtkUsers, <br>
<br>
I am developing a four-pane viewer for displaying medical images. The 3 views display slices of the volumes in the 3 standard anatomical views (axial, coronal, sagittal) whereas the 4th one displays some 3D surface rendering of the volume. For now, I will only
focus on the 2D views.<br>
<br>
The 2D views use the following pipeline: vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack. This allows the application to overlay slices from multiple volumes simultaneously. The attached code is a minimal example of the 2D pipeline I use in my application.
The slices displayed are determined by the focal point of the camera in each 2D view.<br>
<br>
What I would like to do is display a set of cross-hairs on each of the 2D views, but I don't know how to achieve this using the pipeline I am currently using.<br>
<br>
I am aware of the classes: <br>
vtkResliceCursorWidget,<br>
vtkResliceCursor,<br>
vtkResliceCursorLineRepresentation,<br>
vtkImagePlaneWidget,<br>
vtkResliceImageViewer<br>
<br>
I have tried using these classes (see commented code in attached source code), but they don't seem compatible with my current pipeline. For example, when using vtkResliceCursorWidget the cross-hairs are visible and I can interact with them but slicing stops
working. I also see some weird artefacts around the border of the slice. Also, to use these classes I need to specify the volume which the reslice cursor will be slicing (vtkResliceCursor->SetImage(imageData)), but in my case I have multiple volumes.<br>
<br>
I am also aware of and tried using vtkCursor2D/vtkCursor3D. Although they are close to what I have in mind, they allow very limited customization of their look.<br>
<br>
Essentially what I would like to implement is something that looks like the cursor of vtkResliceCursorWidget/vtkImagePlaneWidget/vtkResliceImageViewer<br>
but does not handle slicing.<br>
<br>
Can someone recommend how can I achieve this, or point me to some classes/examples? Is their a way of using vtkResliceCursorWidget/vtkImagePlaneWidget/vtkResliceImageViewer with my current pipeline, or would I need to change it?<br>
<br>
Thanks a lot for your help.<br>
Panos<br>
<br>
========================================================<br>
Basic Pipeline Minimal Example<br>
========================================================<br>
#include <vtkCamera.h><br>
#include <vtkDICOMImageReader.h><br>
#include <vtkImageChangeInformation.h><br>
#include <vtkImageData.h><br>
#include <vtkImageProperty.h><br>
#include <vtkImageResliceMapper.h><br>
#include <vtkImageSlice.h><br>
#include <vtkImageStack.h><br>
#include <vtkInteractorStyleImage.h><br>
#include <vtkMath.h><br>
#include <vtkNIFTIImageReader.h><br>
#include <vtkRenderer.h><br>
#include <vtkRenderWindow.h><br>
#include <vtkRenderWindowInteractor.h><br>
#include <vtkSmartPointer.h><br>
<br>
#include <vtkResliceCursor.h><br>
#include <vtkResliceCursorActor.h><br>
#include <vtkResliceCursorLineRepresentation.h><br>
#include <vtkResliceCursorPolyDataAlgorithm.h><br>
#include <vtkResliceCursorWidget.h><br>
<br>
void setupCamera(vtkCamera* camera);<br>
vtkSmartPointer<vtkImageData> loadDicom(const char* filename); vtkSmartPointer<vtkImageData> loadNifti(const char* filename);<br>
<br>
int main(int, char*[])<br>
{<br>
// Setup renderer<br>
vtkNew<vtkRenderer> renderer;<br>
renderer->SetBackground(0.0, 0.0, 0.0); <br>
renderer->GetActiveCamera()->ParallelProjectionOn();<br>
renderer->ResetCameraClippingRange();<br>
renderer->ResetCamera();<br>
<br>
// Setup renderWindow<br>
vtkNew<vtkRenderWindow> renderWindow;<br>
renderWindow->AddRenderer(renderer);<br>
<br>
// Setup interaction style<br>
vtkNew<vtkInteractorStyleImage> interactorStyle;<br>
interactorStyle->SetInteractionModeToImageSlicing();<br>
<br>
// Setup window interactor<br>
vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;<br>
renderWindowInteractor->SetRenderWindow(renderWindow);<br>
renderWindowInteractor->SetInteractorStyle(interactorStyle);<br>
<br>
// Setup camera<br>
setupCamera(renderer->GetActiveCamera());<br>
<br>
// Load data from DICOM series<br>
// vtkSmartPointer<vtkImageData> imageData = <br>
// loadDicom("<path_to_DICOM_series>"");<br>
<br>
// Load data from Nifti file<br>
vtkSmartPointer<vtkImageData> imageData =<br>
loadNifti("<path_to_nii_file>");<br>
<br>
// setup slice mapper<br>
vtkNew<vtkImageResliceMapper> resliceMapper;<br>
resliceMapper->SetInputData(imageData);<br>
resliceMapper->SliceFacesCameraOn();<br>
resliceMapper->SliceAtFocalPointOn();<br>
resliceMapper->JumpToNearestSliceOn();<br>
resliceMapper->BorderOff();<br>
<br>
// Set to full window and centered level:<br>
double window = imageData->GetScalarRange()[1] -<br>
imageData->GetScalarRange()[0];<br>
double level = imageData->GetScalarRange()[0] + window / 2.0;<br>
<br>
// Setup prop holding the slice<br>
vtkNew<vtkImageSlice> imageSlice;<br>
imageSlice->SetMapper(resliceMapper);<br>
imageSlice->GetProperty()->SetColorWindow(window);<br>
imageSlice->GetProperty()->SetColorLevel(level);<br>
imageSlice->GetProperty()->SetLayerNumber(0);<br>
imageSlice->GetProperty()->SetInterpolationTypeToNearest();<br>
<br>
// Setup prop holding the multiple slices<br>
vtkNew<vtkImageStack> imageStack;<br>
imageStack->SetActiveLayer(imageSlice->GetProperty()->GetLayerNumber());<br>
imageStack->AddImage(imageSlice); // add slice<br>
<br>
vtkNew<vtkResliceCursor> resliceCursor;<br>
resliceCursor->SetCenter(imageData->GetCenter());<br>
resliceCursor->SetThickMode(0);<br>
resliceCursor->SetImage(imageData);<br>
<br>
vtkNew<vtkResliceCursorLineRepresentation> cursorRepresentation;<br>
cursorRepresentation->GetResliceCursorActor()-><br>
GetCursorAlgorithm()->SetResliceCursor(resliceCursor);<br>
cursorRepresentation->GetResliceCursorActor()-><br>
BasicPipeline.cxx<br>
<<a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2Ffile%2Ft341857%2FBasicPipeline.cxx&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163492892&sdata=uMqISfi7nswEMbNdPApWkrvl8pKz%2FjgVYzfedJL3dCI%3D&reserved=0">https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2Ffile%2Ft341857%2FBasicPipeline.cxx&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=nT57nY7HqbSgYg8flXNrjvfhqXVDbvDHbyEOMCVE3V0%3D&reserved=0</a>><br>
GetCursorAlgorithm()->SetReslicePlaneNormal(2);<br>
<br>
vtkNew<vtkResliceCursorWidget> resliceCursorWidget;<br>
resliceCursorWidget->SetInteractor(renderWindowInteractor);<br>
resliceCursorWidget->SetDefaultRenderer(renderer);<br>
resliceCursorWidget->SetRepresentation(cursorRepresentation);<br>
resliceCursorWidget->SetManageWindowLevel(false);<br>
resliceCursorWidget->EnabledOn();<br>
//resliceCursorWidget->ProcessEventsOff();<br>
<br>
// Add actors to renderer<br>
renderer->AddViewProp(imageStack);<br>
renderer->ResetCamera(); <br>
<br>
// Start interaction<br>
renderWindowInteractor->Initialize();<br>
renderWindow->Render();<br>
renderWindowInteractor->Start();<br>
<br>
return EXIT_SUCCESS;<br>
}<br>
<br>
void setupCamera(vtkCamera* camera)<br>
{<br>
double viewUp[3] = { 0, 1, 0 };<br>
double leftToRight[3] = { 1, 0, 0 };<br>
<br>
// compute the view plane normal<br>
double normal[3];<br>
vtkMath::Cross(leftToRight, viewUp, normal);<br>
<br>
// get the camera focus<br>
double focus[3];<br>
camera->GetFocalPoint(focus);<br>
<br>
// get the camera distance from the focus<br>
double d = camera->GetDistance();<br>
<br>
// position the camera on view plane normal keeping the focus and the distance from it fixed<br>
camera->SetPosition(<br>
focus[0] + d*normal[0],<br>
focus[1] + d*normal[1],<br>
focus[2] + d*normal[2]);<br>
<br>
// make sure focus is the same<br>
camera->SetFocalPoint(focus);<br>
<br>
// setup view up vector<br>
camera->SetViewUp(viewUp);<br>
camera->OrthogonalizeViewUp();<br>
}<br>
<br>
vtkSmartPointer<vtkImageData> loadDicom(const char* filename) {<br>
vtkNew<vtkDICOMImageReader> reader;<br>
reader->FileLowerLeftOn();<br>
reader->SetDirectoryName(filename);<br>
reader->UpdateInformation();<br>
<br>
vtkNew<vtkImageChangeInformation> imageInfo;<br>
imageInfo->SetOutputOrigin(0.0, 0.0, 0.0);<br>
imageInfo->SetOutputSpacing(reader->GetPixelSpacing());<br>
imageInfo->SetInputConnection(reader->GetOutputPort());<br>
imageInfo->Update();<br>
<br>
return imageInfo->GetOutput();<br>
}<br>
<br>
vtkSmartPointer<vtkImageData> loadNifti(const char* filename) {<br>
vtkNew<vtkNIFTIImageReader> niftiiReader;<br>
niftiiReader->SetFileName(filename);<br>
<br>
vtkNew<vtkImageChangeInformation> imageInfo;<br>
imageInfo->SetOutputOrigin(0.0, 0.0, 0.0);<br>
imageInfo->SetInputConnection(niftiiReader->GetOutputPort());<br>
imageInfo->Update();<br>
<br>
return imageInfo->GetOutput();//data;<br>
}<br>
<br>
<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2FVTK-Users-f1224199.html&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163492892&sdata=HRYXSwHqmPt0YG%2BVeNX%2FbWzP37Qyw8ya2RKpufihDWc%3D&reserved=0">
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2FVTK-Users-f1224199.html&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=y%2FPL7RWRxL9djen9OHHFpV8mML1l8tDDID8vwEPDzr4%3D&reserved=0</a><br>
_______________________________________________<br>
Powered by <a href="https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163502901&sdata=iTrguWEzVq0miNCMXixqvHPZoDe0peNmYpI5g5FeZVQ%3D&reserved=0">
https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=a5wXXUd01fJsRRfeOlVc%2Bk6JcNbeRrCaawzEeOBEpIQ%3D&reserved=0</a><br>
<br>
Visit other Kitware open-source projects at <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163502901&sdata=KQpleKx8ViCxjCc5jmRwbHQxZEDWiVmsuKnAJzCrXgg%3D&reserved=0">
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=GTPQfYrm85nLVvMYqtzwxYrfNS%2BHK2U5E%2F8%2FXjTuyGQ%3D&reserved=0</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163512906&sdata=y5qfIOP7usx7Ne8Mc1jIR1zoKIhkMouKka3KWC%2BvrQE%3D&reserved=0">
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=3OkV0h9SM82LHRbPbSKbfXkZuLWSqAjPyULJuBV%2FrGQ%3D&reserved=0</a><br>
<br>
Search the list archives at: <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163512906&sdata=OiBL%2F5upHLlq0JpRXcghEm9%2FSoFDc0vNBKQ8FdI%2BUoU%3D&reserved=0">
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=ydyX30Af9G0j8PwVigfaCkucOiFqv0SdNKwyi7vx56Y%3D&reserved=0</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163522910&sdata=3Nl%2FEEWA3%2B7XOz0TzcZi4zv%2FcjBa6iCisUe%2F%2B163OIw%3D&reserved=0">https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&sdata=zYNgte5262YQQDT42ydJgSd1qTiDwQBW4DeWwgOlCzE%3D&reserved=0</a><br>
<br>
<br>
------------------------------<br>
<br>
Message: 5<br>
Date: Wed, 19 Dec 2018 01:24:28 -0700 (MST)<br>
From: mozendi <<a href="mailto:mozendi@gmail.com">mozendi@gmail.com</a>><br>
To: <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
Subject: Re: [vtkusers] Visualizing normal vectors<br>
Message-ID: <<a href="mailto:1545207868212-0.post@n5.nabble.com">1545207868212-0.post@n5.nabble.com</a>><br>
Content-Type: text/plain; charset=us-ascii<br>
<br>
Dear Andaharoo,<br>
Thank you for your recommendation. I tried to modify my codes according to<br>
your recommendations, my code is getting compiled successfully. However,<br>
when I run it I am getting an error message. The screenshot and my code are<br>
below. Could you please tell me what is wrong with my code?<br>
Thanks in advance<br>
<<a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2Ffile%2Ft341822%2Fvtk_error_message.png&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163522910&sdata=zUKKeUu%2Fi%2FGlRffxg41%2Bky7mgz%2FxMh15UrPbrnF2ZJA%3D&reserved=0">http://vtk.1045678.n5.nabble.com/file/t341822/vtk_error_message.png</a>>
<br>
<br>
<br>
#include <vtkVersion.h><br>
#include <vtkSmartPointer.h><br>
#include <vtkProperty.h><br>
#include <vtkPolyDataMapper.h><br>
#include <vtkActor.h><br>
#include <vtkDelimitedTextReader.h><br>
#include <vtkDoubleArray.h><br>
#include <vtkTable.h><br>
#include <vtkPointData.h><br>
#include <vtkRenderWindow.h><br>
#include <vtkRenderWindowInteractor.h><br>
#include <vtkRenderer.h><br>
#include <vtkVertexGlyphFilter.h><br>
#include <vtkArrowSource.h><br>
#include <vtkGlyph3D.h><br>
#include <vtkPointSource.h><br>
# include "vtkGlyph3DMapper.h"<br>
# include "vtkGlyph3DMapper.h"<br>
#include <vtkOpenGLGlyph3DMapper.h><br>
#include <vector><br>
<br>
<br>
int main(int argc, char* argv[])<br>
{<br>
vtkSmartPointer<vtkDelimitedTextReader> reader =<br>
vtkSmartPointer<vtkDelimitedTextReader>::New();<br>
reader->SetFileName("points_and_normals.xyz");<br>
reader->DetectNumericColumnsOn();<br>
reader->SetFieldDelimiterCharacters(" ");<br>
reader->Update();<br>
<br>
vtkTable* table = reader->GetOutput();<br>
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();<br>
vtkSmartPointer<vtkDoubleArray> normals =<br>
vtkSmartPointer<vtkDoubleArray>::New();<br>
normals->SetNumberOfComponents(3); //3d normals (ie x,y,z)<br>
<br>
std::cout << "Table has " << table->GetNumberOfRows()<br>
<< " rows." << std::endl;<br>
std::cout << "Table has " << table->GetNumberOfColumns()<br>
<< " columns." << std::endl;<br>
<br>
for (vtkIdType i = 0; i < table->GetNumberOfRows(); i++)<br>
{<br>
<br>
points->InsertNextPoint((table->GetValue(i, 0)).ToDouble(),<br>
(table->GetValue(i, 1)).ToDouble(),<br>
(table->GetValue(i, 2)).ToDouble());<br>
<br>
double n[3];<br>
n[0] = (table->GetValue(i, 3)).ToDouble();<br>
n[1] = (table->GetValue(i, 4)).ToDouble();<br>
n[2] = (table->GetValue(i, 5)).ToDouble();<br>
normals->InsertNextTuple(n);<br>
}<br>
<br>
std::cout << "There are " << points->GetNumberOfPoints()<br>
<< " points." << std::endl;<br>
<br>
<br>
vtkSmartPointer<vtkPolyData> polydata =<br>
vtkSmartPointer<vtkPolyData>::New();<br>
polydata->SetPoints(points);<br>
//polydata->GetPointData()->SetNormals(normals);<br>
polydata->GetPointData()->AddArray(normals);<br>
<br>
vtkSmartPointer<vtkOpenGLGlyph3DMapper> Glyph3D =<br>
vtkSmartPointer<vtkOpenGLGlyph3DMapper>::New();<br>
Glyph3D->SetInputData(polydata);<br>
Glyph3D->SetOrientationArray("normals");<br>
Glyph3D->SetScaleFactor(.5);<br>
Glyph3D->Update();<br>
<br>
vtkSmartPointer<vtkActor> glyph3DActor = vtkSmartPointer<vtkActor>::New();<br>
glyph3DActor->SetMapper(Glyph3D);<br>
glyph3DActor->GetProperty()->SetColor(0.8900, 0.8100, 0.3400);<br>
<br>
vtkSmartPointer<vtkRenderer> renderer =<br>
vtkSmartPointer<vtkRenderer>::New();<br>
vtkSmartPointer<vtkRenderWindow> renderWindow =<br>
vtkSmartPointer<vtkRenderWindow>::New();<br>
renderWindow->AddRenderer(renderer);<br>
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =<br>
vtkSmartPointer<vtkRenderWindowInteractor>::New();<br>
renderWindowInteractor->SetRenderWindow(renderWindow);<br>
renderer->AddActor(glyph3DActor);<br>
renderer->SetBackground(.5, .5, .5);<br>
renderWindow->Render();<br>
renderWindowInteractor->Start();<br>
return EXIT_SUCCESS;<br>
}<br>
<br>
<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2FVTK-Users-f1224199.html&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163532919&sdata=MmNepMcXI191xo5I6cV4v0vai7dc8xK98L8X5l2YbiE%3D&reserved=0">
http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html</a><br>
<br>
<br>
------------------------------<br>
<br>
Message: 6<br>
Date: Wed, 19 Dec 2018 02:26:23 -0700 (MST)<br>
From: Andaharoo <<a href="mailto:Andx_roo@live.com">Andx_roo@live.com</a>><br>
To: <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
Subject: Re: [vtkusers] Visualizing normal vectors<br>
Message-ID: <<a href="mailto:1545211583462-0.post@n5.nabble.com">1545211583462-0.post@n5.nabble.com</a>><br>
Content-Type: text/plain; charset=us-ascii<br>
<br>
Your error said an array index went out of bounds. What line? Also I noticed<br>
you never set the source data for the glyph. Could be unrelated to your<br>
current error message, but a problem.<br>
<br>
The glyph mapper takes two inputs. The glyph data (positions, normals,<br>
scalars, etc) and the source (thing to copy). So if you want arrows as the<br>
normals do this:<br>
<br>
vtkSmartPointer<vtkOpenGLGlyph3DMapper> glyph3D =<br>
vtkSmartPointer<vtkOpenGLGlyph3DMapper>::New(); <br>
glyph3D ->SetInputData(polydata); <br>
vtkSmartPointer<vtkArrowSource> glyphSource =<br>
vtkSmartPointer<vtkArrowSource>::New();<br>
glyphSource->Update();<br>
glyph3D->SetSourceData(glyphSource->GetOutput());<br>
glyph3D ->SetOrientationArray("normals"); <br>
glyph3D ->SetScaleFactor(0.5); <br>
glyph3D ->Update(); <br>
<br>
<br>
<br>
--<br>
Sent from: <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2FVTK-Users-f1224199.html&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163532919&sdata=MmNepMcXI191xo5I6cV4v0vai7dc8xK98L8X5l2YbiE%3D&reserved=0">
http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html</a><br>
<br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
Powered by <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163542929&sdata=oYu3t7mN9tFstQxjYzM1PR4j%2FiStrDWK0BRR6yJaMHg%3D&reserved=0">
www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163542929&sdata=pEfE3o6G8GS29y%2B1mMMzL%2FOyeIRoqARYd%2BupysTCmQ4%3D&reserved=0">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163552942&sdata=bT1ZxRudvuQbKKgqGB1E1iU7UvAa1wokDs%2FLTR2zISM%3D&reserved=0">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163552942&sdata=SqgCPGI9J8uR3%2F41OIyH13lSjN5avPKdWPCt9Skgw0U%3D&reserved=0">
http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40queensu.ca%7Cfedd9df10c424535884b08d6661d02be%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636808672163562938&sdata=NVpbwf360uGtnfLG2aiesXrSUR5ihfpu0dQRXxZ4qEI%3D&reserved=0">https://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br>
<br>
------------------------------<br>
<br>
End of vtkusers Digest, Vol 176, Issue 22<br>
*****************************************<o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>