001/** 002 * 003 */ 004package icy.vtk; 005 006import icy.image.lut.LUT; 007import icy.image.lut.LUT.LUTChannel; 008 009import java.awt.Color; 010 011import vtk.vtkColorTransferFunction; 012import vtk.vtkPiecewiseFunction; 013 014/** 015 * Class to represent a 3D binary image as a 3D VTK volume object. 016 * 017 * @author Stephane 018 */ 019public class VtkBinaryVolume extends VtkImageVolume 020{ 021 /** 022 * Always single channel here 023 */ 024 @Override 025 protected int getChannelCount() 026 { 027 return 1; 028 } 029 030 /** 031 * Set the color of the binary volume. 032 */ 033 public void setColor(Color value) 034 { 035 volumeProperty.SetColor(VtkUtil.getBinaryColorMap(value)); 036 } 037 038 /** 039 * Set the opacity of the binary volume. 040 */ 041 public void setOpacity(double value) 042 { 043 volumeProperty.SetScalarOpacity(VtkUtil.getBinaryOpacityMap(value)); 044 } 045 046 /** 047 * @deprecated Use {@link #setColor(Color)} instead. 048 */ 049 @Override 050 @Deprecated 051 public void setColorMap(vtkColorTransferFunction map, int channel) 052 { 053 // done nothing here 054 } 055 056 /** 057 * @deprecated Use {@link #setOpacity(double)} instead. 058 */ 059 @Override 060 @Deprecated 061 public void setOpacityMap(vtkPiecewiseFunction map, int channel) 062 { 063 // done nothing here 064 } 065 066 /** 067 * @deprecated Use {@link #setColor(Color)} and {@link #setOpacity(double)} instead. 068 */ 069 @Override 070 @Deprecated 071 public void setLUT(LUT value) 072 { 073 // done nothing here 074 } 075 076 /** 077 * @deprecated Use {@link #setColor(Color)} and {@link #setOpacity(double)} instead. 078 */ 079 @Override 080 @Deprecated 081 public void setLUT(LUTChannel lutChannel, int channel) 082 { 083 // done nothing here 084 } 085 086 /** 087 * Enable / Disable the shading (global) 088 */ 089 @Override 090 public void setShade(boolean value) 091 { 092 volumeProperty.SetShade(value ? 1 : 0); 093 } 094 095 /** 096 * Sets the ambient lighting coefficient (global) 097 */ 098 @Override 099 public void setAmbient(double value) 100 { 101 volumeProperty.SetAmbient(value); 102 } 103 104 /** 105 * Sets the diffuse lighting coefficient (global) 106 */ 107 @Override 108 public void setDiffuse(double value) 109 { 110 volumeProperty.SetDiffuse(value); 111 } 112 113 /** 114 * Sets the specular lighting coefficient (global) 115 */ 116 @Override 117 public void setSpecular(double value) 118 { 119 volumeProperty.SetSpecular(value); 120 } 121 122 /** 123 * Sets the specular power (global) 124 */ 125 @Override 126 public void setSpecularPower(double value) 127 { 128 volumeProperty.SetSpecularPower(value); 129 } 130}