<div dir="ltr">I am not a C# person. I can convert it to C++. However, a short program that illustrates the problem would be better. The smallest that illustrates the problem.<div><br></div><div style>Otherwise, it will be a few days before I can take the time to translate your program.</div>
<div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Apr 20, 2013 at 2:11 AM, DivyaS <span dir="ltr">&lt;<a href="mailto:div.anand141@gmail.com" target="_blank">div.anand141@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The code is in C#. I started working in VTK 3 weeks back, please correct me<br>
if I am wrong with the pipeline. The colors are selected wrt to the<br>
localActivationTime value. Here I have created a list of keyValuePair<br>
&#39;colorLAT&#39; and the localActivationTime value are created and stored in it.<br>
In the real application, the localActivationTime are given as a different<br>
input, and the colors need to be selected accordingly.<br>
<br>
vtkPoints points = vtkPoints.New();<br>
            points.InsertNextPoint(1.82, -84.67, 152.78);<br>
            points.InsertNextPoint(-10.18, -81.77, 175.03);<br>
            points.InsertNextPoint(-11.65, -32.09, 173.08);<br>
            points.InsertNextPoint(-6.85, 6, 6);<br>
            points.InsertNextPoint(0.09, -83.69, 154.23);<br>
            points.InsertNextPoint(-16.67, -79.95, 150.54);<br>
            points.InsertNextPoint(-2.74, -89.19, 153.67);<br>
            points.InsertNextPoint(-38.7, -58.88, 145.54);<br>
<br>
<br>
            points.InsertNextPoint(-43.83, -46.88, 140.94);<br>
            points.InsertNextPoint(-9.29, -67.59, 149.96);<br>
            points.InsertNextPoint(-6.33, -72.42, 147.95);<br>
            points.InsertNextPoint(-6.73, -73.28, 148.64);<br>
            points.InsertNextPoint(-21.51, -80.61, 148.58);<br>
            points.InsertNextPoint(2.75, -63.21, 140.98);<br>
            points.InsertNextPoint(-13.52, -50.61, 165.29);<br>
            points.InsertNextPoint(-14.67, -48.55, 166.27);<br>
<br>
            points.InsertNextPoint(-19.85, -73.21, 134.88);<br>
            points.InsertNextPoint(-12.08, -79.71, 148.54);<br>
            points.InsertNextPoint(-20.43, -78.4, 145.79);<br>
            points.InsertNextPoint(-21.51, -78.74, 149.56);<br>
            points.InsertNextPoint(-39.36, -61.7, 153.9);<br>
            points.InsertNextPoint(-28.31, -78.12, 144.73);<br>
            points.InsertNextPoint(-20.23, -88.43, 155.28);<br>
            points.InsertNextPoint(-21.87, -72.37, 148.9);<br>
<br>
            points.InsertNextPoint(-29.79, -76.02, 128.35);<br>
            points.InsertNextPoint(-15.34, -70.51, 141.4);<br>
            points.InsertNextPoint(-21.14, -72.03, 134.04);<br>
            points.InsertNextPoint(-25.65, -69.4, 138.11);<br>
            points.InsertNextPoint(-12.7, -70.25, 137.26);<br>
            points.InsertNextPoint(-19.99, -75.75, 140.2);<br>
            points.InsertNextPoint(-19.36, -76.19, 134.93);<br>
            points.InsertNextPoint(-15.33, -73.78, 133.75);<br>
<br>
            points.InsertNextPoint(-16.92, -69.18, 134.01);<br>
            points.InsertNextPoint(-25.94, -76.28, 155.28);<br>
            points.InsertNextPoint(-25.82, -81.69, 153.39);<br>
            points.InsertNextPoint(-20.27, -85.45, 146.25);<br>
            points.InsertNextPoint(-22, -74.8, 128.74);<br>
            points.InsertNextPoint(-25.68, -75.75, 130.94);<br>
            points.InsertNextPoint(-13.16, -63.49, 143.67);<br>
            points.InsertNextPoint(-19.75, -80.75, 145.95);<br>
            points.InsertNextPoint(-19.11, -83.81, 147.76);<br>
<br>
            vtkPolyData polydata = vtkPolyData.New();<br>
            polydata.SetPoints(points);<br>
<br>
            vtkDelaunay3D delaunay = vtkDelaunay3D.New();<br>
            delaunay.SetInput(polydata);<br>
            delaunay.SetTolerance(0.001);<br>
            delaunay.Update();<br>
<br>
            vtkDataSetSurfaceFilter surfaceFilter =<br>
vtkDataSetSurfaceFilter.New();<br>
            surfaceFilter.SetInputConnection(delaunay.GetOutputPort());<br>
            surfaceFilter.Update();<br>
<br>
            vtkXMLPolyDataWriter outputWriter = vtkXMLPolyDataWriter.New();<br>
            outputWriter.SetFileName(&quot;output.vtp&quot;);<br>
            outputWriter.SetInput(surfaceFilter.GetOutput());<br>
            outputWriter.Write();<br>
<br>
            vtkXMLPolyDataReader reader1 = vtkXMLPolyDataReader.New();<br>
            reader1.SetFileName(&quot;output.vtp&quot;);<br>
            reader1.Update();<br>
<br>
            vtkTriangleFilter triangles = vtkTriangleFilter.New();<br>
            triangles.SetInput(reader1.GetOutput());<br>
            triangles.Update();<br>
            vtkPolyData originalMesh;<br>
            originalMesh = triangles.GetOutput();<br>
<br>
            vtkUnsignedCharArray colors = vtkUnsignedCharArray.New();<br>
            colors.SetNumberOfComponents(3);<br>
            colors.SetNumberOfTuples(originalMesh.GetNumberOfPolys());<br>
            colors.SetName(&quot;Colors&quot;);<br>
<br>
//Temporary creation of the localActivationTime values (the colors are<br>
selected according to this value)<br>
            List&lt;KeyValuePair&amp;lt;int, int&gt;&gt; colorLAT = new<br>
List&lt;KeyValuePair&amp;lt;int, int&gt;&gt;();<br>
            for (int i = 0; i &lt; originalMesh.GetNumberOfPoints(); i++)<br>
            {<br>
                colorLAT.Add(new KeyValuePair&lt;int, int&gt;(i, (i + 2)));<br>
            }<br>
<br>
            int localActivationTime;<br>
            for (int i = 0; i &lt; originalMesh.GetNumberOfPoints(); i++)<br>
            {<br>
                localActivationTime = colorLAT[i].Value;<br>
<br>
                if (localActivationTime &gt; 0 &amp;&amp; localActivationTime &lt; 5)<br>
                {<br>
                    //Yellow<br>
                    colors.InsertTuple3(i, 255, 255, 0);<br>
                }<br>
                else if (localActivationTime &gt; 4 &amp;&amp; localActivationTime &lt;<br>
10)<br>
                {<br>
                    //Blue<br>
                    colors.InsertTuple3(i, 0, 0, 255);<br>
                }<br>
                else if (localActivationTime &gt; 9 &amp;&amp; localActivationTime &lt;<br>
300)<br>
                {<br>
                    //Red<br>
                    colors.InsertTuple3(i, 255, 0, 0);<br>
                }<br>
            }<br>
            originalMesh.GetPointData().SetScalars(colors);<br>
<br>
            int numberOfViewports = 3;<br>
            vtkRenderWindow renderWindow =<br>
renderWindowControl1.RenderWindow;<br>
            this.Size = new System.Drawing.Size(200 * numberOfViewports +<br>
12, 252);<br>
            this.Text += &quot; - Subdivision&quot;;<br>
            Random rnd = new Random(2);<br>
            int numberOfSubdivisions = 4;<br>
<br>
            // Create one text property for all<br>
            vtkTextProperty textProperty = vtkTextProperty.New();<br>
            textProperty.SetFontSize(14);<br>
            textProperty.SetJustificationToCentered();<br>
<br>
<br>
            for (int i = 0; i &lt; numberOfViewports; i++)<br>
            {<br>
                vtkPolyDataAlgorithm subdivisionFilter;<br>
                switch (i)<br>
                {<br>
                    case 0:<br>
                        subdivisionFilter =<br>
vtkLinearSubdivisionFilter.New();<br>
<br>
((vtkLinearSubdivisionFilter)subdivisionFilter).SetNumberOfSubdivisions(numberOfSubdivisions);<br>
                        break;<br>
                    case 1:<br>
                        subdivisionFilter = vtkLoopSubdivisionFilter.New();<br>
<br>
((vtkLoopSubdivisionFilter)subdivisionFilter).SetNumberOfSubdivisions(numberOfSubdivisions);<br>
                        break;<br>
                    case 2:<br>
                        subdivisionFilter =<br>
vtkButterflySubdivisionFilter.New();<br>
<br>
((vtkButterflySubdivisionFilter)subdivisionFilter).SetNumberOfSubdivisions(numberOfSubdivisions);<br>
                        break;<br>
                    default:<br>
                        subdivisionFilter =<br>
vtkLinearSubdivisionFilter.New();<br>
<br>
((vtkLinearSubdivisionFilter)subdivisionFilter).SetNumberOfSubdivisions(numberOfSubdivisions);<br>
                        break;<br>
                }<br>
                subdivisionFilter.SetInput(originalMesh);<br>
                subdivisionFilter.Update();<br>
<br>
                vtkRenderer renderer = vtkRenderer.New();<br>
                renderWindow.AddRenderer(renderer);<br>
                renderer.SetViewport((float)i / numberOfViewports, 0,<br>
(float)(i + 1) / numberOfViewports, 1);<br>
                renderer.SetBackground(.2 + rnd.NextDouble() / 8, .3 +<br>
rnd.NextDouble() / 8, .4 + rnd.NextDouble() / 8);<br>
<br>
                vtkTextMapper textMapper = vtkTextMapper.New();<br>
                vtkActor2D textActor = vtkActor2D.New();<br>
                textMapper.SetInput(subdivisionFilter.GetClassName());<br>
                textMapper.SetTextProperty(textProperty);<br>
<br>
                textActor.SetMapper(textMapper);<br>
                textActor.SetPosition(100, 16);<br>
<br>
                //Create a mapper and actor<br>
                vtkPolyDataMapper mapper = vtkPolyDataMapper.New();<br>
<br>
mapper.SetInputConnection(subdivisionFilter.GetOutputPort());<br>
                vtkActor actor = vtkActor.New();<br>
                actor.SetMapper(mapper);<br>
                renderer.AddActor(actor);<br>
                renderer.AddActor(textActor);<br>
                renderer.ResetCamera();<br>
            }<br>
            renderWindow.Render();<br>
<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Uneven-colors-after-the-vtkButterflySubdivisionFilter-tp5720205p5720226.html" target="_blank">http://vtk.1045678.n5.nabble.com/Uneven-colors-after-the-vtkButterflySubdivisionFilter-tp5720205p5720226.html</a><br>

Sent from the VTK - Users mailing list archive at Nabble.com.<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>