<meta http-equiv="content-type" content="text/html; charset=utf-8"><div class="gmail_quote">On Fri, Jan 7, 2011 at 2:45 PM, Rachel <span dir="ltr"><<a href="mailto:aracha2010@gmail.com">aracha2010@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
Hi Kwayeke,<br>
<br>
this is color image. To change the color R, G ,B try with this inside the<br>
loop<br>
<br>
Image->SetScalarComponentFromDouble(x,y,z,0, R);<br>
Image->SetScalarComponentFromDouble(x,y,z,1, G);<br>
Image->SetScalarComponentFromDouble(x,y,z,2, B);<br></blockquote><div><br></div><div>Or do this:</div><div>double* pixel = static_cast<double*>(ImageData->GetScalarPointer(k,j,i));</div><div>pixel[0] = r;</div>
<div><meta http-equiv="content-type" content="text/html; charset=utf-8">pixel[1] = g;</div><div><meta http-equiv="content-type" content="text/html; charset=utf-8">pixel[2] = b;</div><div><br></div><div>This way if it is not double the only thing that changes is the 'pixel' pointer and the cast - you don't have to think about what SetScalarComponentFromDouble is doing.</div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div><div>David </div></div>