<div dir="ltr">Hi,<div> I have an example (<a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/CurvedReformation">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/CurvedReformation</a> ), and i am modifying this example, i am trying to find the point data on the data, i have modified this code, in that way which i am showing, but i am getting some unexpected pointdata values which are nearly zero and which is not possible. could you please suggest me some solution regarding this?</div>
<div><br></div><div><div>static vtkSmartPointer<vtkPolyData> SweepLine (vtkPolyData *line,</div><div> double direction[3],</div><div> double distance,</div>
<div> unsigned int cols);</div><div>int main (int argc, char *argv[])</div><div>{</div><div> // Verify arguments</div><div> if (argc < 4)</div><div> {</div><div> std::cout << "Usage: " << argv[0]</div>
<div> << " InputVolume PolyDataInput"</div><div> << " Resolution"</div><div> << std::endl;</div><div> return EXIT_FAILURE;</div><div>
}</div><div><br></div><div> // Parse arguments</div><div> std::string volumeFileName = argv[1];</div><div> std::string polyDataFileName = argv[2];</div><div> std::stringstream ssResolution;</div><div> ssResolution << argv[3];</div>
<div> unsigned int resolution;</div><div> ssResolution >> resolution;</div><div><br></div><div> // Output arguments</div><div> std::cout << "InputVolume: " << volumeFileName << std::endl</div>
<div> << "PolyDataInput: " << polyDataFileName << std::endl</div><div> << "Resolution: " << resolution << std::endl;</div><div><br></div><div> // Read the volume data</div>
<div> vtkSmartPointer< vtkImageReader2Factory > imageFactory =</div><div> vtkSmartPointer< vtkImageReader2Factory >::New();</div><div> vtkImageReader2 *imageReader =</div><div> imageFactory->CreateImageReader2(volumeFileName.c_str());</div>
<div> imageReader->SetFileName(volumeFileName.c_str());</div><div> imageReader->Update();</div><div><br></div><div> // Read the Polyline</div><div> vtkSmartPointer<vtkPolyDataReader> polyLineReader =</div>
<div> vtkSmartPointer<vtkPolyDataReader>::New();</div><div> polyLineReader->SetFileName(polyDataFileName.c_str());</div><div> polyLineReader->Update();</div><div><br></div><div> vtkSmartPointer<vtkSplineFilter> spline =</div>
<div> vtkSmartPointer<vtkSplineFilter>::New();</div><div> spline->SetInputConnection(polyLineReader->GetOutputPort());</div><div> spline->SetSubdivideToSpecified();</div><div> spline->SetNumberOfSubdivisions(resolution);</div>
<div><br></div><div> // Sweep the line to form a surface</div><div> double direction[3];</div><div> direction[0] = 0.0;</div><div> direction[1] = 0.0;</div><div> direction[2] = 1.0;</div><div> double distance = 164;</div>
<div> spline->Update();</div><div> vtkSmartPointer<vtkPolyData> surface =</div><div> SweepLine(spline->GetOutput(),</div><div> direction,</div><div> distance,</div><div> atoi(argv[3]));</div>
<div><br></div><div> // Probe the volume with the extruded surface</div><div> vtkSmartPointer<vtkProbeFilter> sampleVolume =</div><div> vtkSmartPointer<vtkProbeFilter>::New();</div><div> sampleVolume->SetInputConnection(1, imageReader->GetOutputPort());</div>
<div>#if VTK_MAJOR_VERSION <= 5</div><div> sampleVolume->SetInput(0, surface);</div><div> #else</div><div> sampleVolume->SetInputData(0, surface);</div><div>#endif</div><div> // Compute a simple window/level based on scalar range</div>
<div> vtkSmartPointer<vtkWindowLevelLookupTable> wlLut =</div><div> vtkSmartPointer<vtkWindowLevelLookupTable>::New();</div><div> double range = imageReader->GetOutput()->GetScalarRange()[1] -</div>
<div> imageReader->GetOutput()->GetScalarRange()[0];</div><div> double level = (imageReader->GetOutput()->GetScalarRange()[1] +</div><div> imageReader->GetOutput()->GetScalarRange()[0]) / 2.0;</div>
<div> wlLut->SetWindow(range);</div><div> wlLut->SetLevel(level);</div><div> sampleVolume->Update();</div></div><div><br></div><div><br></div><div><b><font color="#990000">// From Here i have done modification in my code.</font></b></div>
<div><br></div><div><div>// To find out the Pointdata of a surface</div><div><br></div><div> // Extract the polydata</div><div> vtkSmartPointer<vtkPolyData> polydata = </div><div><span class="" style="white-space:pre">        </span>vtkSmartPointer<vtkPolyData> :: New();</div>
<div> polydata = vtkPolyData::SafeDownCast(sampleVolume->GetOutput());</div><div><br></div><div> // Get the number of points in the polydata</div><div> vtkIdType idNumPointsInFile = polydata->GetNumberOfPoints();</div>
<div><br></div><div> vtkSmartPointer<vtkDoubleArray> array = vtkSmartPointer<vtkDoubleArray> :: New();</div><div> // array->SetName("Double");</div><div> array->SetNumberOfTuples(idNumPointsInFile);</div>
<div><br></div><div> polydata->GetPointData()->AddArray(array);</div><div><br></div><div> // array = vtkDoubleArray::SafeDownCast(polydata->GetPointData()->GetArray("Double"));</div><div><span class="" style="white-space:pre">        </span></div>
<div> if(array)</div><div> {</div><div> for(int i = 0; i < idNumPointsInFile; i++) </div><div> {</div><div> std::cout << "Got array.= " << i << std::endl;</div><div> double dist;</div>
<div> dist = array->GetValue(i);</div><div> </div><div> // if the array held arrays instead of scalars, you would use this:<span class="" style="white-space:pre">                </span> </div><div> // double location[3];</div>
<div> // array->GetTupleValue(i, location);</div><div> // std::cout << "Location: " << Location[0] << "," << Location[1] << "," << Location[2] << std::endl;</div>
<div> </div><div> std::cout << "Distance: " << dist << std::endl;</div><div> }</div><div> } //end if(array)</div><div> else</div><div> {</div><div> std::cout << "no array." << std::endl;</div>
<div> }</div><div><br></div><div> system("PAUSE");</div><div><br></div><div> return EXIT_SUCCESS;</div></div><div><br></div><div>}</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div>
<div><br></div><div><br></div><div><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jul 21, 2013 at 6:00 PM, <span dir="ltr"><<a href="mailto:vtkusers-request@vtk.org" target="_blank">vtkusers-request@vtk.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Send vtkusers mailing list submissions to<br>
<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:vtkusers-request@vtk.org">vtkusers-request@vtk.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:vtkusers-owner@vtk.org">vtkusers-owner@vtk.org</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. Cocoa build instructions a little out of date (David Clunie)<br>
2. Some tests fail compiling 5.10.0 on MacOS Cocoa (David Clunie)<br>
3. Missing tag for release 5.9.0 in github? (David Clunie)<br>
4. Re: Missing tag for release 5.9.0 in github? (David Gobbi)<br>
5. Problem in Read Dicom Series (Vachik Dave)<br>
6. Re: Problem in Read Dicom Series (Marco Sambin)<br>
7. Re: Problem in Read Dicom Series (David Gobbi)<br>
8. Re: mapping floating image to color image using<br>
vtkImageMapToColors (Richard Frank)<br>
9. Re: Problem in Read Dicom Series (Vachik Dave)<br>
10. Re: Problem in Read Dicom Series (Marco Sambin)<br>
11. smapersmaper (max perlman)<br>
12. Agata Krason (Agata Kraso?)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Sat, 20 Jul 2013 13:09:14 -0400<br>
From: David Clunie <<a href="mailto:dclunie@dclunie.com">dclunie@dclunie.com</a>><br>
Subject: [vtkusers] Cocoa build instructions a little out of date<br>
To: "<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>" <<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>><br>
Message-ID: <<a href="mailto:51EAC43A.1090808@dclunie.com">51EAC43A.1090808@dclunie.com</a>><br>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br>
<br>
The instructions at "<a href="http://www.vtk.org/Wiki/Cocoa_VTK" target="_blank">http://www.vtk.org/Wiki/Cocoa_VTK</a>" are helpful,<br>
but a little dated.<br>
<br>
For more recent MacOS/Xcode versions, for "CMAKE_OSX_SYSROOT:STRING",<br>
the SDKs no longer live in "/Developer", but rather inside the XCode<br>
package.<br>
<br>
E.g., to target 10.7 one needs<br>
<br>
<br>
"CMAKE_OSX_SYSROOT:STRING=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"<br>
<br>
Also, a "~" will not work in the "CMAKE_INSTALL_PREFIX:PATH"<br>
<br>
also, "CMAKE_CXX_FLAGS:STRING=-Wno-deprecated", helps clear things<br>
up, since otherwise the MacOs headers generate a lot of warnings.<br>
<br>
David<br>
<br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Sat, 20 Jul 2013 13:05:18 -0400<br>
From: David Clunie <<a href="mailto:dclunie@dclunie.com">dclunie@dclunie.com</a>><br>
Subject: [vtkusers] Some tests fail compiling 5.10.0 on MacOS Cocoa<br>
To: "<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>" <<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>><br>
Message-ID: <<a href="mailto:51EAC34E.6040505@dclunie.com">51EAC34E.6040505@dclunie.com</a>><br>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br>
<br>
Hi<br>
<br>
"make test" after compiling for Cocoa on MacOS 10.8.4 for target 10.7<br>
with Xcode 4.6.2 with architectures "i386;x86_64" had a few failures:<br>
<br>
98% tests passed, 5 tests failed out of 299<br>
<br>
The following tests FAILED:<br>
85 - CellLocator (Failed)<br>
213 - TestAffineWidget (Failed)<br>
214 - TestButtonWidget (SEGFAULT)<br>
216 - TestLogoWidget (Failed)<br>
218 - TestPolyPlane (OTHER_FAULT)<br>
<br>
David<br>
<br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Sat, 20 Jul 2013 13:02:13 -0400<br>
From: David Clunie <<a href="mailto:dclunie@dclunie.com">dclunie@dclunie.com</a>><br>
Subject: [vtkusers] Missing tag for release 5.9.0 in github?<br>
To: "<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>" <<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>><br>
Message-ID: <<a href="mailto:51EAC295.4090704@dclunie.com">51EAC295.4090704@dclunie.com</a>><br>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br>
<br>
I wanted to compile VTK for Osirix 5.6, and they seem to use 5.9.0,<br>
but if I look in github there seems to be no such tag.<br>
<br>
There is 5.8.0 and 5.10.0 and some v5.10.0 release candidates, but<br>
no 5.9.0.<br>
<br>
David<br>
<br>
<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Sat, 20 Jul 2013 11:44:36 -0600<br>
From: David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br>
Subject: Re: [vtkusers] Missing tag for release 5.9.0 in github?<br>
To: David Clunie <<a href="mailto:dclunie@dclunie.com">dclunie@dclunie.com</a>><br>
Cc: "<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>" <<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>><br>
Message-ID:<br>
<CANwS1=<a href="mailto:GbH-n4GC50bB8HTc0xU1LEbyMwumxwQ-d6rV5bYJp9cQ@mail.gmail.com">GbH-n4GC50bB8HTc0xU1LEbyMwumxwQ-d6rV5bYJp9cQ@mail.gmail.com</a>><br>
Content-Type: text/plain; charset=ISO-8859-1<br>
<br>
Hi David,<br>
<br>
Welcome to the VTK mailing list.<br>
<br>
Odd minor version numbers in VTK 4 and 5 were used to indicate the cvs<br>
development branch (similar to the way Linux only used even numbers<br>
for releases). So VTK 5.9 was the development branch that evolved<br>
into the VTK 5.10 release. The best release for you to use is<br>
probably the VTK 5.10.1 release.<br>
<br>
- David<br>
<br>
On Sat, Jul 20, 2013 at 11:02 AM, David Clunie <<a href="mailto:dclunie@dclunie.com">dclunie@dclunie.com</a>> wrote:<br>
> I wanted to compile VTK for Osirix 5.6, and they seem to use 5.9.0,<br>
> but if I look in github there seems to be no such tag.<br>
><br>
> There is 5.8.0 and 5.10.0 and some v5.10.0 release candidates, but<br>
> no 5.9.0.<br>
><br>
> David<br>
<br>
<br>
------------------------------<br>
<br>
Message: 5<br>
Date: Sat, 20 Jul 2013 14:59:07 -0400<br>
From: Vachik Dave <<a href="mailto:vsdave@umail.iu.edu">vsdave@umail.iu.edu</a>><br>
Subject: [vtkusers] Problem in Read Dicom Series<br>
To: <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
Message-ID:<br>
<CADB4r1=<a href="mailto:3qVTdg7mcG73s6nC27A8uit2pmrAVU3fKhBcMEE184g@mail.gmail.com">3qVTdg7mcG73s6nC27A8uit2pmrAVU3fKhBcMEE184g@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
I need to read 99 image slices of .tif format. but I found this option with<br>
dicom files.<br>
So I converted my .tif files into .dcm file using Matlab.<br>
<br>
I am using example available at<br>
<a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadDICOMSeries" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadDICOMSeries</a><br>
Now my problem is that the same project working for other Dicom folder is<br>
not working for my Matlab generated files.<br>
It shows only one slice as a result.<br>
<br>
Any clue, what is wrong and how can I make it work?<br>
<br>
<br>
Thanks in advance.<br>
*<br>
--Vachik<br>
*<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://www.vtk.org/pipermail/vtkusers/attachments/20130720/ea6389bd/attachment-0001.htm" target="_blank">http://www.vtk.org/pipermail/vtkusers/attachments/20130720/ea6389bd/attachment-0001.htm</a>><br>
<br>
------------------------------<br>
<br>
Message: 6<br>
Date: Sat, 20 Jul 2013 21:09:25 +0200<br>
From: Marco Sambin <<a href="mailto:m.sambin@gmail.com">m.sambin@gmail.com</a>><br>
Subject: Re: [vtkusers] Problem in Read Dicom Series<br>
To: <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
Message-ID:<br>
<CAFoCWhtSLmg1582H=mp62mDEvmxMC=<a href="mailto:nU776kUMVjy568k1YzFg@mail.gmail.com">nU776kUMVjy568k1YzFg@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Hi Vachik,<br>
<br>
well, I'm not sure how you converted TIF to DICOM, but I guess you<br>
generated Secondary Capture DICOM files which do not contain Image<br>
Position, Image Orientation and Pixel Spacing data elements (since this<br>
info is absent in your source TIF image files).<br>
<br>
Hence, the reader cannot generate a correct volume without knowing those<br>
data.<br>
<br>
Best regards,<br>
<br>
Marco<br>
Il giorno 20/lug/2013 20:59, "Vachik Dave" <<a href="mailto:vsdave@umail.iu.edu">vsdave@umail.iu.edu</a>> ha scritto:<br>
<br>
> I need to read 99 image slices of .tif format. but I found this option<br>
> with dicom files.<br>
> So I converted my .tif files into .dcm file using Matlab.<br>
><br>
> I am using example available at<br>
> <a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadDICOMSeries" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadDICOMSeries</a><br>
> Now my problem is that the same project working for other Dicom folder is<br>
> not working for my Matlab generated files.<br>
> It shows only one slice as a result.<br>
><br>
> Any clue, what is wrong and how can I make it work?<br>
><br>
><br>
> Thanks in advance.<br>
> *<br>
> --Vachik<br>
> *<br>
><br>
> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://www.vtk.org/pipermail/vtkusers/attachments/20130720/f53a5124/attachment-0001.htm" target="_blank">http://www.vtk.org/pipermail/vtkusers/attachments/20130720/f53a5124/attachment-0001.htm</a>><br>
<br>
------------------------------<br>
<br>
Message: 7<br>
Date: Sat, 20 Jul 2013 13:18:54 -0600<br>
From: David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br>
Subject: Re: [vtkusers] Problem in Read Dicom Series<br>
To: VTK Users <<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>><br>
Message-ID:<br>
<CANwS1=<a href="mailto:Hy6236vneOgKEwZch8tBNSFDr92wtfMtAGBngUTj-95g@mail.gmail.com">Hy6236vneOgKEwZch8tBNSFDr92wtfMtAGBngUTj-95g@mail.gmail.com</a>><br>
Content-Type: text/plain; charset=ISO-8859-1<br>
<br>
VTK has a TIF reader (vtkTIFFReader). Why not just use that?<br>
<br>
On Sat, Jul 20, 2013 at 1:09 PM, Marco Sambin <<a href="mailto:m.sambin@gmail.com">m.sambin@gmail.com</a>> wrote:<br>
> Hi Vachik,<br>
><br>
> well, I'm not sure how you converted TIF to DICOM, but I guess you generated<br>
> Secondary Capture DICOM files which do not contain Image Position, Image<br>
> Orientation and Pixel Spacing data elements (since this info is absent in<br>
> your source TIF image files).<br>
><br>
> Hence, the reader cannot generate a correct volume without knowing those<br>
> data.<br>
><br>
> Best regards,<br>
><br>
> Marco<br>
><br>
> Il giorno 20/lug/2013 20:59, "Vachik Dave" <<a href="mailto:vsdave@umail.iu.edu">vsdave@umail.iu.edu</a>> ha scritto:<br>
>><br>
>> I need to read 99 image slices of .tif format. but I found this option<br>
>> with dicom files.<br>
>> So I converted my .tif files into .dcm file using Matlab.<br>
>><br>
>> I am using example available at<br>
>> <a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadDICOMSeries" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadDICOMSeries</a><br>
>> Now my problem is that the same project working for other Dicom folder is<br>
>> not working for my Matlab generated files.<br>
>> It shows only one slice as a result.<br>
>><br>
>> Any clue, what is wrong and how can I make it work?<br>
>><br>
>><br>
>> Thanks in advance.<br>
>><br>
>> --Vachik<br>
<br>
<br>
------------------------------<br>
<br>
Message: 8<br>
Date: Sat, 20 Jul 2013 19:23:04 +0000 (GMT)<br>
From: Richard Frank <<a href="mailto:rickfrank@me.com">rickfrank@me.com</a>><br>
Subject: Re: [vtkusers] mapping floating image to color image using<br>
vtkImageMapToColors<br>
To: Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>><br>
Cc: VTK Users <<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>><br>
Message-ID: <<a href="mailto:8b155350-acde-462e-b085-40145fc954fa@me.com">8b155350-acde-462e-b085-40145fc954fa@me.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"<br>
<br>
Hi Bill,<br>
<br>
The code below will illustrate the issue.<br>
<br>
If you enable the color mapping code, by setting the #if 0 to #if 1, you will find that the color is a washed out white.<br>
<br>
My desire is to have a ramp on a single hue, based on gray levels.<br>
<br>
My data is typically from 0 - 0.69 which is what I set it to. The actual range is 0.0 ?- 1.0. but it pretty much never gets above<br>
0.69.<br>
<br>
I think the problem is perhaps not understanding the setup of the color table,,,but I'm unclear on how I should set it up other than<br>
what I have.<br>
<br>
The callback was used to interactively change the color table, but it wasn't helpful.<br>
<br>
This is on Windows 7, using Visual Studio, and VTK 5.10.1<br>
<br>
Thanks<br>
<br>
Rick<br>
<br>
----------------CODE---------------------------------------------------<br>
<br>
#include <vtkRenderer.h><br>
#include <vtkRenderWindow.h><br>
#include <vtkRenderWindowInteractor.h><br>
#include <vtkFloatArray.h><br>
#include <vtkImageMapper.h><br>
#include <vtkImageData.h><br>
#include <vtkPointData.h><br>
#include <vtkActor2D.h><br>
#include <vtkImageMapToColors.h><br>
#include <vtkLookupTable.h><br>
#include <vtkMinimalStandardRandomSequence.h><br>
#include <vtkInteractorStyle.h><br>
#include "vtkInteractorStyleImage.h"<br>
#include <vtkCommand.h><br>
<br>
#include <vtkSmartPointer.h><br>
<br>
<br>
<br>
class vtkImageInteractionCallback : public vtkCommand<br>
{<br>
public:<br>
<br>
? ? static vtkImageInteractionCallback *New()?<br>
? ? {<br>
? ? ? ? return new vtkImageInteractionCallback;<br>
? ? };<br>
<br>
? ? vtkImageInteractionCallback()?<br>
? ? {<br>
<br>
? ? ? ? this->Interactor = 0;<br>
? ? };<br>
<br>
? ? void SetInteractor(vtkRenderWindowInteractor *interactor)?<br>
? ? {<br>
? ? ? ? this->Interactor = interactor;?<br>
? ? };<br>
? ? vtkRenderWindowInteractor *GetInteractor()?<br>
? ? {<br>
? ? ? ? return this->Interactor;<br>
? ? };<br>
<br>
? ? void SetColorTable(vtkLookupTable* colorTable)<br>
? ? {<br>
? ? ? ? ColorTable = colorTable;<br>
? ? }<br>
? ? virtual void Execute(vtkObject *, unsigned long event, void *)<br>
? ? {<br>
? ? ? ? vtkRenderWindowInteractor *interactor = this->GetInteractor();<br>
<br>
? ? ? ?<br>
? ? ? ? int currPos[2];<br>
? ? ? ? interactor->GetEventPosition(currPos);<br>
<br>
? ? ? ? if (event == vtkCommand::LeftButtonPressEvent)<br>
? ? ? ? {<br>
? ? ? ? ? ? ?clickPos[0] = currPos[0];<br>
? ? ? ? ? ? ?clickPos[1] = currPos[1];<br>
<br>
? ? ? ? }<br>
? ? ? ? else if (event == vtkCommand::LeftButtonReleaseEvent)<br>
? ? ? ? {<br>
<br>
? ? ? ? }<br>
<br>
? ? ? ? else if (event == vtkCommand::MouseWheelForwardEvent)<br>
? ? ? ? {<br>
? ? ? ? ? ?<br>
? ? ? ? }<br>
? ? ? ? else if (event == vtkCommand::MouseWheelBackwardEvent)<br>
? ? ? ? {<br>
? ? ? ? ? ?<br>
? ? ? ? ? ??<br>
? ? ? ? }<br>
<br>
? ? ? ? else if (event == vtkCommand::MouseMoveEvent)<br>
? ? ? ? {<br>
<br>
? ? ? ? }<br>
? ? ? ? else<br>
? ? ? ? {<br>
? ? ? ? ? ? vtkInteractorStyle *style = vtkInteractorStyle::SafeDownCast(<br>
? ? ? ? ? ? ? ? interactor->GetInteractorStyle());<br>
? ? ? ? ? ? if (style)<br>
? ? ? ? ? ? {<br>
? ? ? ? ? ? ? ? style->OnMouseMove();<br>
? ? ? ? ? ? }<br>
? ? ? ? }<br>
? ? }<br>
<br>
? ? vtkRenderWindowInteractor *Interactor;<br>
? ? vtkLookupTable * ColorTable;<br>
? ? int clickPos[2];<br>
};<br>
<br>
<br>
<br>
int main (int argc, char *argv[])<br>
{<br>
<br>
<br>
? ? vtkSmartPointer<vtkRenderer> aRenderer =<br>
? ? ? ? vtkSmartPointer<vtkRenderer>::New();<br>
? ? vtkSmartPointer<vtkRenderWindow> renWin =<br>
? ? ? ? vtkSmartPointer<vtkRenderWindow>::New();<br>
? ? renWin->AddRenderer(aRenderer);<br>
<br>
? ? vtkSmartPointer<vtkRenderWindowInteractor> iren =<br>
? ? ? ? vtkSmartPointer<vtkRenderWindowInteractor>::New();<br>
? ? iren->SetRenderWindow(renWin);<br>
<br>
<br>
<br>
? ? vtkSmartPointer<vtkFloatArray> floatData = vtkSmartPointer<vtkFloatArray>::New();<br>
<br>
? ? vtkIdType width = 500;<br>
? ? vtkIdType height = 500;<br>
<br>
<br>
<br>
? ? vtkIdType nt = width * height;<br>
? ? floatData->SetNumberOfTuples(nt);<br>
? ? vtkSmartPointer<vtkMinimalStandardRandomSequence> rg = vtkSmartPointer<vtkMinimalStandardRandomSequence>::New();<br>
<br>
? ? for(vtkIdType i = 0; i < nt; i++)<br>
? ? {<br>
? ? ? ? float rn = rg->GetRangeValue(0,0.69);<br>
? ? ? ? rg->Next();<br>
? ? ? ?<br>
? ? ? ? floatData->SetTuple(i,&rn);<br>
? ? }<br>
<br>
? ? vtkSmartPointer<vtkImageData> image = vtkSmartPointer<vtkImageData>::New();<br>
? ? image->SetExtent(0,width-1,0,height-1,0,0);<br>
? ? image->SetNumberOfScalarComponents(1);<br>
? ? image->SetScalarTypeToFloat();<br>
? ? image->SetSpacing(0.1,0.1,1.0);<br>
<br>
? ? image->GetPointData()->SetScalars(floatData);<br>
<br>
? ? vtkSmartPointer<vtkImageMapper> mapper = ?vtkSmartPointer<vtkImageMapper>::New();<br>
<br>
? ? mapper->SetInputConnection(image->GetProducerPort());<br>
? ? mapper->SetColorWindow(1.0);<br>
? ? mapper->SetColorLevel(0.5);<br>
<br>
? ? vtkSmartPointer<vtkActor2D> actor = vtkSmartPointer<vtkActor2D>::New();<br>
? ? actor->SetPosition(0,0);<br>
<br>
? ? actor->SetMapper(mapper);<br>
<br>
? ? aRenderer->AddActor(actor);<br>
<br>
? ? // turn this on to map to colors.<br>
#if 0<br>
? ? vtkSmartPointer<vtkImageInteractionCallback> callback = vtkSmartPointer<vtkImageInteractionCallback>::New();<br>
? ? vtkSmartPointer<vtkInteractorStyleImage> imageStyle = vtkSmartPointer<vtkInteractorStyleImage>::New();<br>
? ??<br>
? ? iren->SetInteractorStyle(imageStyle);<br>
? ? callback->SetInteractor(iren);<br>
? ? renWin->SetInteractor(iren);<br>
? ? imageStyle->AddObserver(vtkCommand::MouseMoveEvent, callback);<br>
? ? imageStyle->AddObserver(vtkCommand::LeftButtonPressEvent, callback);<br>
? ? imageStyle->AddObserver(vtkCommand::LeftButtonReleaseEvent, callback);<br>
? ? ?imageStyle->AddObserver(vtkCommand::MouseWheelForwardEvent, callback);<br>
<br>
? ? imageStyle->AddObserver(vtkCommand::MouseWheelBackwardEvent, callback);<br>
? ? vtkSmartPointer<vtkImageMapToColors> filter = vtkSmartPointer<vtkImageMapToColors>::New();<br>
? ? vtkSmartPointer<vtkLookupTable> colorTable = vtkSmartPointer<vtkLookupTable>::New();<br>
? ? callback->SetColorTable(colorTable);<br>
? ? filter->SetOutputFormatToRGBA();<br>
? ? colorTable->SetTableRange(0,1);?<br>
<br>
<br>
? ? colorTable->SetHueRange(0.3,0.3);<br>
? ? colorTable->SetSaturationRange(0,1);<br>
? ? colorTable->SetValueRange(1,1);<br>
? ? colorTable->SetRampToLinear();<br>
? ? colorTable->ForceBuild();<br>
? ? filter->SetLookupTable(colorTable);<br>
? ? filter->SetNumberOfThreads(1);<br>
<br>
? ? filter->SetInputConnection(image->GetProducerPort());<br>
? ? mapper->SetInputConnection(filter->GetOutputPort());<br>
#endif<br>
<br>
<br>
? ? aRenderer->SetBackground(.2, .3, .4);<br>
? ? renWin->SetSize(640, 480);<br>
<br>
<br>
<br>
? ? // Initialize the event loop and then start it.<br>
? ? iren->Initialize();<br>
? ? iren->Start();<br>
<br>
? ? return EXIT_SUCCESS;<br>
}<br>
<br>
<br>
On Jul 19, 2013, at 09:32 PM, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>> wrote:<br>
<br>
Can you post a small, compilable example that illustrates the problem?<br>
<br>
<br>
<br>
On Fri, Jul 19, 2013 at 9:20 PM, Rick Frank <<a href="mailto:rickfrank@me.com">rickfrank@me.com</a>> wrote:<br>
<br>
Hi,<br>
<br>
I'm getting some behavior I don't understand when trying to map gray floating point image to a color image<br>
<br>
What I'm seeing is that the output is completely white.<br>
<br>
my code is roughly as follows<br>
<br>
filter->SetOutputFormatToRGBA()<br>
<br>
colorTable->SetTableRange(0,1)<br>
colorTable->SetHueRange(0,1);<br>
colorTable->SetSaturationRange(0,1);<br>
colorTable->SetValueRange(0,1);<br>
colorTable->SetRampToLinear();<br>
<br>
colorTable->ForceBuild();<br>
<br>
Now, when I trace through the code, the values set in the RGBA image look correct. But the ultimate rendered image is completely white.<br>
<br>
If I modify the code so that all the RGBA values are 1,0,0,255 the image is solid red. If I change the alpha to 64 nothing changes.<br>
<br>
So, I suspect it's the mapper - I use the same mapper - vtkImageMapper to display the color image by resetting the input connection:<br>
<br>
mapper->SetInputConnection(filter->GetOutputPort());<br>
imageActor->SetMapper(mapper);<br>
<br>
Do I need to make a change to the mapper to get the proper RGBA display?<br>
<br>
<br>
Thanks<br>
<br>
Rick<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">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" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br>
<br>
<br>
--<br>
Unpaid intern in BillsBasement at noware dot com<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://www.vtk.org/pipermail/vtkusers/attachments/20130720/c6f05073/attachment-0001.htm" target="_blank">http://www.vtk.org/pipermail/vtkusers/attachments/20130720/c6f05073/attachment-0001.htm</a>><br>
<br>
------------------------------<br>
<br>
Message: 9<br>
Date: Sat, 20 Jul 2013 15:54:48 -0400<br>
From: Vachik Dave <<a href="mailto:vsdave@umail.iu.edu">vsdave@umail.iu.edu</a>><br>
Subject: Re: [vtkusers] Problem in Read Dicom Series<br>
To: David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>>, <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
Message-ID:<br>
<CADB4r1kG67d7iq1xzYf3hzDE=<a href="mailto:CFzzxPNHWo6dCHQFdHfiFJYPQ@mail.gmail.com">CFzzxPNHWo6dCHQFdHfiFJYPQ@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Ohk, thank you very much for your help.<br>
<br>
<br>
Regards*.<br>
--Vachik Dave*<br>
<br>
<br>
On Sat, Jul 20, 2013 at 3:49 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>> wrote:<br>
<br>
> Hi Vachik,<br>
><br>
> Please don't email off-list. Keep the discussion on the mailing list<br>
> so that all users can benefit from it.<br>
><br>
> If you need to load multiple files, then use SetFileNames() to give<br>
> the tiff reader a list of filenames in a vtkStringArray. You can<br>
> either build the list of filenames in a for() loop, or you can use<br>
> vtkGlobFileNames to build the list with a wildcard like "*.tif".<br>
><br>
> - David<br>
><br>
> On Sat, Jul 20, 2013 at 1:21 PM, Vachik Dave <<a href="mailto:vsdave@umail.iu.edu">vsdave@umail.iu.edu</a>> wrote:<br>
> > Well, I need to read 99 slices and then pass that to Marching cube code<br>
> to<br>
> > generate 3D image.<br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://www.vtk.org/pipermail/vtkusers/attachments/20130720/2e3ce9e5/attachment-0001.htm" target="_blank">http://www.vtk.org/pipermail/vtkusers/attachments/20130720/2e3ce9e5/attachment-0001.htm</a>><br>
<br>
------------------------------<br>
<br>
Message: 10<br>
Date: Sun, 21 Jul 2013 00:19:02 +0200<br>
From: Marco Sambin <<a href="mailto:m.sambin@gmail.com">m.sambin@gmail.com</a>><br>
Subject: Re: [vtkusers] Problem in Read Dicom Series<br>
To: <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
Message-ID:<br>
<CAFoCWhun_EPNmDMOp-5DHp4zeqiq=<a href="mailto:e17J5kSJvcjrf-5Qwb2-Q@mail.gmail.com">e17J5kSJvcjrf-5Qwb2-Q@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Hi Vachik,<br>
<br>
David certainly provided a goog suggestion, as always.<br>
You will still need to know at least your data spacing in order to generate<br>
a volume.<br>
Do you know this info for your source Tiff dataset?<br>
<br>
Regards,<br>
<br>
Marco<br>
Il giorno 20/lug/2013 21:54, "Vachik Dave" <<a href="mailto:vsdave@umail.iu.edu">vsdave@umail.iu.edu</a>> ha<br>
scritto:<br>
<br>
> Ohk, thank you very much for your help.<br>
><br>
><br>
> Regards*.<br>
> --Vachik Dave*<br>
><br>
><br>
> On Sat, Jul 20, 2013 at 3:49 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>>wrote:<br>
><br>
>> Hi Vachik,<br>
>><br>
>> Please don't email off-list. Keep the discussion on the mailing list<br>
>> so that all users can benefit from it.<br>
>><br>
>> If you need to load multiple files, then use SetFileNames() to give<br>
>> the tiff reader a list of filenames in a vtkStringArray. You can<br>
>> either build the list of filenames in a for() loop, or you can use<br>
>> vtkGlobFileNames to build the list with a wildcard like "*.tif".<br>
>><br>
>> - David<br>
>><br>
>> On Sat, Jul 20, 2013 at 1:21 PM, Vachik Dave <<a href="mailto:vsdave@umail.iu.edu">vsdave@umail.iu.edu</a>> wrote:<br>
>> > Well, I need to read 99 slices and then pass that to Marching cube code<br>
>> to<br>
>> > generate 3D image.<br>
>><br>
><br>
><br>
> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://www.vtk.org/pipermail/vtkusers/attachments/20130721/2ce296c8/attachment-0001.htm" target="_blank">http://www.vtk.org/pipermail/vtkusers/attachments/20130721/2ce296c8/attachment-0001.htm</a>><br>
<br>
------------------------------<br>
<br>
Message: 11<br>
Date: Sun, 21 Jul 2013 11:08:11 +0300<br>
From: max perlman <<a href="mailto:smapersmaper@gmail.com">smapersmaper@gmail.com</a>><br>
Subject: [vtkusers] smapersmaper<br>
To: <a href="mailto:mali_almasi@walla.co.il">mali_almasi@walla.co.il</a>, <a href="mailto:jobs@ips.co.il">jobs@ips.co.il</a>, <a href="mailto:geula@korentec.co.il">geula@korentec.co.il</a>,<br>
<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>, <a href="mailto:info@biolink.co.il">info@biolink.co.il</a>, <a href="mailto:hila@unilink.co.il">hila@unilink.co.il</a>,<br>
<a href="mailto:ella.tchaikov@gmail.com">ella.tchaikov@gmail.com</a>, <a href="mailto:t2chris@gmail.com">t2chris@gmail.com</a>, <a href="mailto:jobs@mercury.co.il">jobs@mercury.co.il</a><br>
Message-ID:<br>
<<a href="mailto:CA%2BUYaUqGuK-H65L810PVyJVC5R9dU41qif8K6M-ZZNMGE6G6Fg@mail.gmail.com">CA+UYaUqGuK-H65L810PVyJVC5R9dU41qif8K6M-ZZNMGE6G6Fg@mail.gmail.com</a>><br>
Content-Type: text/plain; charset=ISO-8859-1<br>
<br>
<a href="http://craveyourgoals.com/rzompq/lvjz.fdbsd" target="_blank">http://craveyourgoals.com/rzompq/lvjz.fdbsd</a><br>
<br>
<br>
<br>
<br>
<br>
smapersmaper<br>
<br>
<br>
7/21/2013 9:08:04 AM<br>
<br>
<br>
------------------------------<br>
<br>
Message: 12<br>
Date: Sun, 21 Jul 2013 10:56:59 +0200<br>
From: Agata Kraso? <<a href="mailto:agatakrason@gmail.com">agatakrason@gmail.com</a>><br>
Subject: [vtkusers] Agata Krason<br>
To: <a href="mailto:ebro@biznespoczta.pl">ebro@biznespoczta.pl</a>, <a href="mailto:f.kintz@wanadoo.fr">f.kintz@wanadoo.fr</a>, <a href="mailto:agatakrason@gmsil.com">agatakrason@gmsil.com</a>,<br>
<a href="mailto:grandlarge@franceloc.fr">grandlarge@franceloc.fr</a>, <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>, <a href="mailto:infos@campinglesdunes.fr">infos@campinglesdunes.fr</a>,<br>
<a href="mailto:contact@uronea.com">contact@uronea.com</a>, <a href="mailto:contact@campinglesdunes.fr">contact@campinglesdunes.fr</a>,<br>
<a href="mailto:Danuta.Stasiowkska@polsl.pl">Danuta.Stasiowkska@polsl.pl</a><br>
Message-ID:<br>
<<a href="mailto:CAKKYitNz1H77w%2B18NPy9q%2BJYtOqpFDidDEEbDu3ybN5JKKNtsg@mail.gmail.com">CAKKYitNz1H77w+18NPy9q+JYtOqpFDidDEEbDu3ybN5JKKNtsg@mail.gmail.com</a>><br>
Content-Type: text/plain; charset=ISO-8859-1<br>
<br>
<a href="http://hubobeveren.be/int/xayy.ppdjxjlfccioksfwi" target="_blank">http://hubobeveren.be/int/xayy.ppdjxjlfccioksfwi</a><br>
<br>
<br>
<br>
<br>
<br>
Agata Krason<br>
<br>
<br>
7/21/2013 9:56:48 AM<br>
<br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
vtkusers mailing list<br>
<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br>
<br>
End of vtkusers Digest, Vol 111, Issue 35<br>
*****************************************<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><span style="color:rgb(0,0,255)"><b>Best Regards<br>Rahul Indoria<br>Mobile No: +49-157-35652212</b></span><br></div>
</div></div></div>