-
-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy pathImportSettingsEditorWindow.cs
More file actions
79 lines (68 loc) · 3.29 KB
/
Copy pathImportSettingsEditorWindow.cs
File metadata and controls
79 lines (68 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using System.Collections.Generic;
using System.Linq;
using System;
using UnityEditor;
using UnityEngine;
namespace UnityVolumeRendering
{
public class ImportSettingsEditorWindow : EditorWindow
{
public static void ShowWindow()
{
ImportSettingsEditorWindow wnd = new ImportSettingsEditorWindow();
wnd.Show();
}
private void OnGUI()
{
GUIStyle headerStyle = new GUIStyle(EditorStyles.label);
headerStyle.fontSize = 20;
headerStyle.fixedHeight = 20;
EditorGUILayout.LabelField("Volume rendering import settings", headerStyle);
EditorGUILayout.Space();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Show prompt asking if you want to downscale the dataset on import?");
bool showDownscalePrompt = EditorGUILayout.Toggle("", PlayerPrefs.GetInt("DownscaleDatasetPrompt") > 0);
PlayerPrefs.SetInt("DownscaleDatasetPrompt", showDownscalePrompt ? 1 : 0);
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Normalise dataset scale on import?");
bool normaliseScaleOnImport = EditorGUILayout.Toggle("", PlayerPrefs.GetInt("NormaliseScaleOnImport") > 0);
PlayerPrefs.SetInt("NormaliseScaleOnImport", normaliseScaleOnImport ? 1 : 0);
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Clamp Hounsfield values to body tissues range?");
bool clampHounsfield = EditorGUILayout.Toggle("", PlayerPrefs.GetInt("ClampHounsfield") > 0);
PlayerPrefs.SetInt("ClampHounsfield", clampHounsfield ? 1 : 0);
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Default gradient computation method");
GradientType gradientType = GradientType.CentralDifference;
Enum.TryParse(PlayerPrefs.GetString("DefaultGradientType"), out gradientType);
gradientType = (GradientType)EditorGUILayout.EnumPopup(gradientType, "");
PlayerPrefs.SetString("DefaultGradientType", gradientType.ToString());
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space();
EditorGUILayout.Space();
EditorGUILayout.LabelField("SimpleITK", headerStyle);
EditorGUILayout.Space();
EditorGUILayout.LabelField("SimpleITK is a library that adds support for JPEG-compressed DICOM, as well as NRRD and NIFTI formats.\n" +
"Enabling it will start a download of ca 100MBs of binaries. Supported platforms: Windows, Linux, MacOS.", EditorStyles.wordWrappedLabel);
if (!SimpleITKManager.IsSITKEnabled())
{
if (GUILayout.Button("Enable SimpleITK"))
{
SimpleITKManager.DownloadBinaries();
SimpleITKManager.EnableSITK(true);
}
}
else
{
if (GUILayout.Button("Disable SimpleITK"))
{
SimpleITKManager.EnableSITK(false);
}
}
}
}
}