Added popup dialog for optional downscaling

This commit is contained in:
Vahid 2021-10-23 22:35:41 +11:00 коммит произвёл GitHub
Родитель 5f0d380920
Коммит a36f01e819
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 31 добавлений и 4 удалений

Просмотреть файл

@ -43,8 +43,17 @@ namespace UnityVolumeRendering
private void ImportDataset()
{
RawDatasetImporter importer = new RawDatasetImporter(fileToImport, dimX, dimY, dimZ, dataFormat, endianness, bytesToSkip);
RawDatasetImporter importer;
if (EditorUtility.DisplayDialog("Optional DownScaling",
"Do you want to downscale texture even if the dimensions are within the limits?", "Yes", "No"))
{
importer = new RawDatasetImporter(fileToImport, dimX, dimY, dimZ, dataFormat, endianness, bytesToSkip, true);
}
else
{
importer = new RawDatasetImporter(fileToImport, dimX, dimY, dimZ, dataFormat, endianness, bytesToSkip, false);
}
VolumeDataset dataset = importer.Import();
if (dataset != null)

Просмотреть файл

@ -51,9 +51,17 @@ namespace UnityVolumeRendering
DICOMImporter importer = new DICOMImporter(fileCandidates, Path.GetFileName(dir));
List<DICOMImporter.DICOMSeries> seriesList = importer.LoadDICOMSeries();
float numVolumesCreated = 0;
bool forceDownScaling = false;
if (EditorUtility.DisplayDialog("Optional DownScaling",
"Do you want to downscale texture even if the dimensions are within the limits?", "Yes", "No"))
{
forceDownScaling = true;
}
foreach (DICOMImporter.DICOMSeries series in seriesList)
{
VolumeDataset dataset = importer.ImportDICOMSeries(series);
VolumeDataset dataset = importer.ImportDICOMSeries(series, forceDownScaling);
if (dataset != null)
{
VolumeRenderedObject obj = VolumeObjectFactory.CreateObject(dataset);
@ -77,9 +85,19 @@ namespace UnityVolumeRendering
static void ShowSequenceImporter()
{
string dir = EditorUtility.OpenFolderPanel("Select a folder to load", "", "");
if (Directory.Exists(dir))
{
ImageSequenceImporter importer = new ImageSequenceImporter(dir);
ImageSequenceImporter importer;
if (EditorUtility.DisplayDialog("Optional DownScaling",
"Do you want to downscale texture even if the dimensions are within the limits?", "Yes", "No"))
{
importer = new ImageSequenceImporter(dir,true);
}
else
{
importer = new ImageSequenceImporter(dir,false);
}
VolumeDataset dataset = importer.Import();
if (dataset != null)
VolumeObjectFactory.CreateObject(dataset);