<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>Hello All,</div><div><br></div><div>I've been working lately with the vtkImageDataGeometryFilter and after some debug I came to the conclusion that:</div><div>inside the <span style="color: rgb(0, 0, 191); font-family: Courier New,courier,monaco,monospace,sans-serif;">RequestData(...)</span> method, when <span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);">dimension == 2</span> (build plane) if one checks for <span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);">ThresholdCells</span>, this logic is INVERTED:</div><div><span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);"> threshok = false;</span><br style="font-family: Courier
New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);"> for (s=0; !threshok && s<4; s++)</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);"> {</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);"> if (pointScalars->GetComponent(ptIds[s],0)>this->ThresholdValue)</span><br style="font-family: Courier
New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);"> {</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);"> threshok = true;</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);"> break;</span><br style="font-family: Courier
New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);"> }</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);"> }</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);">This only check if at least one vertex is above the threshold but the other way around might be more judicious:<br></div><div style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0,
191);"> threshok = true;<br> firstTriangle = true;<br><br> for ( s = 0; threshok && s < 4; s++ ) {<br><br> if ( pointScalars->GetComponent( ptIds[s], 0 ) <= this->ThresholdValue ) {<br><br> if ( s == 1 )
{<br> firstTriangle = false;<br> } else {<br> threshok = false;<br> break;<br>
}<br> }<br> }<br></div><div><br></div><div>As you can see I have also added a firstTriangle var which allows to conserve at least one of the two triangles if possible...</div><div><br></div><div>Find below the portion of code that I propose to modify:</div><div style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);"> if ( this->ThresholdCells ) {<br> threshok =
true;<br> firstTriangle = true;<br><br> for ( s = 0; threshok && s < 4; s++ ) {<br><br> if ( pointScalars->GetComponent( ptIds[s], 0 ) <= this->ThresholdValue ) {<br><br> if ( s == 1 ) {<br> firstTriangle =
false;<br> } else {<br> threshok = false;<br> break;<br> }<br>
}<br> }<br><br> if ( threshok ) {<br><br> if ( this->OutputTriangles ) {<br><br> if ( firstTriangle ) {<br> cellId = newPolys->InsertNextCell( 3, ptIds
);<br> outCD->CopyData( cd, idx, cellId );<br> }<br><br> triIds[0] = ptIds[0];<br> triIds[1] = ptIds[2];<br> triIds[2] =
ptIds[3];<br> cellId = newPolys->InsertNextCell( 3, triIds );<br> outCD->CopyData( cd, idx, cellId );<br> } else {<br> cellId = newPolys->InsertNextCell( 4, ptIds );<br>
outCD->CopyData( cd, idx, cellId );<br> }<br> }<br> } else {<br> cellId = newPolys->InsertNextCell( 4, ptIds );<br> outCD->CopyData( cd, idx, cellId );<br> }<br></div><div><br></div><div>The var firstTriangle has to be declared outside of the switch scope of course.</div><div>For now that is how I
have modified/customized my own filter.</div><div><br></div><div>Remark:</div><div>- the <span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);">UpdateProgress</span> calls are missing in this filter (I've also added it in my own implementation).</div><div><br></div><div>Other Remark:</div><div>- I use <span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 191);">register</span> for loop vars and it improves performances :)</div><div><br></div><div>Alright, let me know if I'm right or wrong about this filter and let me know if you want me to post my final work about it or if these snipets are good enough, okay?</div><div><br></div><div>Thank you,</div><div>Sebastien.</div></div></body></html>