<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I'm in a situation where I'm in a secure environment,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
and I can't use Visual Studio or other sorts of tools</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
to compile and build the VTK.  Particularly,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
this is an issue if I need VTK in 64 bit (for Windows).</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The other thing is that high speed internet through</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
the hardware of the phone network is not all that great</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
where we are.  We are prepared to download the VTK once,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
byt not Visual Studio, who who knows what else</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Cygwin might need.  :(<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
What I think I simply finally and just plain need</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
is for the VTK to buld the 64 bit Windows .dlls for me,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
and offer them for download via an internet site.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Can someone who is part of the VTK team acomplish this for me,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
but for other similar members of the public as well?<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> vtkusers <vtkusers-bounces@public.kitware.com> on behalf of vtkusers-request@public.kitware.com <vtkusers-request@public.kitware.com><br>
<b>Sent:</b> Thursday, 20 December 2018 4:00 AM<br>
<b>To:</b> vtkusers@public.kitware.com<br>
<b>Subject:</b> vtkusers Digest, Vol 176, Issue 22</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Send vtkusers mailing list submissions to<br>
        vtkusers@public.kitware.com<br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="https://public.kitware.com/mailman/listinfo/vtkusers">https://public.kitware.com/mailman/listinfo/vtkusers</a><br>
or, via email, send a message with subject or body 'help' to<br>
        vtkusers-request@public.kitware.com<br>
<br>
You can reach the person managing the list at<br>
        vtkusers-owner@public.kitware.com<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 <ochampao@hotmail.com><br>
To: vtkusers@vtk.org<br>
Subject: [vtkusers] Problem with displaying cross-hairs on 2D views<br>
        when using vtkImageResliceMapper -> vtkImageSlice -> vtkImageStack<br>
        pipeline<br>
Message-ID: <1545158446707-0.post@n5.nabble.com><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="http://vtk.1045678.n5.nabble.com/file/t341857/BasicPipeline.cxx">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="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html">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?=" <523480317@qq.com><br>
To: "=?ISO-8859-1?B?dnRrdXNlcnM=?=" <vtkusers@public.kitware.com><br>
Subject: [vtkusers] The SetRate() function of vtkFFMPEGWriter is not<br>
        working<br>
Message-ID: <tencent_C1E9E5F99AB683BA70FF9EF4DCFA1923C109@qq.com><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://public.kitware.com/pipermail/vtkusers/attachments/20181219/8caa3726/attachment-0001.html">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: 64066463@168E0131.E98F195C.png.jpg<br>
Type: image/jpeg<br>
Size: 5053 bytes<br>
Desc: not available<br>
URL: <<a href="https://public.kitware.com/pipermail/vtkusers/attachments/20181219/8caa3726/attachment-0001.jpg">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://public.kitware.com/pipermail/vtkusers/attachments/20181219/8caa3726/attachment-0003.obj">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://public.kitware.com/pipermail/vtkusers/attachments/20181219/8caa3726/attachment-0004.obj">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://public.kitware.com/pipermail/vtkusers/attachments/20181219/8caa3726/attachment-0005.obj">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 <Andx_roo@live.com><br>
To: vtkusers@vtk.org<br>
Subject: Re: [vtkusers] Visualizing normal vectors<br>
Message-ID: <1545183424782-0.post@n5.nabble.com><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="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html">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 <lasso@queensu.ca><br>
To: ochampao <ochampao@hotmail.com>, "vtkusers@vtk.org"<br>
        <vtkusers@vtk.org><br>
Subject: Re: [vtkusers] Problem with displaying cross-hairs on 2D<br>
        views when using vtkImageResliceMapper -> vtkImageSlice -><br>
        vtkImageStack pipeline<br>
Message-ID:<br>
        <YTXPR0101MB1870ABE4ABBF6595CEEDB4FDD8BE0@YTXPR0101MB1870.CANPRD01.PROD.OUTLOOK.COM><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 <vtkusers-bounces@public.kitware.com> On Behalf Of ochampao<br>
Sent: Tuesday, December 18, 2018 1:41 PM<br>
To: vtkusers@vtk.org<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&amp;data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&amp;sdata=nT57nY7HqbSgYg8flXNrjvfhqXVDbvDHbyEOMCVE3V0%3D&amp;reserved=0">https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2Ffile%2Ft341857%2FBasicPipeline.cxx&amp;data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&amp;sdata=nT57nY7HqbSgYg8flXNrjvfhqXVDbvDHbyEOMCVE3V0%3D&amp;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&amp;data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&amp;sdata=y%2FPL7RWRxL9djen9OHHFpV8mML1l8tDDID8vwEPDzr4%3D&amp;reserved=0">
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2FVTK-Users-f1224199.html&amp;data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&amp;sdata=y%2FPL7RWRxL9djen9OHHFpV8mML1l8tDDID8vwEPDzr4%3D&amp;reserved=0</a><br>
_______________________________________________<br>
Powered by <a href="https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&amp;data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&amp;sdata=a5wXXUd01fJsRRfeOlVc%2Bk6JcNbeRrCaawzEeOBEpIQ%3D&amp;reserved=0">
https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&amp;data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&amp;sdata=a5wXXUd01fJsRRfeOlVc%2Bk6JcNbeRrCaawzEeOBEpIQ%3D&amp;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&amp;data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&amp;sdata=GTPQfYrm85nLVvMYqtzwxYrfNS%2BHK2U5E%2F8%2FXjTuyGQ%3D&amp;reserved=0">
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&amp;data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&amp;sdata=GTPQfYrm85nLVvMYqtzwxYrfNS%2BHK2U5E%2F8%2FXjTuyGQ%3D&amp;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&amp;data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&amp;sdata=3OkV0h9SM82LHRbPbSKbfXkZuLWSqAjPyULJuBV%2FrGQ%3D&amp;reserved=0">
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&amp;data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&amp;sdata=3OkV0h9SM82LHRbPbSKbfXkZuLWSqAjPyULJuBV%2FrGQ%3D&amp;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&amp;data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&amp;sdata=ydyX30Af9G0j8PwVigfaCkucOiFqv0SdNKwyi7vx56Y%3D&amp;reserved=0">
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&amp;data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&amp;sdata=ydyX30Af9G0j8PwVigfaCkucOiFqv0SdNKwyi7vx56Y%3D&amp;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&amp;data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&amp;sdata=zYNgte5262YQQDT42ydJgSd1qTiDwQBW4DeWwgOlCzE%3D&amp;reserved=0">https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&amp;data=02%7C01%7Classo%40queensu.ca%7C80118413b7ba4ceb15d108d665185599%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C1%7C636807552523602151&amp;sdata=zYNgte5262YQQDT42ydJgSd1qTiDwQBW4DeWwgOlCzE%3D&amp;reserved=0</a><br>
<br>
<br>
------------------------------<br>
<br>
Message: 5<br>
Date: Wed, 19 Dec 2018 01:24:28 -0700 (MST)<br>
From: mozendi <mozendi@gmail.com><br>
To: vtkusers@vtk.org<br>
Subject: Re: [vtkusers] Visualizing normal vectors<br>
Message-ID: <1545207868212-0.post@n5.nabble.com><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="http://vtk.1045678.n5.nabble.com/file/t341822/vtk_error_message.png">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="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html">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 <Andx_roo@live.com><br>
To: vtkusers@vtk.org<br>
Subject: Re: [vtkusers] Visualizing normal vectors<br>
Message-ID: <1545211583462-0.post@n5.nabble.com><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="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html">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="http://www.kitware.com">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://public.kitware.com/mailman/listinfo/vtkusers">https://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br>
<br>
------------------------------<br>
<br>
End of vtkusers Digest, Vol 176, Issue 22<br>
*****************************************<br>
</div>
</span></font></div>
</body>
</html>