<div dir="ltr"><div>Hi Aashis,</div><div><br></div><div>Below is the code snippet. </div><div><br></div><div>WindowLevelStyle = vtkSmartPointer<vtkInteractorStyleImage>::New();<br></div><div>WindowLevelStyle->AddObserver(vtkCommand::WindowLevelEvent, callback);<br></div><div><br></div>callback:<br><br><div><div>class vtkImageInteractionCallback : public vtkCommand</div><div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre"> </span>public:</div><div><span class="" style="white-space:pre"> </span>static vtkImageInteractionCallback *New()</div><div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre"> </span>return new vtkImageInteractionCallback;</div><div><span class="" style="white-space:pre"> </span>}<span style="white-space:pre"> </span></div><div><br></div><div><span class="" style="white-space:pre"> </span>vtkImageInteractionCallback()</div><div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre"> </span>this->interactor = NULL;</div><div><span class="" style="white-space:pre"> </span>this->volumeProperty = NULL;</div><div><span class="" style="white-space:pre"> </span>this->compositeOpacity = NULL;</div><div><span class="" style="white-space:pre"> </span>this->color = NULL;</div><div><span class="" style="white-space:pre"> </span>this->volume = NULL;</div><div><span class="" style="white-space:pre"> </span>this->mapper = NULL;</div><div><span class="" style="white-space:pre"> </span>this->renderwin = NULL;</div><div><span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span>}</div><div><br></div><div><span class="" style="white-space:pre"> </span>~vtkImageInteractionCallback()</div><div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre"> </span>this->interactor = NULL;</div><div><span class="" style="white-space:pre"> </span>this->volumeProperty = NULL;</div><div><span class="" style="white-space:pre"> </span>this->compositeOpacity = NULL;</div><div><span class="" style="white-space:pre"> </span>this->color = NULL;</div><div><span class="" style="white-space:pre"> </span>this->volume = NULL;</div><div><span class="" style="white-space:pre"> </span>this->mapper = NULL;</div><div><span class="" style="white-space:pre"> </span>}</div><div><br></div><div><span class="" style="white-space:pre"> </span>void SetInteractor(vtkRenderWindowInteractor *_interactor)</div><div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre"> </span>this->interactor = _interactor;</div><div><span class="" style="white-space:pre"> </span>}</div><div><br></div><div><span class="" style="white-space:pre"> </span>void SetVolumeProperty(vtkSmartPointer<vtkVolumeProperty> _volumeProperty)</div><div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre"> </span>this->volumeProperty = _volumeProperty;</div><div><span class="" style="white-space:pre"> </span>}</div><div><br></div><div><span class="" style="white-space:pre"> </span>void SetCompositeOpacity(vtkSmartPointer<vtkPiecewiseFunction> _compositeOpacity)</div><div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre"> </span>this->compositeOpacity = _compositeOpacity;</div><div><span class="" style="white-space:pre"> </span>}</div><div><span class="" style="white-space:pre"> </span>void Setcolor(vtkSmartPointer<vtkColorTransferFunction> _color)</div><div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre"> </span>this->color = _color;</div><div><span class="" style="white-space:pre"> </span>}</div><div><br></div><div><span class="" style="white-space:pre"> </span>void Setvolume(vtkSmartPointer<vtkVolume> _volume)</div><div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre"> </span>this->volume = _volume;</div><div><span class="" style="white-space:pre"> </span>}</div><div><span class="" style="white-space:pre"> </span>void Setmapper(vtkSmartPointer<vtkFixedPointVolumeRayCastMapper>_mapper)</div><div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre"> </span>this->mapper = _mapper;</div><div><span class="" style="white-space:pre"> </span>}</div><div><span class="" style="white-space:pre"> </span>void SetRenWin(vtkRenderWindow* _renderwin)</div><div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre"> </span>this->renderwin = _renderwin;</div><div><span class="" style="white-space:pre"> </span>}</div><div><br></div><div><span class="" style="white-space:pre"> </span>virtual void Execute(vtkObject *, unsigned long vtkNotUsed(event), void *)</div><div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre"> </span>vtkRenderWindowInteractor *interactor = this->renderwin->GetInteractor();</div><div><span class="" style="white-space:pre"> </span>vtkInteractorStyleImage *style = vtkInteractorStyleImage::SafeDownCast(interactor->GetInteractorStyle());</div><div><br></div><div><span class="" style="white-space:pre"> </span>this->mapper->AutoAdjustSampleDistancesOff();<span class="" style="white-space:pre"> </span></div><div><br></div><div><span class="" style="white-space:pre"> </span>int *w=new int[2];</div><div><span class="" style="white-space:pre"> </span>w=style->GetWindowLevelCurrentPosition();<span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> i</span>nt windowWidth = w[0];</div><div><span class="" style="white-space:pre"> </span>int windowLevel = w[1];</div><div><br></div><div><br></div><div> <i><b> </b><span style="background-color:rgb(255,255,255)">I want to modify the color transfer function and opacity transfer functions here in which volume transition has to happen </span></i><i style="background-color:rgb(255,255,255)">from CT skin to bone as mouse+move on volume window. Don't know what/how LUTs I have to set here. Kindly suggest me how can I do this.</i></div><div><br></div><div> //color->RemoveAllPoints();</div><div> // color->AddRGBpoint(args);</div><div> </div><div> // compositeOpacity->RemoveAllPoints();</div><div> //compositeOpacity->AddPoint(args);<span style="white-space:pre"> </span></div><div><br></div><div><span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span>this->renderwin->Render();</div><div><span class="" style="white-space:pre"> </span>}</div><div><br></div><div><span class="" style="white-space:pre"> </span>private:</div><div><span class="" style="white-space:pre"> </span>vtkRenderWindowInteractor *interactor; </div><div><span class="" style="white-space:pre"> </span>vtkRenderWindow* renderwin;</div><div><span class="" style="white-space:pre"> </span>vtkVolumeProperty* volumeProperty;</div><div><span class="" style="white-space:pre"> </span>vtkPiecewiseFunction* compositeOpacity;</div><div><span class="" style="white-space:pre"> </span>vtkColorTransferFunction* color;</div><div><span class="" style="white-space:pre"> </span>vtkVolume* volume;<span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span>vtkFixedPointVolumeRayCastMapper*mapper;</div><div><span class="" style="white-space:pre"> </span>double table[257][3];</div><div><span class="" style="white-space:pre"> </span>};</div></div><div><br></div><div>Thank you</div><div><br></div><div>Regards,</div><div>Mallikarjun</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 25, 2015 at 2:48 AM, Aashish Chaudhary <span dir="ltr"><<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Right you are already using what Sankhesh suggested you. So what prevents you from changing the transfer function if you are getting the callback? <span class="HOEnZb"><font color="#888888"><div><br></div><div>- Aashish</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 24, 2015 at 1:09 AM, Mallikarjun K <span dir="ltr"><<a href="mailto:mallikarjun49@gmail.com" target="_blank">mallikarjun49@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Sankhesh,<div>Thanks for your suggestions. Actually I want to modify the existing color transfer function and Opacity transfer function interactively on left mouse+move on the volume.</div><div><br></div><div>Thank you</div><div><br></div><div>With Kind Regards,</div><div>Mallikarjun</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 24, 2015 at 3:06 AM, Sankhesh Jhaveri <span dir="ltr"><<a href="mailto:sankhesh.jhaveri@kitware.com" target="_blank">sankhesh.jhaveri@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small"><font face="verdana, sans-serif" style="color:rgb(11,83,148)">Hello </font><span style="font-size:12.8px"><font face="verdana, sans-serif" color="#0b5394">Mallikarjuna,</font></span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><font face="verdana, sans-serif" color="#0b5394"><br></font></span></div><div class="gmail_default"><font color="#0b5394" face="verdana, sans-serif"><span style="font-size:12.8px">vtkInteractorStyleImage provides events for window level changes. See: <a href="http://www.vtk.org/doc/nightly/html/classvtkInteractorStyleImage.html" target="_blank">http://www.vtk.org/doc/nightly/html/classvtkInteractorStyleImage.html</a></span></font></div><div class="gmail_default"><font color="#0b5394" face="verdana, sans-serif"><span style="font-size:12.8px"><br></span></font></div><div class="gmail_default"><font color="#0b5394" face="verdana, sans-serif"><span style="font-size:12.8px">You can add an observer to the vtkCommand::WindowLevelEvent or vtkCommand::EndWindowLevelEvent and change the functions as you like. On a side note, if all you are changing is the window width and level, you can just pass those values to vtkFixedPointVolumeRayCastMapper::SetFinalColorWindow() and SetFinalColorLevel(). </span></font></div><div class="gmail_default"><font color="#0b5394" face="verdana, sans-serif"><span style="font-size:12.8px"><br></span></font></div><div class="gmail_default"><font color="#0b5394" face="verdana, sans-serif"><span style="font-size:12.8px">Hope that helps.</span></font></div><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><span style="color:rgb(11,83,148);font-family:verdana,sans-serif"><br></span></div><div><span style="color:rgb(11,83,148);font-family:verdana,sans-serif">Warm regards,</span><br></div><span style="color:rgb(11,83,148)"><span style="font-family:verdana,sans-serif">Sankhesh</span></span><div><b></b><br> </div></div></div></div></div></div></div></div></div></div></div><div><div>
<br><div class="gmail_quote">On Wed, Sep 23, 2015 at 2:48 PM, Mallikarjun K <span dir="ltr"><<a href="mailto:mallikarjun49@gmail.com" target="_blank">mallikarjun49@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Aashish,<div><br></div><div>I have created a simple program which does volume rendering using vtkfixedpointraycastmapper. Now what I am trying to achieve is that when I change the window/level by left mouse click+drag on the renderwindow, then want to change the color volume characteristics by means of window/level.</div><div><br></div><div>I used vtkInteractorstyleimage interactor style to change the window/level on left mouse click+drag and in a call back I am getting the window and level using vtkInteractorStyleImage::GetWindowLevelCurrentPosition. Based on these w/l I want to change/modify the color transferfunction and opacity transfer function.</div><div><br></div><div>please can you suggest me how can I achieve it.</div><div><br></div><div>Thank you in advance.</div><div><br></div><div><br></div></div><div class="gmail_extra"><div><div><br><div class="gmail_quote">On Wed, Sep 23, 2015 at 11:23 PM, Aashish Chaudhary <span dir="ltr"><<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Can you describe more in detail what you are trying to do? We have piecewise method for transfer functions. What value you set for each step depends on what is needed. <div><br></div><div>- aashsih</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Tue, Sep 22, 2015 at 12:28 AM, Mallikarjun K <span dir="ltr"><<a href="mailto:mallikarjun49@gmail.com" target="_blank">mallikarjun49@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div><br></div><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><span style="font-family:tahoma,sans-serif"></span><div>Hi Everyone,</div><div><br></div><div>How can I set color transfer function and opacity transfer function based on window width and window level ?</div><div><br></div><div><br></div><div><br></div><div>Thanks in advance..</div><div><br></div><div>Regards,</div><div>Mallikarjun</div></div></div></div></div></div></div>
</div>
<br></div></div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><font face="trebuchet ms, sans-serif"><i>| Aashish Chaudhary <br>| Technical Leader <br>| Kitware Inc. <br></i></font><div><i><font face="trebuchet ms, sans-serif">| </font><a href="http://www.kitware.com/company/team/chaudhary.html" target="_blank">http://www.kitware.com/company/team/chaudhary.html</a></i></div></div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span><font color="#888888">-- <br><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><b style="font-family:tahoma,sans-serif">With Kind Regards:</b><br style="font-family:tahoma,sans-serif"><span style="font-family:tahoma,sans-serif">Mallikarjuna K,</span></div><div dir="ltr"><font face="tahoma, sans-serif"><a href="tel:07795531103" value="+917795531103" target="_blank">07795531103</a>/<a href="tel:09908238861" value="+919908238861" target="_blank">09908238861</a>.<br></font><span style="font-family:tahoma,sans-serif"></span><div><br></div></div></div></div></div></div></div>
</font></span></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><b style="font-family:tahoma,sans-serif">With Kind Regards:</b><br style="font-family:tahoma,sans-serif"><span style="font-family:tahoma,sans-serif">Mallikarjuna K,</span></div><div dir="ltr"><font face="tahoma, sans-serif"><a href="tel:07795531103" value="+917795531103" target="_blank">07795531103</a>/<a href="tel:09908238861" value="+919908238861" target="_blank">09908238861</a>.<br></font><span style="font-family:tahoma,sans-serif"></span><div><br></div></div></div></div></div></div></div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><font face="trebuchet ms, sans-serif"><i>| Aashish Chaudhary <br>| Technical Leader <br>| Kitware Inc. <br></i></font><div><i><font face="trebuchet ms, sans-serif">| </font><a href="http://www.kitware.com/company/team/chaudhary.html" target="_blank">http://www.kitware.com/company/team/chaudhary.html</a></i></div></div></div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><b style="font-family:tahoma,sans-serif">With Kind Regards:</b><br style="font-family:tahoma,sans-serif"><span style="font-family:tahoma,sans-serif">Mallikarjuna K,</span></div><div dir="ltr"><font face="tahoma, sans-serif">07795531103/09908238861.<br></font><span style="font-family:tahoma,sans-serif"></span><div><br></div></div></div></div></div></div></div>
</div>