No subject


Mon Aug 10 18:29:21 EDT 2009


a .4 contribution. A SpecularPower of 100 will give very small
highlights of the Specular color.

A description of this type of shading is given here:
http://en.wikipedia.org/wiki/Phong_shading

In summary, your picture corresponds to your property settings.

Since the bone is represented by a single isosurface, that surface can
only have "one color".

I suggest you study the wikipedia article and experiment by varying
each parameter individually.



On Tue, Oct 6, 2009 at 10:29 AM, Gururajan.R <gururajan.r at raster.in> wrote:
> Bill
>
>
> Please find the below actor coding
>
> Thanks for your kind effort
> =A0 =A0vtkLODActor boneActor =3D new vtkLODActor();
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//vtkActor boneActor =3D new vtkActor();
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0boneActor.SetNumberOfCloudPoints(500000);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0boneActor.SetMapper(geobonemapper);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0boneActor.GetProperty().SetColor(0.75,0.5,=
0.75);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0boneActor.GetProperty().SetAmbientColor(.7=
5, .10, .25);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0boneActor.GetProperty().SetDiffuseColor(0.=
75, .04, .025);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0boneActor.GetProperty().BackfaceCullingOn(=
);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0boneActor.GetProperty().EdgeVisibilityOn()=
;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0boneActor.GetProperty().FrontfaceCullingOn=
();
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0boneActor.GetProperty().GlobalWarningDispl=
ayOn();
>
> boneActor.GetProperty().SetColor(boneActor.GetProperty().GetColor());
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0boneActor.GetProperty().SetOpacity(0.75);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0boneActor.GetProperty().SetSpecularPower(1=
00);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0boneActor.GetProperty().SetDiffuse(0.75);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0boneActor.GetProperty().SetSpecular(.4)
>
>
> Thanks
> Guru
> Bill Lorensen wrote:
>> Show me the exact actor portion of code that produced this image.
>>
>> On Tue, Oct 6, 2009 at 2:46 AM, Gururajan.R <gururajan.r at raster.in> wrot=
e:
>>
>>> Bill
>>> Please find the attached image for your kind view
>>> Thanks
>>> Guru
>>>
>>>
>>> Bill Lorensen wrote:
>>>
>>>> This version of the code does not set the colors (they are commented
>>>> out) of the parts and some of the diffuse and specular values still
>>>> are > 1.0!
>>>>
>>>> One last chance, please send the code with the corrections I sent
>>>> before. Run the program and send to me (not the list) a screenshot of
>>>> the results.
>>>>
>>>> Bill
>>>>
>>>> On Mon, Oct 5, 2009 at 10:26 AM, Gururajan.R <gururajan.r at raster.in> w=
rote:
>>>>
>>>>
>>>>> bill
>>>>>
>>>>> for your kind view i have pasted my entire programme,.
>>>>>
>>>>>
>>>>> thanks
>>>>> guru
>>>>>
>>>>>
>>>>> //
>>>>> package in.raster.viewer.component;
>>>>> import in.raster.viewer.component.VolumeRenderWithBoxWidget.MyVtkCanv=
as;
>>>>>
>>>>> import java.awt.*;
>>>>> import java.awt.event.*;
>>>>>
>>>>> import javax.swing.*;
>>>>>
>>>>> import vtk.*;
>>>>>
>>>>> public class Cubes extends JPanel implements ActionListener {
>>>>> =A0 =A0/**
>>>>> =A0 =A0 *
>>>>> =A0 =A0 */
>>>>> =A0 =A0private static final long serialVersionUID =3D 1L;
>>>>> =A0 =A0static JFrame frame;
>>>>> =A0 =A0//vtkPanel renWin;
>>>>> =A0 =A0JButton exitButton;
>>>>> =A0 =A0MyVtkCanvas renWin;
>>>>> =A0 =A0vtkBoxWidget boxWidget;
>>>>> =A0 =A0vtkVolumeRayCastMapper volumeMapper;
>>>>> =A0 =A0vtkPlanes planes;
>>>>> =A0 =A0int intwinHeight=3D300;
>>>>> =A0 =A0int intwinWidth =3D 300;
>>>>>
>>>>>
>>>>> =A0 =A0public Cubes() {
>>>>> =A0 =A0 =A0 =A0{
>>>>> =A0 =A0 =A0 =A0 =A0 =A0System.loadLibrary("vtkCommonJava");
>>>>> =A0 =A0 =A0 =A0 =A0 =A0System.loadLibrary("vtkFilteringJava");
>>>>> =A0 =A0 =A0 =A0 =A0 =A0System.loadLibrary("vtkIOJava");
>>>>> =A0 =A0 =A0 =A0 =A0 =A0System.loadLibrary("vtkImagingJava");
>>>>> =A0 =A0 =A0 =A0 =A0 =A0System.loadLibrary("vtkGraphicsJava");
>>>>> =A0 =A0 =A0 =A0 =A0 =A0System.loadLibrary("vtkRenderingJava");
>>>>> =A0 =A0 =A0 =A0 =A0 =A0System.loadLibrary("vtkVolumeRenderingJava");
>>>>> =A0 =A0 =A0 =A0}
>>>>>
>>>>> =A0 =A0setLayout(new BorderLayout());
>>>>> =A0 =A0 =A0 =A0vtkDICOMImageReader dicomreader =3D new vtkDICOMImageR=
eader();
>>>>> =A0 =A0 =A0 =A0dicomreader.SetDirectoryName("/home/guru/Desktop/3D/CO=
U IV");
>>>>> =A0 =A0 =A0 =A0dicomreader.SetFileNameSliceOffset(1);
>>>>> =A0 =A0 =A0 =A0dicomreader.SetFileNameSliceSpacing(1);
>>>>> =A0 =A0 =A0 =A0dicomreader.SetDataExtent(0,511,0,511,0,224);
>>>>> =A0 =A0 =A0 =A0dicomreader.SetDataSpacing(360.0/512,360.0/512,1.0);
>>>>> =A0 =A0 =A0 =A0dicomreader.SetDataOrigin(0,0,0);
>>>>> =A0 =A0 =A0 =A0dicomreader.Update();
>>>>> =A0 =A0 =A0 =A0//for skin and bone Diagram
>>>>> =A0 =A0 =A0 =A0 =A0 =A0//For setting Bone Colour
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0vtkMarchingCubes bone =3D new =
vtkMarchingCubes();
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bone.SetInput(dicomreader.GetO=
utput());
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bone.SetValue(0, 120);
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bone.ComputeNormalsOn();
>>>>>
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0vtkGeometryFilter =A0geovolumebone =3D=
 new vtkGeometryFilter();
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0geovolumebone.SetInput(bone.GetOutput(=
));
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0vtkPolyDataMapper =A0geobonemapper =3D=
 new vtkPolyDataMapper();
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0geobonemapper.SetInput(geovolumebone.G=
etOutput());
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0geobonemapper.ScalarVisibilityOff();
>>>>>
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//vtkLODActor boneActor =3D new vtkLOD=
Actor();
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0vtkActor boneActor =3D new vtkActor();
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//boneActor.SetNumberOfCloudPoints(100=
000);
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0boneActor.SetMapper(geobonemapper);
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//boneActor.GetProperty().SetColor(0.7=
5,0.5,0.75);
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0boneActor.GetProperty().SetOpacity(0.7=
5);
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0boneActor.GetProperty().SetSpecularPow=
er(100);
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0boneActor.GetProperty().SetDiffuse(1.7=
5);
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0boneActor.GetProperty().SetSpecular(1.=
75);
>>>>> =A0 =A0 =A0 =A0 =A0 =A0//For setting Bone Colour
>>>>>
>>>>> =A0 =A0 =A0 =A0 =A0 =A0//For setting Skin Colour
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0vtkMarchingCubes skin =3D new vtkMarch=
ingCubes();
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0skin.SetInput(dicomreader.GetOutput())=
;
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0skin.SetValue(0, -300);
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0skin.ComputeNormalsOn();
>>>>>
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0vtkGeometryFilter geovolumeSkin =3D ne=
w vtkGeometryFilter();
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0geovolumeSkin.SetInput(skin.GetOutput(=
));
>>>>>
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0vtkPolyDataMapper skinmapper =3D new v=
tkPolyDataMapper();
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0skinmapper.SetInput(geovolumeSkin.GetO=
utput());
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0skinmapper.ScalarVisibilityOff();
>>>>>
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//vtkActor actorskin =3D new vtkActor(=
);
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0vtkLODActor actorskin =3D new vtkLODAc=
tor();
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0actorskin.SetNumberOfCloudPoints(10000=
0);
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0actorskin.SetMapper(skinmapper);
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0actorskin.GetProperty().SetSpecularPow=
er(100);
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0actorskin.GetProperty().SetDiffuse(1.7=
5);
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0actorskin.GetProperty().SetSpecular(1.=
75);
>>>>>
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//actorskin.GetProperty().SetColor(1, =
0.547237, 0.319073);
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//actorskin.GetProperty().SetColor(0.7=
5,0.75, 0.75);
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0actorskin.GetProperty().SetSpecularPow=
er(100);
>>>>>
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0actorskin.GetProperty().SetOpacity(1);
>>>>> =A0 =A0 =A0 =A0 =A0 =A0//For setting Skin Colour
>>>>>
>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0vtkCamera camera =3D new vtkCamera=
();
>>>>>
>>>>> =A0 =A0 =A0 =A0//for skin and bone Diagram
>>>>> =A0 =A0 =A0 =A0vtkRenderer render =3D new vtkRenderer();
>>>>> =A0 =A0 =A0 =A0vtkRenderWindow renwindow =3D new vtkRenderWindow();
>>>>> =A0 =A0 =A0 =A0renwindow.AddRenderer(render);
>>>>>
>>>>> =A0 =A0 =A0 =A0vtkRenderWindowInteractor renintec =3D new
>>>>> vtkRenderWindowInteractor();
>>>>> =A0 =A0 =A0 =A0renintec.SetRenderWindow(renwindow);
>>>>>
>>>>> =A0 =A0 =A0 =A0 =A0//render.AddActor(actorskin);
>>>>> =A0 =A0 =A0 =A0 =A0render.AddActor(boneActor);
>>>>> =A0 =A0 =A0 =A0 =A0render.SetActiveCamera(camera);
>>>>> =A0 =A0 =A0 =A0 =A0render.ResetCamera();
>>>>> =A0 =A0 =A0 =A0 =A0render.SetBackground(0, 0, 0);
>>>>> =A0 =A0 =A0 =A0 =A0renwindow.BordersOff();
>>>>> =A0 =A0 =A0 =A0 =A0renwindow.FullScreenOn();
>>>>> =A0 =A0 =A0 =A0 =A0renwindow.SetSize(intwinWidth,intwinHeight);
>>>>>
>>>>> =A0 =A0 =A0 =A0renwindow.Render();
>>>>> =A0 =A0 =A0 =A0render.ResetCamera();
>>>>> =A0 =A0 =A0 =A0renintec.Start();
>>>>>
>>>>> =A0 =A0}
>>>>>
>>>>>
>>>>> =A0 =A0/** An ActionListener that listens to the radio buttons. */
>>>>> =A0public void actionPerformed(ActionEvent e) {
>>>>> =A0 =A0 =A0 =A0if (e.getSource().equals(exitButton)) {
>>>>> =A0 =A0 =A0 =A0 =A0 =A0System.exit(0);
>>>>> =A0 =A0 =A0 =A0}
>>>>> =A0 =A0}
>>>>>
>>>>> =A0 =A0public static void main(String s[]) {
>>>>> =A0 =A0 =A0 =A0Cubes panel =3D new Cubes();
>>>>> =A0 =A0}
>>>>> }
>>>>>
>>>>>
>>>>>
>>>
>
>


More information about the vtkusers mailing list