Пример #1
0
        private void OnOpenDICOMDatasetResult(RuntimeFileBrowser.DialogResult result)
        {
            if (!result.cancelled)
            {
                // We'll only allow one dataset at a time in the runtime GUI (for simplicity)
                DespawnAllDatasets();

                bool recursive = true;

                // Read all files
                IEnumerable <string> fileCandidates = Directory.EnumerateFiles(result.path, "*.*", recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly)
                                                      .Where(p => p.EndsWith(".dcm", StringComparison.InvariantCultureIgnoreCase) || p.EndsWith(".dicom", StringComparison.InvariantCultureIgnoreCase) || p.EndsWith(".dicm", StringComparison.InvariantCultureIgnoreCase));

                // Import the dataset
                DICOMImporter importer = new DICOMImporter(fileCandidates, Path.GetFileName(result.path));
                List <DICOMImporter.DICOMSeries> seriesList = importer.LoadDICOMSeries();
                float numVolumesCreated = 0;
                foreach (DICOMImporter.DICOMSeries series in seriesList)
                {
                    VolumeDataset dataset = importer.ImportDICOMSeries(series);
                    // Spawn the object
                    if (dataset != null)
                    {
                        VolumeRenderedObject obj = VolumeObjectFactory.CreateObject(dataset);
                        obj.transform.position = new Vector3(numVolumesCreated, 0, 0);
                        numVolumesCreated++;
                    }
                }
            }
        }
Пример #2
0
        private void OnOpenRAWDatasetResult(RuntimeFileBrowser.DialogResult result)
        {
            if (!result.cancelled)
            {
                // We'll only allow one dataset at a time in the runtime GUI (for simplicity)
                DespawnAllDatasets();

                // Did the user try to import an .ini-file? Open the corresponding .raw file instead
                string filePath = result.path;
                if (System.IO.Path.GetExtension(filePath) == ".ini")
                {
                    filePath = filePath.Replace(".ini", ".raw");
                }

                // Parse .ini file
                DatasetIniData initData = DatasetIniReader.ParseIniFile(filePath + ".ini");
                if (initData != null)
                {
                    // Import the dataset
                    RawDatasetImporter importer = new RawDatasetImporter(filePath, initData.dimX, initData.dimY, initData.dimZ, initData.format, initData.endianness, initData.bytesToSkip);
                    VolumeDataset      dataset  = importer.Import();
                    // Spawn the object
                    if (dataset != null)
                    {
                        VolumeObjectFactory.CreateObject(dataset);
                    }
                }
            }
        }
Пример #3
0
 private void OnLoadTransferFunction(RuntimeFileBrowser.DialogResult result)
 {
     if (!result.cancelled)
     {
         string extension = Path.GetExtension(result.path);
         if (extension == ".tf")
         {
             TransferFunction tf = TransferFunctionDatabase.LoadTransferFunction(result.path);
             if (tf != null)
             {
                 targetObject.transferFunction = tf;
                 targetObject.SetTransferFunctionMode(TFRenderMode.TF1D);
             }
         }
         if (extension == ".tf2d")
         {
             TransferFunction2D tf = TransferFunctionDatabase.LoadTransferFunction2D(result.path);
             if (tf != null)
             {
                 targetObject.transferFunction2D = tf;
                 targetObject.SetTransferFunctionMode(TFRenderMode.TF2D);
             }
         }
     }
 }
Пример #4
0
 private void OnOpenPARDatasetResult(RuntimeFileBrowser.DialogResult result)
 {
     if (!result.cancelled)
     {
         DespawnAllDatasets();
         string             filePath    = result.path;
         ParDatasetImporter parimporter = new ParDatasetImporter(filePath);
         VolumeDataset      dataset     = parimporter.Import(); //overriden somewhere
         if (dataset != null)
         {
             VolumeObjectFactory.CreateObject(dataset);
         }
     }
 }
Пример #5
0
        private void OnOpenDICOMDatasetResult(RuntimeFileBrowser.DialogResult result)
        {
            if (!result.cancelled)
            {
                // We'll only allow one dataset at a time in the runtime GUI (for simplicity)
                DespawnAllDatasets();

                // Import the dataset
                DICOMImporter importer = new DICOMImporter(result.path, true);
                VolumeDataset dataset  = importer.Import();
                // Spawn the object
                if (dataset != null)
                {
                    VolumeObjectFactory.CreateObject(dataset);
                }
            }
        }
Пример #6
0
        private void OnOpenDICOMDatasetResult(RuntimeFileBrowser.DialogResult result)
        {
            if (!result.cancelled)
            {
                // We'll only allow one dataset at a time in the runtime GUI (for simplicity)
                DespawnAllDatasets();

                bool recursive = true;

                // Read all files
                IEnumerable <string> fileCandidates = Directory.EnumerateFiles(result.path, "*.*", recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly)
                                                      .Where(p => p.EndsWith(".dcm", StringComparison.InvariantCultureIgnoreCase) || p.EndsWith(".dicom", StringComparison.InvariantCultureIgnoreCase) || p.EndsWith(".dicm", StringComparison.InvariantCultureIgnoreCase));

                // Import the dataset
                DICOMImporter importer = new DICOMImporter(fileCandidates, Path.GetFileName(result.path));
                VolumeDataset dataset  = importer.Import();
                // Spawn the object
                if (dataset != null)
                {
                    VolumeObjectFactory.CreateObject(dataset);
                }
            }
        }