<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif; ">
<div>
<div>
<div>Sam,</div>
</div>
</div>
<div><br>
</div>
<div>I haven't bothered to try to compile your example code, but it looks right. The only issue is that the image viewer is going to expect a 2D image and will probably fail if the output from the NRRD reader is 3D. If you use SetDataVOI to extract a single
slice (set the last two extent numbers to be the same), then that should work.</div>
<div><br>
</div>
<div>-Ken</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Sam Raby <<a href="mailto:rabysam28@gmail.com">rabysam28@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Thursday, January 16, 2014 9:16 PM<br>
<span style="font-weight:bold">To: </span>Kenneth Moreland <<a href="mailto:kmorel@sandia.gov">kmorel@sandia.gov</a>><br>
<span style="font-weight:bold">Cc: </span>"<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>" <<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>><br>
<span style="font-weight:bold">Subject: </span>[EXTERNAL] Re: [vtkusers] Reading nrrd files<br>
</div>
<div><br>
</div>
<div>
<div>
<div dir="ltr"><span style="font-family: arial, sans-serif; font-size: 12.800000190734863px; ">Thanks Ken for the reply.</span>
<div style="font-family:arial,sans-serif;font-size:12.800000190734863px">In general, I wanted to know what the typical way of reading a NRRD file is. I thought I should use vtkNrrdReader, but I could not figure it out.</div>
<div style="font-family:arial,sans-serif;font-size:12.800000190734863px"><br>
</div>
<div style="font-family:arial,sans-serif;font-size:12.800000190734863px">Thanks</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Tue, Jan 14, 2014 at 9:42 PM, Moreland, Kenneth <span dir="ltr">
<<a href="mailto:kmorel@sandia.gov" target="_blank">kmorel@sandia.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="font-size:14px;font-family:Calibri,sans-serif;word-wrap:break-word">
<div>
<div>
<div>Have you tried calling SetDataVOI on the vtkNrrdReader? I don't think it works on ASCII files, but it should work on raw binary encoding.</div>
</div>
</div>
<div><br>
</div>
<div>-Ken </div>
<div><br>
</div>
<span>
<div style="border-right:medium none;padding-right:0in;padding-left:0in;padding-top:3pt;text-align:left;font-size:11pt;border-bottom:medium none;font-family:Calibri;border-top:#b5c4df 1pt solid;padding-bottom:0in;border-left:medium none">
<span style="font-weight:bold">From: </span>Sam Raby <<a href="mailto:rabysam28@gmail.com" target="_blank">rabysam28@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Tuesday, January 14, 2014 1:51 PM<br>
<span style="font-weight:bold">To: </span>"<a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a>" <<a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a>><br>
<span style="font-weight:bold">Subject: </span>[EXTERNAL] [vtkusers] Reading nrrd files<br>
</div>
<div>
<div class="h5">
<div><br>
</div>
<blockquote style="BORDER-LEFT:#b5c4df 5 solid;PADDING:0 0 0 5;MARGIN:0 0 0 5">
<div>
<div>
<div dir="ltr">Hello
<div><br>
</div>
<div>I would like to read a nrrd file and be able to scroll through slices. Is there an example online that can help on how to use vtknrrdreader in order to do that?
<div><br>
</div>
<div>The following is what I have written so far.</div>
<div><br>
</div>
<div>Thanks</div>
<div>Sam</div>
</div>
<div><br>
</div>
<div>
<div><br>
</div>
<div>vtkSmartPointer<vtkNrrdReader> reader = vtkSmartPointer<vtkNrrdReader>::New();</div>
<div>reader->SetFileName(argv[1]);</div>
<div><br>
</div>
<div>vtkSmartPointer<vtkImageViewer2> imageViewer = vtkSmartPointer<vtkImageViewer2>::New();</div>
<div>imageViewer->SetInputConnection(reader->GetOutputPort());</div>
<div><br>
</div>
<div>vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();</div>
<div><br>
</div>
<div>imageViewer->SetupInteractor(renderWindowInteractor);</div>
<div>imageViewer->Render();</div>
<div>imageViewer->GetRenderer()->ResetCamera();</div>
<div>imageViewer->Render();</div>
<div><br>
</div>
<div>renderWindowInteractor->Start();<br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</span></div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</span>
</body>
</html>