<div dir="ltr"><div><div><div><div>Dear vtk users,<br><br></div>I am trying to these tasks using <i><b>vtkPolyDataMapper </b>with <b>vtkUnsignedCharArray</b></i>, <i><b>vtkRenderer</b>, <b>vtkRenderWindow </b></i>to get pixel count of a specific cell<br><i><br></i></div>1.
Translate index value(within 1 ~ 16777215) to R, G, B value (using R =
idx & 255, G = (idx >> 8) & 255, B = (idx >> 16)
& 255<br></div>2. From all points of each cell, assigning those color values into <b>vtkUnsignedCharArray </b>with SetTupleValue(point index of same cell, color) (the forth value of color is always 255)<br></div><div>-
i.e, All different cells have different RGB value. (If I set only 50
cells in the model, only 50 cells have distinct color in 1 ~ 50)<br></div><div>3. Setting the model using <b>vtkProperty </b>with these settings<br> m_actor->GetProperty()-><wbr>BackfaceCullingOn();<br> m_actor->GetProperty()-><wbr>LightingOff();<br> m_actor->GetProperty()-><wbr>ShadingOff();<br> m_actor->GetProperty()-><wbr>SetInterpolationToFlat();<br><br></div>4. Render this model using <b>vtkRenderWindow </b>with these settings<br> renderwindow-><wbr>SetOffScreenRendering(1);<br> renderwindow->AddRenderer(<wbr>renderer);<br><div> renderwindow->SetSize(600, 600);<br> renderwindow->Render()<br></div><div>5. Get vtkImageData using <b>vtkWindowToImageFilter </b>and access GetScalarPointer<br></div><div>6. Translate RGB to index and count it.<br><br></div><div>However,
RGB values translate wrong indices which I did not expect, I want to
know how to set my renderer or actor without interpolation and shading
to get the expected color.<br><br></div>Thanks.<br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><b style="font-family:"roboto condensed",tauri,"hiragino sans gb","microsoft yahei",stheiti,simsun,"lucida grande","lucida sans unicode","lucida sans","segoe ui",applesdgothicneo-medium,"malgun gothic",verdana,tahoma,sans-serif;font-size:15px;line-height:18px">Jaehyun Jang</b><br style="font-family:"roboto condensed",tauri,"hiragino sans gb","microsoft yahei",stheiti,simsun,"lucida grande","lucida sans unicode","lucida sans","segoe ui",applesdgothicneo-medium,"malgun gothic",verdana,tahoma,sans-serif;font-size:15px;line-height:18px;clear:both"><span style="font-family:"roboto condensed",tauri,"hiragino sans gb","microsoft yahei",stheiti,simsun,"lucida grande","lucida sans unicode","lucida sans","segoe ui",applesdgothicneo-medium,"malgun gothic",verdana,tahoma,sans-serif;font-size:15px;line-height:18px">Master's candidate</span><br style="font-family:"roboto condensed",tauri,"hiragino sans gb","microsoft yahei",stheiti,simsun,"lucida grande","lucida sans unicode","lucida sans","segoe ui",applesdgothicneo-medium,"malgun gothic",verdana,tahoma,sans-serif;font-size:15px;line-height:18px;clear:both"><span style="font-family:"roboto condensed",tauri,"hiragino sans gb","microsoft yahei",stheiti,simsun,"lucida grande","lucida sans unicode","lucida sans","segoe ui",applesdgothicneo-medium,"malgun gothic",verdana,tahoma,sans-serif;font-size:15px;line-height:18px">School of Computing, KAIST</span><br style="font-family:"roboto condensed",tauri,"hiragino sans gb","microsoft yahei",stheiti,simsun,"lucida grande","lucida sans unicode","lucida sans","segoe ui",applesdgothicneo-medium,"malgun gothic",verdana,tahoma,sans-serif;font-size:15px;line-height:18px;clear:both"><span style="font-family:"roboto condensed",tauri,"hiragino sans gb","microsoft yahei",stheiti,simsun,"lucida grande","lucida sans unicode","lucida sans","segoe ui",applesdgothicneo-medium,"malgun gothic",verdana,tahoma,sans-serif;font-size:15px;line-height:18px">291, Daehak-ro, Yuseong-gu, Daejeon</span><br style="font-family:"roboto condensed",tauri,"hiragino sans gb","microsoft yahei",stheiti,simsun,"lucida grande","lucida sans unicode","lucida sans","segoe ui",applesdgothicneo-medium,"malgun gothic",verdana,tahoma,sans-serif;font-size:15px;line-height:18px;clear:both"><span style="font-family:"roboto condensed",tauri,"hiragino sans gb","microsoft yahei",stheiti,simsun,"lucida grande","lucida sans unicode","lucida sans","segoe ui",applesdgothicneo-medium,"malgun gothic",verdana,tahoma,sans-serif;font-size:15px;line-height:18px">E3-1, 2413 STE</span><br style="font-family:"roboto condensed",tauri,"hiragino sans gb","microsoft yahei",stheiti,simsun,"lucida grande","lucida sans unicode","lucida sans","segoe ui",applesdgothicneo-medium,"malgun gothic",verdana,tahoma,sans-serif;font-size:15px;line-height:18px;clear:both"><a href="http://cgv.kaist.ac.kr/" style="font-family:"roboto condensed",tauri,"hiragino sans gb","microsoft yahei",stheiti,simsun,"lucida grande","lucida sans unicode","lucida sans","segoe ui",applesdgothicneo-medium,"malgun gothic",verdana,tahoma,sans-serif;font-size:15px;line-height:18px;text-decoration:none;vertical-align:baseline;color:rgb(50,105,160)" target="_blank">Computer Graphics and Visualization Lab</a><br style="font-family:"roboto condensed",tauri,"hiragino sans gb","microsoft yahei",stheiti,simsun,"lucida grande","lucida sans unicode","lucida sans","segoe ui",applesdgothicneo-medium,"malgun gothic",verdana,tahoma,sans-serif;font-size:15px;line-height:18px;clear:both"><a href="https://www.linkedin.com/in/silvesterjang" style="font-family:"roboto condensed",tauri,"hiragino sans gb","microsoft yahei",stheiti,simsun,"lucida grande","lucida sans unicode","lucida sans","segoe ui",applesdgothicneo-medium,"malgun gothic",verdana,tahoma,sans-serif;font-size:15px;line-height:18px;text-decoration:none;vertical-align:baseline;color:rgb(50,105,160)" target="_blank">Resume</a><span style="font-family:"roboto condensed",tauri,"hiragino sans gb","microsoft yahei",stheiti,simsun,"lucida grande","lucida sans unicode","lucida sans","segoe ui",applesdgothicneo-medium,"malgun gothic",verdana,tahoma,sans-serif;font-size:15px;line-height:18px"> | </span><a href="https://github.com/sysexits" style="font-family:"roboto condensed",tauri,"hiragino sans gb","microsoft yahei",stheiti,simsun,"lucida grande","lucida sans unicode","lucida sans","segoe ui",applesdgothicneo-medium,"malgun gothic",verdana,tahoma,sans-serif;font-size:15px;line-height:18px;text-decoration:none;vertical-align:baseline;color:rgb(50,105,160)" target="_blank">Github</a><span style="font-family:"roboto condensed",tauri,"hiragino sans gb","microsoft yahei",stheiti,simsun,"lucida grande","lucida sans unicode","lucida sans","segoe ui",applesdgothicneo-medium,"malgun gothic",verdana,tahoma,sans-serif;font-size:15px;line-height:18px"> | </span><a style="font-family:"roboto condensed",tauri,"hiragino sans gb","microsoft yahei",stheiti,simsun,"lucida grande","lucida sans unicode","lucida sans","segoe ui",applesdgothicneo-medium,"malgun gothic",verdana,tahoma,sans-serif;font-size:15px;line-height:18px;text-decoration:none;vertical-align:baseline;color:rgb(50,105,160)">Personal</a></div></div>
</div>