Package sc.fiji.snt.viewer
Class OBJMesh
java.lang.Object
sc.fiji.snt.viewer.OBJMesh
An OBJMesh stores information about a Wavefront .obj mesh loaded
into
Viewer3D, with access points to its OBJFile and
DrawableVBO- Author:
- Tiago Ferreira
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected sc.fiji.snt.viewer.OBJMesh.RemountableDrawableVBOprotected sc.fiji.snt.viewer.OBJMesh.OBJFileLoaderPlusstatic final intShading mode: jzy3d fixed-function rendering (default).static final intShading mode: per-fragment Phong lighting with hemispherical ambient (GLSL 1.20).protected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncomputePrincipalAxes(String hemiHalf) Computes the principal axes of this mesh using the new PCAnalyzer.doublegetAngleWithLocalDirection(SNTPoint point, double[] direction, String hemiHalf, int neighborCount) Computes the angle between a direction vector and the local mesh direction at a point.getBoundingBox(String hemiHalf) Gets the minimum bounding box of this mesh.getCentroid(String hemihalf) Returns the spatial centroid of the specified (hemi)mesh.Returns the currently displayed hemisphere: "left", "right", or "both".org.jzy3d.plot3d.primitives.vbo.drawable.DrawableVBOReturns theDrawableVBOassociated with this meshgetLabel()Deprecated.double[]getLocalDirection(SNTPoint point, String hemiHalf, int neighborCount) Computes the local direction of the mesh at a specific point using nearest neighbor analysis.org.jzy3d.io.obj.OBJFilegetObj()Returns theOBJFileassociated with this meshgetPrincipalAxes(String hemiHalf) Computes the principal axes of the mesh using Principal Component Analysis (PCA).Returns theBrainAnnotation(atlas compartment) from which this mesh was retrieved, or null if this mesh was loaded from a standalone file.intCollection<? extends SNTPoint> Returns the mesh vertices.Collection<? extends SNTPoint> getVertices(String hemihalf) Returns the mesh vertices.doubleGets the volume of this mesh.label()Gets this mesh label.voidsetBoundingBoxColor(String boundingBoxColor) Determines whether the mesh bounding box should be displayed.voidsetBoundingBoxColor(org.scijava.util.ColorRGB boundingBoxColor) Determines whether the mesh bounding box should be displayed.voidScript friendly method to assign a color to the mesh.voidsetColor(org.scijava.util.ColorRGB color, double transparencyPercent) Assigns a color to the mesh.voidsetDisplayedHemisphere(String hemiHalf) Sets which hemisphere of this mesh is displayed.voidSets the label for this mesh.voidsetSourceAnnotation(BrainAnnotation annotation) Associates this mesh with theBrainAnnotation(atlas compartment) it was retrieved from.voidsetSymmetryAxis(int axis) Sets the axis defining the symmetry plane of this mesh (e.g., the sagittal plane for most bilateria models), where X=0; Y=1; Z=2;voidsetTransparency(double transparencyPercent) Changes the transparency of this mesh.voidsetVolume(double volume) Sets the volume of this mesh.voidTranslates the vertices of this mesh by the specified offset.
-
Field Details
-
SHADING_DEFAULT
public static final int SHADING_DEFAULTShading mode: jzy3d fixed-function rendering (default).- See Also:
-
SHADING_SMOOTH
public static final int SHADING_SMOOTHShading mode: per-fragment Phong lighting with hemispherical ambient (GLSL 1.20).- See Also:
-
loader
protected sc.fiji.snt.viewer.OBJMesh.OBJFileLoaderPlus loader -
drawable
protected sc.fiji.snt.viewer.OBJMesh.RemountableDrawableVBO drawable -
unit
-
-
Constructor Details
-
OBJMesh
Instantiates a new wavefront OBJ mesh from a file path/URL.- Parameters:
filePath- the absolute path to the .OBJ file to be imported. URL representations accepted- Throws:
IllegalArgumentException- if filePath is invalid or file does not contain a compilable mesh
-
OBJMesh
-
-
Method Details
-
setSymmetryAxis
public void setSymmetryAxis(int axis) Sets the axis defining the symmetry plane of this mesh (e.g., the sagittal plane for most bilateria models), where X=0; Y=1; Z=2; -
getSymmetryAxis
public int getSymmetryAxis() -
getSourceAnnotation
Returns theBrainAnnotation(atlas compartment) from which this mesh was retrieved, or null if this mesh was loaded from a standalone file.- Returns:
- the source annotation, or null
-
setSourceAnnotation
Associates this mesh with theBrainAnnotation(atlas compartment) it was retrieved from.- Parameters:
annotation- the source annotation
-
setDisplayedHemisphere
Sets which hemisphere of this mesh is displayed.- Parameters:
hemiHalf- "left" (or "l", "1"), "right" (or "r", "2"), or anything else for both hemispheres
-
getDisplayedHemisphere
Returns the currently displayed hemisphere: "left", "right", or "both".- Returns:
- the displayed hemisphere
-
duplicate
-
translate
Translates the vertices of this mesh by the specified offset. If mesh is displayed, changes may only occur once scene is rebuilt.- Parameters:
offset- the translation offset
-
setColor
Script friendly method to assign a color to the mesh.- Parameters:
color- the color to render the imported file, either a 1) HTML color codes starting with hash (#), a color preset ("red", "blue", etc.), or integer triples of the formr,g,band range[0, 255]transparencyPercent- the color transparency (in percentage)
-
setColor
public void setColor(org.scijava.util.ColorRGB color, double transparencyPercent) Assigns a color to the mesh.- Parameters:
color- the color to render the imported filetransparencyPercent- the color transparency (in percentage)
-
setTransparency
public void setTransparency(double transparencyPercent) Changes the transparency of this mesh.- Parameters:
transparencyPercent- the mesh transparency (in percentage).
-
setBoundingBoxColor
public void setBoundingBoxColor(org.scijava.util.ColorRGB boundingBoxColor) Determines whether the mesh bounding box should be displayed.- Parameters:
boundingBoxColor- the color of the mesh bounding box. If null, no bounding box is displayed
-
setBoundingBoxColor
Determines whether the mesh bounding box should be displayed.- Parameters:
boundingBoxColor- the color of the mesh bounding box, either a 1) HTML color codes starting with hash (#), a color preset ("red", "blue", etc.), or integer triples of the formr,g,band range[0, 255]. If null, or if string does not encode a valid color, no bounding box is displayed
-
getBoundingBox
Gets the minimum bounding box of this mesh.- Parameters:
hemiHalf- either "left", "l", "right", "r" otherwise bounding box is retrieved for both hemi-halves, i.e., the full mesh. It is ignored if a hemisphere was already specified in the constructor.- Returns:
- the minimum bounding box
-
getLabel
Deprecated.uselabelinstead -
label
Gets this mesh label. -
setLabel
Sets the label for this mesh.- Parameters:
label- the label to set
-
setVolume
public void setVolume(double volume) Sets the volume of this mesh.- Parameters:
volume- the volume to set
-
getVolume
public double getVolume()Gets the volume of this mesh.- Returns:
- the mesh volume
-
getVertices
Returns the mesh vertices.- Returns:
- the mesh vertices as
SNTPoints
-
getVertices
Returns the mesh vertices.- Parameters:
hemihalf- either "left", "l", "right", "r" otherwise centroid is retrieved for both hemi-halves, i.e., the full mesh- Returns:
- the mesh vertices as
SNTPoints
-
getCentroid
Returns the spatial centroid of the specified (hemi)mesh.- Parameters:
hemihalf- either "left", "l", "right", "r", otherwise centroid is retrieved for both hemi-halves, i.e., the full mesh- Returns:
- the SNT point defining the (X,Y,Z) center of the (hemi)mesh.
-
getPrincipalAxes
Computes the principal axes of the mesh using Principal Component Analysis (PCA). The principal axes represent the directions of maximum, medium, and minimum variance in the mesh geometry, providing insight into the overall shape orientation of this mesh.- Parameters:
hemiHalf- either "left", "l", "right", "r", otherwise principal axes are computed for both hemi-halves, i.e., the full mesh- Returns:
- array of three PrincipalAxis objects ordered by decreasing variance (primary, secondary, tertiary), or null if computation fails
-
computePrincipalAxes
Computes the principal axes of this mesh using the new PCAnalyzer. This method replaces the deprecatedgetPrincipalAxes(String)method.- Parameters:
hemiHalf- either "left", "l", "right", "r", otherwise principal axes are computed for both hemi-halves, i.e., the full mesh- Returns:
- array of three PrincipalAxis objects ordered by decreasing variance (primary, secondary, tertiary), or null if computation fails
-
getLocalDirection
Computes the local direction of the mesh at a specific point using nearest neighbor analysis. This method finds the dominant direction of mesh curvature in the local neighborhood of the specified point, which is useful for analyzing how structures align with curved anatomical surfaces.- Parameters:
point- the point at which to compute the local mesh directionhemiHalf- either "left", "l", "right", "r", otherwise analysis is performed on both hemi-halves, i.e., the full meshneighborCount- the number of nearest mesh vertices to use for local analysis (default: 20)- Returns:
- the local mesh direction as a normalized vector, or null if computation fails
-
getAngleWithLocalDirection
public double getAngleWithLocalDirection(SNTPoint point, double[] direction, String hemiHalf, int neighborCount) Computes the angle between a direction vector and the local mesh direction at a point. This is useful for e.g., analyzing how neuronal processes align with the local curvature of surfaces (neuropil meshes).- Parameters:
point- the point at which to compute the local mesh directiondirection- the normalized vector for which the angle will be computedhemiHalf- either "left", "l", "right", "r", otherwise analysis is performed on both hemi-halves, i.e., the full meshneighborCount- the number of nearest mesh vertices to use for local analysis- Returns:
- the acute angle in degrees (0-90°) between the direction vector and local mesh direction, or NaN if computation fails
-
getObj
public org.jzy3d.io.obj.OBJFile getObj()Returns theOBJFileassociated with this mesh- Returns:
- the OBJFile
-
getDrawable
public org.jzy3d.plot3d.primitives.vbo.drawable.DrawableVBO getDrawable()Returns theDrawableVBOassociated with this mesh- Returns:
- the DrawableVBO
-
labelinstead