Skip to content

Commit

Permalink
feat: changes to how atlas and primitive mesh handle individual objec…
Browse files Browse the repository at this point in the history
…t data
  • Loading branch information
dbirman committed Mar 27, 2024
1 parent bec48cf commit c4a9931
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 16 deletions.
8 changes: 1 addition & 7 deletions models/csharp/urchin/AtlasModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ public struct AtlasModel
{
public string Name;
public Vector3 ReferenceCoord;
public string[] Acronyms;
public bool[] Visible;
public Color[] Colors;
public int[] Sides;
public StructureModel[] Areas;
public string Colormap;
public float[] Intensities;
public float[] Alphas;
public string[] Materials;
}
7 changes: 7 additions & 0 deletions models/csharp/urchin/PrimitiveMeshModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@



public struct PrimitiveMeshModel
{
public MeshModel[] Data;
}
14 changes: 14 additions & 0 deletions models/csharp/urchin/StructureModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

using UnityEngine;

public struct StructureModel
{
public string Name;
public string Acronym;
public int AtlasId;
public bool Visible;
public Color Color;
public float ColorIntensity;
public int Side;
public string Material;
}
2 changes: 1 addition & 1 deletion models/schemas/urchin/AtlasModel.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"$defs": {"Color": {"properties": {"r": {"maximum": 1.0, "minimum": 0.0, "title": "R", "type": "number"}, "g": {"maximum": 1.0, "minimum": 0.0, "title": "G", "type": "number"}, "b": {"maximum": 1.0, "minimum": 0.0, "title": "B", "type": "number"}, "a": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "A", "type": "number"}}, "required": ["r", "g", "b"], "title": "Color", "type": "object"}, "Vector3": {"properties": {"x": {"default": 0.0, "title": "X", "type": "number"}, "y": {"default": 0.0, "title": "Y", "type": "number"}, "z": {"default": 0.0, "title": "Z", "type": "number"}}, "title": "Vector3", "type": "object"}}, "properties": {"Name": {"title": "Name", "type": "string"}, "ReferenceCoord": {"$ref": "#/$defs/Vector3"}, "Acronyms": {"items": {"type": "string"}, "title": "Acronyms", "type": "array"}, "Visible": {"items": {"type": "boolean"}, "title": "Visible", "type": "array"}, "Colors": {"items": {"$ref": "#/$defs/Color"}, "title": "Colors", "type": "array"}, "Sides": {"items": {"type": "integer"}, "title": "Sides", "type": "array"}, "Colormap": {"default": "", "title": "Colormap", "type": "string"}, "Intensities": {"default": [], "items": {"type": "number"}, "title": "Intensities", "type": "array"}, "Alphas": {"items": {"type": "number"}, "title": "Alphas", "type": "array"}, "Materials": {"items": {"type": "string"}, "title": "Materials", "type": "array"}}, "required": ["Name", "ReferenceCoord", "Acronyms", "Visible", "Colors", "Sides", "Alphas", "Materials"], "title": "AtlasModel", "type": "object"}
{"$defs": {"Color": {"properties": {"r": {"maximum": 1.0, "minimum": 0.0, "title": "R", "type": "number"}, "g": {"maximum": 1.0, "minimum": 0.0, "title": "G", "type": "number"}, "b": {"maximum": 1.0, "minimum": 0.0, "title": "B", "type": "number"}, "a": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "A", "type": "number"}}, "required": ["r", "g", "b"], "title": "Color", "type": "object"}, "StructureModel": {"properties": {"Name": {"title": "Name", "type": "string"}, "Acronym": {"title": "Acronym", "type": "string"}, "AtlasId": {"title": "Atlasid", "type": "integer"}, "Visible": {"default": false, "title": "Visible", "type": "boolean"}, "Color": {"allOf": [{"$ref": "#/$defs/Color"}], "default": {"r": 1.0, "g": 0.0, "b": 0.0, "a": 1.0}}, "ColorIntensity": {"default": 0, "title": "Colorintensity", "type": "number"}, "Side": {"default": 0, "title": "Side", "type": "integer"}, "Material": {"default": "default", "title": "Material", "type": "string"}}, "required": ["Name", "Acronym", "AtlasId"], "title": "StructureModel", "type": "object"}, "Vector3": {"properties": {"x": {"default": 0.0, "title": "X", "type": "number"}, "y": {"default": 0.0, "title": "Y", "type": "number"}, "z": {"default": 0.0, "title": "Z", "type": "number"}}, "title": "Vector3", "type": "object"}}, "properties": {"Name": {"title": "Name", "type": "string"}, "ReferenceCoord": {"allOf": [{"$ref": "#/$defs/Vector3"}], "default": null}, "Areas": {"items": {"$ref": "#/$defs/StructureModel"}, "title": "Areas", "type": "array"}, "Colormap": {"default": "", "title": "Colormap", "type": "string"}}, "required": ["Name", "Areas"], "title": "AtlasModel", "type": "object"}
1 change: 1 addition & 0 deletions models/schemas/urchin/PrimitiveMeshModel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"$defs": {"Color": {"properties": {"r": {"maximum": 1.0, "minimum": 0.0, "title": "R", "type": "number"}, "g": {"maximum": 1.0, "minimum": 0.0, "title": "G", "type": "number"}, "b": {"maximum": 1.0, "minimum": 0.0, "title": "B", "type": "number"}, "a": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "A", "type": "number"}}, "required": ["r", "g", "b"], "title": "Color", "type": "object"}, "MeshModel": {"properties": {"ID": {"title": "Id", "type": "string"}, "Shape": {"title": "Shape", "type": "string"}, "Position": {"$ref": "#/$defs/Vector3"}, "Color": {"$ref": "#/$defs/Color"}, "Scale": {"$ref": "#/$defs/Vector3"}, "Material": {"title": "Material", "type": "string"}, "Interactive": {"title": "Interactive", "type": "boolean"}}, "required": ["ID", "Shape", "Position", "Color", "Scale", "Material", "Interactive"], "title": "MeshModel", "type": "object"}, "Vector3": {"properties": {"x": {"default": 0.0, "title": "X", "type": "number"}, "y": {"default": 0.0, "title": "Y", "type": "number"}, "z": {"default": 0.0, "title": "Z", "type": "number"}}, "title": "Vector3", "type": "object"}}, "properties": {"Data": {"items": {"$ref": "#/$defs/MeshModel"}, "title": "Data", "type": "array"}}, "required": ["Data"], "title": "PrimitiveMeshModel", "type": "object"}
1 change: 1 addition & 0 deletions models/schemas/urchin/StructureModel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"$defs": {"Color": {"properties": {"r": {"maximum": 1.0, "minimum": 0.0, "title": "R", "type": "number"}, "g": {"maximum": 1.0, "minimum": 0.0, "title": "G", "type": "number"}, "b": {"maximum": 1.0, "minimum": 0.0, "title": "B", "type": "number"}, "a": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "A", "type": "number"}}, "required": ["r", "g", "b"], "title": "Color", "type": "object"}}, "properties": {"Name": {"title": "Name", "type": "string"}, "Acronym": {"title": "Acronym", "type": "string"}, "AtlasId": {"title": "Atlasid", "type": "integer"}, "Visible": {"default": false, "title": "Visible", "type": "boolean"}, "Color": {"allOf": [{"$ref": "#/$defs/Color"}], "default": {"r": 1.0, "g": 0.0, "b": 0.0, "a": 1.0}}, "ColorIntensity": {"default": 0, "title": "Colorintensity", "type": "number"}, "Side": {"default": 0, "title": "Side", "type": "integer"}, "Material": {"default": "default", "title": "Material", "type": "string"}}, "required": ["Name", "Acronym", "AtlasId"], "title": "StructureModel", "type": "object"}
22 changes: 14 additions & 8 deletions src/vbl_aquarium/models/urchin.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,20 @@ class CustomMeshModel(VBLBaseModel):

class AtlasModel(VBLBaseModel):
name: str
reference_coord: Vector3
acronyms: List[str]
visible: List[bool]
colors: List[Color]
sides: List[int]
reference_coord: Vector3 = None
areas: List[StructureModel]
colormap: str = ''
intensities: List[float] = []
alphas: List[float]
materials: List[str]

class StructureModel(VBLBaseModel):
name: str
acronym: str
atlas_id: int
color: Color
# values that come with defaults:
visible: bool = False
color_intensity: float = -1
side: int = 0
material: str = 'default'

# Camera

Expand All @@ -74,6 +78,8 @@ class CameraMode(str, Enum):

# Individual mesh neuron

class PrimitiveMeshModel(VBLBaseModel):
data: List[MeshModel]

class MeshModel(VBLBaseModel):
id: str = Field(alias="ID")
Expand Down

0 comments on commit c4a9931

Please sign in to comment.