[vtkusers] Please, I need help of a C# and vtk user!!!

Bill Lorensen bill.lorensen at gmail.com
Wed Nov 26 15:26:07 EST 2008


Vicky's data is 3D. You can see that in the
tiffReader.SetDataExtent(0, 339, 0, 233, 1, 3);

Don't be confused by:
tiffReader.SetFileDimensionality(2);

That means the tiff files are each 2D, but she is reading tiff images
1,2 and 3 to form a 3D volume.

Although her C# program fails to produce results, a similar tcl
program does produce results with the same data.

As Vicky stated in the suject, she needs C# help.

Bill


On Tue, Nov 25, 2008 at 2:47 AM, Oliver Kania
<ptw.freiburg at googlemail.com> wrote:
> Hello Vicky,
>
> As far as I know, MarchingCubes is an algorithm
> for 3-Dimensional data. Use MarchingSquares or
> maybe vtkContourFilter instead.
>
> Best regards,
> Oliver
>
> 2008/11/24 Vicky <bonsai19 at gmx.de>
>>
>> Hallo vtk users,
>>
>> Basically, I'm trying to model segmented data in VTK, based on the
>> tutorial, provided in:
>>
>> http://www.cs.utah.edu/classes/cs5630/vtk%204.4.2/vtkhtml/applications/segment/segmented16.html
>>
>> /Now I am trying to use my own segmented data with the above scripts,
>> where //they represent 340x234 segmented data, with each pixel represented
>> by an //integer.
>>
>> When I run my C#-project I should get a vtk File /"Volume.vtk"/ and a
>> volume should be rendered.// Instead it is //empty and no polygons are
>> generated. I get the following errors:
>>
>> /ERROR: In m:\dev\cur\vtkdotnet\branch\50\Graphics\vtkDecimatePro.cxx,
>> line 161 vtkDecimatePro (04042A88): No data to decimate!
>>
>> ERROR: In
>> m:\dev\cur\vtkdotnet\branch\50\Graphics\vtkSmoothPolyDataFilter.cxx, line
>> 212 vtkSmoothPolyDataFilter (04053210): No data to smooth!
>>
>> ERROR: In m:\dev\cur\vtkdotnet\branch\50\Graphics\vtkPolyDataNormals.cxx,
>> line 94
>> vtkPolyDataNormals (040540D0): No data to generate normals for!
>>
>> /I am really trying to understand what //is wrong, but I cannot figure it
>> out./
>>
>> //The script I have written://
>>
>> public void myvtkpipeline(vtkRenderWindow renWin)
>> {
>>           vtkRenderWindow renWin = new vtkRenderWindow();
>>           renWin.AddRenderer(ren);
>>
>>           vtkTIFFReader tiffReader = new vtkTIFFReader();
>>           tiffReader.SetDataExtent(0, 339, 0, 233, 1, 3);
>>           tiffReader.SetFileDimensionality(2);
>>           tiffReader.SetFilePattern("C:/Images/labels_%03i.tiff");
>>           tiffReader.Update();
>>
>>           vtkDiscreteMarchingCubes marchingCubes = new
>> vtkDiscreteMarchingCubes();
>>           marchingCubes.SetInput(tiffReader.GetOutput());
>>           marchingCubes.ComputeScalarsOff();
>>           marchingCubes.ComputeGradientsOff();
>>           marchingCubes.ComputeNormalsOff();
>>           marchingCubes.SetValue(0, 7);
>>
>>           vtkDecimatePro decimate = new vtkDecimatePro();
>>           decimate.SetInput(marchingCubes.GetOutput());
>>           decimate.SetFeatureAngle(60.0);
>>           decimate.SetMaximumError(1);
>>           decimate.SetTargetReduction(0.9);
>>
>>           vtkSmoothPolyDataFilter smoother = new
>> vtkSmoothPolyDataFilter();
>>           smoother.SetInput(decimate.GetOutput());
>>           smoother.SetNumberOfIterations(10);
>>           smoother.SetRelaxationFactor(0.1);
>>           smoother.SetFeatureAngle(60.0);
>>           smoother.FeatureEdgeSmoothingOff();
>>           smoother.SetConvergence(0);
>>
>>           vtkPolyDataNormals normals = new vtkPolyDataNormals();
>>           normals.SetInput(smoother.GetOutput());
>>           normals.SetFeatureAngle(60.0);
>>
>>           vtkStripper stripper = new vtkStripper();
>>           stripper.SetInput(normals.GetOutput());
>>
>>           vtkPolyDataWriter writer = new vtkPolyDataWriter();
>>           writer.SetInput(stripper.GetOutput());
>>           writer.SetFileName("Volume.vtk");
>>           writer.SetFileType(2);
>>
>>           writer.Update();
>>
>>           vtkPolyDataReader reader = new vtkPolyDataReader();
>>           reader.SetFileName("Volume.vtk");
>>
>>           vtkPolyDataMapper mapper = new vtkPolyDataMapper();
>>           mapper.SetInputConnection(reader.GetOutputPort());
>>           mapper.ScalarVisibilityOff();
>>
>>           actor.SetMapper(mapper);
>>
>>           vtkCamera camera = new vtkCamera();
>>           camera.SetViewUp(0, 0, -1);
>>           camera.SetPosition(0, 1, 0);
>>           camera.SetFocalPoint(0, 0, 0);
>>           camera.ComputeViewPlaneNormal();
>>
>>           vtkRenderer = new vtkRenderer();
>>           ren.SetActiveCamera(camera);
>>           ren.ResetCamera();
>>           ren.SetBackground(0, 0, 0);
>>           ren.ResetCameraClippingRange();
>>
>>           ren.AddActor(actor);
>> }
>>
>> I hope somebody helps me!
>>
>> Best regards,
>> Vicky
>> _______________________________________________
>> This is the private VTK discussion list.
>> Please keep messages on-topic. Check the FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



More information about the vtkusers mailing list