Skip to content

Commit

Permalink
Merge pull request #527 from PaulHax/export-segment-group
Browse files Browse the repository at this point in the history
Segment group file format selection for serialization
  • Loading branch information
PaulHax authored Dec 31, 2023
2 parents 5bf99ee + 67d2631 commit b1951c4
Show file tree
Hide file tree
Showing 17 changed files with 246 additions and 139 deletions.
141 changes: 141 additions & 0 deletions documentation/content/doc/configuration_file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# Configuration JSON File

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

- Starting view layout (Axial Only, 3D Primary, etc).
- Labels for tools
- Visibility of Sample Data section
- Keyboard shortcuts

## Starting view layout

The `activeLayout` key has options (Axial Only, 3D Primary, etc.) defined in `config.ts`

```json
{
"layout": {
"activeLayout": "Axial Only"
}
}
```

## Labels for tools

Each tool type (Rectangle, Polygon, etc.) can have tool specific labels. To share labels
across tools, define the `defaultLabels` key and don't provide labels for a tool that
should use the default labels.

```json
{
"labels": {
"defaultLabels": {
"lesion": { "color": "#ff0000" },
"tumor": { "color": "green", "strokeWidth": 3 }
}
}
}
```

## Segment Group File Format

The `segmentGroupSaveFormat` key specifies the file extension of the segment group images
VolView will include in the volview.zip file.

```json
{
"io": {
"segmentGroupSaveFormat": "nii"
}
}
```

These are the supported file formats:

hdf5, iwi.cbor, mha, nii, nii.gz, nrrd, vtk

## Keyboard Shortcuts

Configure the keys to activate tools, change selected labels, and more.
All [shortcut actions](https://github.com/Kitware/VolView/blob/main/src/constants.ts#L53) are under the `ACTIONS` variable.

To configure a key for an action, add its action name and the key(s) under the `shortcuts` section. For key combinations, use `+` like `Ctrl+f`.

```json
{
"shortcuts": {
"polygon": "Ctrl+p",
"showKeyboardShortcuts": "t"
}
}
```

## Visibility of Sample Data section

Simplify the data browser by hiding the Sample Data expandable section.

```json
{
"dataBrowser": {
"hideSampleData": false
}
}
```

## Example JSON:

```json
{
"labels": {
"defaultLabels": {
"lesion": { "color": "#ff0000" },
"tumor": { "color": "green", "strokeWidth": 3 }
}
},
"layout": {
"activeLayout": "Axial Only"
}
}
```

## All options:

```json
{
"labels": {
"defaultLabels": {
"lesion": { "color": "#ff0000" },
"tumor": { "color": "green", "strokeWidth": 3 },
"innocuous": { "color": "white" }
},
"rulerLabels": {
"big": { "color": "#ff0000" },
"small": { "color": "white" }
},
"rectangleLabels": {
"red": { "color": "#ff0000", "fillColor": "transparent" },
"green": { "color": "green", "fillColor": "transparent" },
"white-yellow-fill": {
"color": "white",
"fillColor": "#00ff0030"
}
},
"polygonLabels": {
"poly1": { "color": "#ff0000" },
"poly2Label": { "color": "green" }
}
},
"layout": {
"activeLayout": "Axial Only"
},
"dataBrowser": {
"hideSampleData": false
},
"shortcuts": {
"polygon": "Ctrl+p",
"showKeyboardShortcuts": "t"
},
"io": {
"segmentGroupSaveFormat": "nrrd"
}
}
```
86 changes: 0 additions & 86 deletions documentation/content/doc/loading_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,92 +56,6 @@ page](https://github.com/Kitware/VolView/issues)!

In order for VolView to download and display your remote datasets, your server must be configured with the correct [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) configuration. CORS is a browser security mechanism that restricts how web applications can access remote resources. Without proper CORS configuration, VolView will be unable to download and display your datasets. Configuring your web server with CORS is beyond the scope of this documentation; please refer to your server's documentation.

### Configuration JSON File

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

- Starting view layout (Axial Only, 3D Primary, etc).
- Labels for tools
- Visibility of Sample Data section
- Keyboard shortcuts

#### Starting view layout

The `activeLayout` key has options (Axial Only, 3D Primary, etc.) defined in `config.ts`

#### Labels for tools

Each tool type (Rectangle, Polygon, etc.) can have tool specific labels. To share labels
across tools, define the `defaultLabels` key and don't provide labels for a tool that
should use the default labels.

#### Visibility of Sample Data section

Simplify the data browser by hiding the Sample Data expandable section.

#### Keyboard Shortcuts

Configure the keys to activate tools, change selected labels, and more.
All [shortcut actions](https://github.com/Kitware/VolView/blob/main/src/constants.ts#L53) are under the `ACTIONS` variable.

To configure a key for an action, add its action name and the key(s) under the `shortcuts` section. For key combinations, use `+` like `Ctrl+f`.

#### Example JSON:

```json
{
"labels": {
"defaultLabels": {
"lesion": { "color": "#ff0000" },
"tumor": { "color": "green", "strokeWidth": 3 }
}
},
"layout": {
"activeLayout": "Axial Only"
}
}
```

#### All options:

```json
{
"labels": {
"defaultLabels": {
"lesion": { "color": "#ff0000" },
"tumor": { "color": "green", "strokeWidth": 3 },
"innocuous": { "color": "white" }
},
"rulerLabels": {
"big": { "color": "#ff0000" },
"small": { "color": "white" }
},
"rectangleLabels": {
"red": { "color": "#ff0000", "fillColor": "transparent" },
"green": { "color": "green", "fillColor": "transparent" },
"white-yellow-fill": {
"color": "white",
"fillColor": "#00ff0030"
}
},
"polygonLabels": {
"poly1": { "color": "#ff0000" },
"poly2Label": { "color": "green" }
}
},
"layout": {
"activeLayout": "Axial Only"
},
"dataBrowser": {
"hideSampleData": false
}
"shortcuts": {
"polygon": "Ctrl+p",
"showKeyboardShortcuts": "t"
}
}
```

## Layer Images

To overlay images in the 2D views, there is a layer button on image thumbnails. A PET image could be layered on top of a CT image. The layered image is resampled to the base image using the image's spatial metadata. If the spatial metadata does not place the images in the same coordinate system, the layer alignment will be incorrect.
Expand Down
2 changes: 1 addition & 1 deletion documentation/content/doc/state_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

VolView state files are a great way to save your scene and data to either be used later, or for distributing to collaborators and other users. These files store all of the information you need to restore the state of VolView: your data, annotations, camera positions, background colors, colormaps, and more.

State files can be saved by clicking on "Disk" icon in the top of the toolbar. This button will generate a `*.volview` file that can then be re-opened in VolView at any time.
State files can be saved by clicking on "Disk" icon in the top of the toolbar. This button will generate a `*.volview.zip` file that can then be re-opened in VolView at any time.

When saving VolView state, your data is saved along with the application state. This way, when you send a state file to a collaborator, they too can open the state file and load the previously saved data. However, this means that your state file will be as large as your dataset(s) and may contain patient identifying information. Please follow your institutes HIPAA, IRB and other regulatory and confidentiality requirements.

Expand Down
3 changes: 2 additions & 1 deletion documentation/tpl/__en__
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ sidebar:
mouse_controls: Mouse/Keyboard Controls
rendering: Cinematic Rendering
state_files: State Files
server: Remote Server Capabilities
server: Remote Server Capabilities
configuration_file: Configuration File
5 changes: 3 additions & 2 deletions documentation/tpl/__sidebar__
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
doc:
introduction:
introduction:
what_is_volview: index.html
quick_start_guide: quick_start_guide.html
details:
details:
welcome_screen: welcome_screen.html
loading_data: loading_data.html
toolbar: toolbar.html
mouse_controls: mouse_controls.html
rendering: rendering.html
state_files: state_files.html
server: server.html
configuration_file: configuration_file.html
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"dependencies": {
"@aws-sdk/client-s3": "^3.435.0",
"@itk-wasm/dicom": "^5.0.0",
"@itk-wasm/image-io": "^0.5.0",
"@kitware/vtk.js": "^28.13.0",
"@netlify/edge-functions": "^2.0.0",
"@sentry/vue": "^7.54.0",
Expand All @@ -37,7 +38,6 @@
"dicomweb-client-typed": "^0.8.6",
"file-saver": "^2.0.5",
"gl-matrix": "3.4.3",
"itk-image-io": "1.0.0-b.156",
"itk-wasm": "1.0.0-b.156",
"jszip": "3.10.0",
"mitt": "^3.0.0",
Expand Down Expand Up @@ -126,4 +126,4 @@
"eslint"
]
}
}
}
2 changes: 1 addition & 1 deletion src/io/import/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DataSource, FileSource } from '@/src/io/import/dataSource';
import { Handler } from '@/src/core/pipeline';
import { ARCHIVE_FILE_TYPES } from '@/src/io/mimeTypes';
import { Awaitable } from '@vueuse/core';
import { Config } from '@/src/io/import/configSchema';
import { Config } from '@/src/io/import/configJson';

interface DataResult {
dataSource: DataSource;
Expand Down
Loading

0 comments on commit b1951c4

Please sign in to comment.