public static void initDicom() { var dict = new DicomDictionary(); dict.Load(@".\Assets\dicom\DICOM Dictionary.xml", DicomDictionaryFormat.XML); DicomDictionary.Default = dict; }
public void Load_CompressedFile_LoadedTagFound() { var dict = new DicomDictionary(); dict.Load(TestData.Resolve("minimumdict.xml.gz"), DicomDictionaryFormat.XML); var expected = DicomVR.CS; var actual = dict[DicomTag.FileSetID].ValueRepresentations.Single(); Assert.Equal(expected, actual); }
// Use this for initialization void Start() { Unzip("Genomics", false); Debug.Log("Loading DICOM DICT"); var dict = new DicomDictionary(); dict.Load(Application.dataPath + "/StreamingAssets/Dictionaries/DICOM Dictionary.xml", DicomDictionaryFormat.XML); DicomDictionary.Default = dict; annotationPath = Path.Combine(Application.persistentDataPath, "annotations.json"); if (File.Exists(annotationPath)) { annotations = JsonUtility.FromJson <AnnotationCollection>(File.ReadAllText(annotationPath)); Debug.Log("Loaded " + annotations.annotations.Count + " annotations"); } var meshMarkerPath = Path.Combine(Application.persistentDataPath, "MeshMarkers"); if (Directory.Exists(meshMarkerPath)) { meshMarkers = Directory.GetFiles(meshMarkerPath, "*.*", SearchOption.AllDirectories); } var path = Unzip("DICOM"); Unzip("Volumes", false); var offset = 0; directoryMap = new Dictionary <GameObject, DicomDirectoryRecord>(); rootDirectoryMap = new Dictionary <DicomDirectoryRecord, string>(); openedItems = new Dictionary <GameObject, bool>(); var directories = Directory.GetDirectories(path); if (directories.Length == 0) { status.text = "ERROR: No directories found!"; return; } status.text = "Loading..."; foreach (var directory in Directory.GetDirectories(path)) { var directoryName = Path.GetFileName(directory); Debug.Log("--DIRECTORY--" + directoryName); var dd = DicomDirectory.Open(Path.Combine(directory, "DICOMDIR")); rootDirectoryMap[dd.RootDirectoryRecord] = directory; var tex = GetTexture2DForRecord(dd.RootDirectoryRecord); var quad = Instantiate(quadPrefab, filebrowser); quad.GetComponent <Renderer>().material.mainTexture = tex; quad.transform.localPosition += new Vector3(offset, 0, 0); quad.transform.Find("Canvas").Find("title").GetComponent <Text>().text = "Directory: " + directoryName; quad.name = directory; directoryMap[quad] = dd.RootDirectoryRecord; openedItems[quad] = false; quad.tag = "directory"; offset += 1; } recognizer = new GestureRecognizer(); recognizer.TappedEvent += Recognizer_TappedEvent; recognizer.StartCapturingGestures(); status.text = ""; UpdateAnnotationsList(); testQuad.SetActive(false); #if UNITY_EDITOR testQuad.SetActive(true); testQuad.transform.position = new Vector3(0, 0, 2); var series = GetSeriesById("1.3.12.2.1107.5.1.4.50714.30000016083120205201500011155"); var seriesHandler = testQuad.GetComponent <OpenSeriesHandler>(); seriesHandler.record = series; var modality = GetDicomTag(series, DicomTag.Modality); var seriesDesc = GetDicomTag(series, DicomTag.SeriesDescription); testQuad.name = "Series: " + modality + "\n" + seriesDesc; Debug.Log(seriesDesc); directoryMap[testQuad] = series; rootDirectoryMap[series] = rootDirectoryMap[directoryMap.ElementAt(1).Value]; testQuad.GetComponent <TwoHandManipulatable>().enabled = true; testQuad.transform.Find("3D_toggle").gameObject.SetActive(true); testQuad.transform.Find("3D_toggle").GetComponent <InteractiveToggle>().SetSelection(true); seriesHandler.ButtonPush("3D"); var slider = testQuad.transform.Find("zstack slider"); slider.gameObject.SetActive(true); var sliderComponent = slider.GetComponent <SliderGestureControl>(); var n_images = series.LowerLevelDirectoryRecordCollection.Count(); sliderComponent.SetSpan(0, n_images); sliderComponent.SetSliderValue(n_images / 2f); testQuad.GetComponent <Renderer>().material.mainTexture = GetTexture2DForRecord(series); var seriesId = series.Get <string>(DicomTag.SeriesInstanceUID, "no series id"); foreach (var a in annotations.annotations) { if (a.series == seriesId) { var annotation = Instantiate(annotationPrefab, testQuad.transform); annotation.transform.localPosition = DeserializeVector(a.position, Vector3.zero); annotation.transform.localRotation = Quaternion.Euler(DeserializeVector(a.rotation, Vector3.zero)); annotation.transform.localScale = DeserializeVector(a.scale, Vector3.one); } } //WarmVolumeCache(); #endif }