Skip to content

Commit c81cc3a

Browse files
committed
docs(config): document layout config and disabledViewTypes
1 parent 6623f1a commit c81cc3a

File tree

2 files changed

+100
-3
lines changed

2 files changed

+100
-3
lines changed

docs/configuration_file.md

Lines changed: 95 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@
22

33
By loading a JSON file, you can set VolView's configuration:
44

5-
- Starting view layout grid size
5+
- Starting view layout (grid size, view types, or hierarchical layouts)
6+
- Disabled view types
67
- Labels for tools
78
- Visibility of Sample Data section
89
- Keyboard shortcuts
910

1011
## Starting view layout
1112

13+
VolView supports three ways to configure the initial view layout:
14+
15+
### 1. Simple Grid (gridSize)
16+
1217
The `gridSize` key sets the initial layout grid as `[width, height]`. For example, `[2, 2]` creates a 2x2 grid of views.
1318

1419
```json
@@ -19,6 +24,86 @@ The `gridSize` key sets the initial layout grid as `[width, height]`. For exampl
1924
}
2025
```
2126

27+
### 2. Grid with View Types (2D String Array)
28+
29+
Use a 2D array of view type strings to specify both the grid layout and which views appear in each position:
30+
31+
```json
32+
{
33+
"layout": [
34+
["axial", "sagittal"],
35+
["coronal", "volume"]
36+
]
37+
}
38+
```
39+
40+
Available view type strings: `"axial"`, `"coronal"`, `"sagittal"`, `"volume"`, `"oblique"`
41+
42+
### 3. Nested Hierarchical Layout
43+
44+
For complex layouts, use a nested structure with full control over view placement and properties:
45+
46+
```json
47+
{
48+
"layout": {
49+
"direction": "row",
50+
"items": [
51+
"volume",
52+
{
53+
"direction": "column",
54+
"items": ["axial", "coronal", "sagittal"]
55+
}
56+
]
57+
}
58+
}
59+
```
60+
61+
Direction values:
62+
- `"row"` - items arranged horizontally
63+
- `"column"` - items stacked vertically
64+
65+
You can also specify full view objects with custom options:
66+
67+
```json
68+
{
69+
"layout": {
70+
"direction": "column",
71+
"items": [
72+
{
73+
"type": "3D",
74+
"name": "Top View",
75+
"viewDirection": "Superior",
76+
"viewUp": "Anterior"
77+
},
78+
{
79+
"direction": "row",
80+
"items": [
81+
{ "type": "2D", "orientation": "Axial" },
82+
{ "type": "2D", "orientation": "Coronal" }
83+
]
84+
}
85+
]
86+
}
87+
}
88+
```
89+
90+
View object properties:
91+
- 2D views: `type: "2D"`, `orientation: "Axial" | "Coronal" | "Sagittal"`, `name` (optional)
92+
- 3D views: `type: "3D"`, `viewDirection` (optional), `viewUp` (optional), `name` (optional)
93+
- Oblique views: `type: "Oblique"`, `name` (optional)
94+
95+
## Disabled View Types
96+
97+
Use `disabledViewTypes` to prevent certain view types from being available in the view type switcher:
98+
99+
```json
100+
{
101+
"disabledViewTypes": ["3D", "Oblique"]
102+
}
103+
```
104+
105+
This removes the specified view types from the dropdown menu and replaces them in the default layout with allowed types. Valid values: `"2D"`, `"3D"`, `"Oblique"`
106+
22107
## Labels for tools
23108

24109
Each tool type (Rectangle, Polygon, etc.) can have tool specific labels. To share labels
@@ -131,8 +216,16 @@ To configure a key for an action, add its action name and the key(s) under the `
131216
}
132217
},
133218
"layout": {
134-
"gridSize": [2, 2]
219+
"direction": "row",
220+
"items": [
221+
"volume",
222+
{
223+
"direction": "column",
224+
"items": ["axial", "coronal", "sagittal"]
225+
}
226+
]
135227
},
228+
"disabledViewTypes": ["Oblique"],
136229
"dataBrowser": {
137230
"hideSampleData": false
138231
},

src/store/views.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import type { Maybe } from '@/src/types';
55
import type { Layout, LayoutItem } from '@/src/types/layout';
66
import { useIdStore } from '@/src/store/id';
77
import type { ViewInfo, ViewInfoInit, ViewType } from '@/src/types/views';
8-
import { DefaultLayout, DefaultLayoutSlots, getAvailableViews } from '@/src/config';
8+
import {
9+
DefaultLayout,
10+
DefaultLayoutSlots,
11+
getAvailableViews,
12+
} from '@/src/config';
913
import type { StateFile } from '../io/state-file/schema';
1014

1115
const DEFAULT_VIEW_INIT: ViewInfoInit = {

0 commit comments

Comments
 (0)