<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I would like to know what is wrong in my code
or if somebody could give me a solution.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I want to blend two images , BackColor and
LabelColor (instances of vtkImageMapToColors, see the code below ), but i need
erase some parts of LabelColor.</FONT></DIV>
<DIV><FONT face=Arial size=2>If a put </FONT></DIV>
<DIV><FONT face=Arial size=2>>
self.BackColorth.GetOutput().SetScalarComponentFromDouble(i,
j,self.mapper.GetZSlice(),0,0)
[I]</FONT><BR><FONT face=Arial size=2>before instancializing LabelColor, I
manage to erase the parts, but if i put it
after LabelColor</FONT></DIV>
<DIV><FONT face=Arial size=2>>
self.BackColorth.GetOutput().SetScalarComponentFromDouble(i,
j,self.mapper.GetZSlice(),0,0)
[II]</FONT></DIV>
<DIV><FONT face=Arial size=2> the parts are not erased.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Due to the pipeline structure, I`d imagine
positioning this in different parts of the code wouldn`t make difference. I
tried to Update objects and so on, but this doesn''t work.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Can someone explain to me why positioning in [II]
the code I use to erase part of the image, it is
not erased?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks,</FONT></DIV>
<DIV><FONT face=Arial size=2>Glauco Buzini da Costa Silva</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>--------------------</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>def __init__(self, imagedata1,
imagedata2):</FONT></DIV>
<DIV><FONT face=Arial size=2> </FONT></DIV>
<DIV><FONT face=Arial
size=2>
...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
#self.BackColor =
self.CreateImageColor(immagedata1,bwLut)<BR>
self.BackColor =
vtkImageMapToColors()<BR>
self.BackColor.SetOutputFormatToRGBA()<BR>
self.BackColor.SetInput(imagedata1)
<BR>
self.BackColor.SetLookupTable(bwLut)<BR>
self.BackColor.GetOutput().Update() </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
#self.BackColorth =
self.CreateImageColor(imagedata2,bwLut)<BR>
self.BackColorth =
vtkImageMapToColors()<BR>
self.BackColorth.SetOutputFormatToRGBA()<BR>
self.BackColorth.SetInput(imagedata2)
<BR>
self.BackColorth.SetLookupTable(bwLut)<BR>
self.BackColorth.GetOutput().Update()</FONT></DIV>
<DIV><FONT face=Arial
size=2> </FONT></DIV>
<DIV><FONT face=Arial size=2> # for i
in range(50):<BR> #
for j in
range(50):<BR> #
self.BackColorth.GetOutput().SetScalarComponentFromDouble(i,
j,self.mapper.GetZSlice(),0,0)
[I]<BR> <BR>
#LabelColor =
self.CreateImageColor(self.BackColorth.GetOutput(),ilut)<BR>
self.LabelColor =
vtkImageMapToColors()<BR>
self.LabelColor.SetOutputFormatToRGBA()<BR>
self.LabelColor.SetInput(self.BackColorth.GetOutput())
<BR>
self.LabelColor.SetLookupTable(ilut)<BR>
self.LabelColor.GetOutput().Update()</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> for i in
range(50):<BR>
for j in
range(50):<BR>
self.BackColorth.GetOutput().SetScalarComponentFromDouble(i,
j,self.mapper.GetZSlice(),0,0)
[II]</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> imblend
= vtkImageBlend()<BR> self.imblend =
imblend <BR>
imblend.SetInput(0,self.BackColor.GetOutput())<BR>
imblend.SetInput(1,self.LabelColor.GetOutput())<BR>
imblend.SetOpacity(1,0.8)<BR>
imblend.Update()</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> mapper =
vtkImageMapper()
<BR> self.mapper =
mapper<BR>
mapper.SetInput(imblend.GetOutput())<BR>
mapper.SetColorLevel(40)<BR>
mapper.SetColorWindow(100)<BR>
mapper.SetZSlice(50) </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>
imageActor = vtkActor2D()<BR>
imageActor.SetMapper(mapper)<BR>
#imageActor.SetZSlice(0)<BR>
#imageActor.SetColorLevel(127)<BR>
#imageActor.SetColorWindow(300)<BR>
#self.imageActor.SetPosition((2,2))</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> ren =
vtkRenderer()<BR>
ren.AddActor2D(imageActor)</FONT></DIV>
<DIV><FONT face=Arial
size=2>
</FONT></DIV>
<DIV><FONT face=Arial size=2>
.</FONT><FONT face=Arial size=2>..</FONT><FONT face=Arial
size=2></DIV>
<DIV>
<DIV><FONT face=Arial size=2> </FONT></DIV>
<DIV><FONT face=Arial
size=2> </FONT></DIV>
<DIV> </DIV></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> def CreateImageColor(imagedata,
ilut):</FONT></DIV>
<DIV><FONT face=Arial size=2>
</FONT></DIV>
<DIV><FONT face=Arial size=2> ImageColor =
vtkImageMapToColors()<BR>
ImageColor.SetOutputFormatToRGBA()<BR>
ImageColor.SetInput(imdata)
<BR>
ImageColor.SetLookupTable(ilut)<BR>
ImageColor.GetOutput().Update()
</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> return
ImageColor</FONT></DIV>
<DIV><FONT face=Arial size=2>...
###############################################</FONT></DIV></BODY></HTML>