Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing SimpleITK #134

Closed
Meruja opened this issue Nov 20, 2022 · 8 comments · Fixed by #137
Closed

Missing SimpleITK #134

Meruja opened this issue Nov 20, 2022 · 8 comments · Fixed by #137

Comments

@Meruja
Copy link

Meruja commented Nov 20, 2022

I get this error when I try loading any dicom file. I have a .nii file and need simpleITK for it to work. However, it keeps prompting me that I need SimpleITK to be enabled when SimpleITK is already downloaded. Any help would be greatly appreciated.

image

Unity version 2020.3.33f1
Steps to replicated:

  1. Import EasyVolumeRendering
  2. Try importing nifti
  3. enable SimpleITK
  4. Download simpleITK
  5. Repeat step 2.

And it just keeps prompting with the above image.

@smallvalthoss
Copy link

Same thing happens to me when using MRTK, SimpleITK stops getting recognized.

@mlavik1
Copy link
Owner

mlavik1 commented Nov 21, 2022

Thanks for reporting this! :)
I'll take a look at this after work, but I noticed one potential bug here.
Are you using another build target than "Standaline"? (maybe WebGL or something?). If so, changing this line: BuildTargetGroup group = BuildPipeline.GetBuildTargetGroup(target); to this BuildTargetGroup group = BuildTargetGroup.Standalone; in line 25 in SimpleITKManager.cs might fix the issue.

@mlavik1
Copy link
Owner

mlavik1 commented Nov 21, 2022

Hi again!
@Meruja You are trying to import a nifti file and not an NRRD file, right? Because SimpleITK is no longer a requirement (though maybe still recommended) for nifti-import, since #126. If you pull latest form the master branch it should no longer be an issue (I'll probably make a release for this soon).

I've also created a PR with a fix for this issue happening when you've selected a different build target: #137
@smallvalthoss does that PR fix the issue for you?
If not, could you explain how I can reproduce it? Thanks :)

@Meruja
Copy link
Author

Meruja commented Nov 21, 2022

I'm using UWP for the target build device hololens 2 and trying to import a nifti file(heart.nii). As you suggested I made the changes in SimpleITKManager.cs file and now it fixes to identify the simpleITK. But it throws errors (shown in the image) when I try to load the nifti file.
I just imported the Easy VolumeRendering package from the asset store instead of working with GitHub repository.
Screenshot_20221121_020619

@mlavik1 mlavik1 reopened this Nov 21, 2022
@mlavik1
Copy link
Owner

mlavik1 commented Nov 21, 2022

I'll see if I can reproduce this with the Asset Store version (Need to switch to my Windows machine, because of some Unity issue ). Need to go to sleep soon, so I'll look more at that tomorrow.

But I made a new unitypackage for you that you can try, if you don't mind using a "beta" version: https://github.com/mlavik1/UnityVolumeRendering/actions/runs/3518245412
Unity 2021: https://github.com/mlavik1/UnityVolumeRendering/suites/9431168676/artifacts/445763369
Unity 2019: https://github.com/mlavik1/UnityVolumeRendering/suites/9431168676/artifacts/445763368
(this is the build btw)

The build is based on the latest un-published version.
You can import it by going to: Assets > Import Package > Custom Package
as described here: https://docs.unity3d.com/Manual/AssetPackagesImport.html
You need to remove the old "EasyVolumeRendering" folder first.

@Meruja
Copy link
Author

Meruja commented Nov 21, 2022

I'll see if I can reproduce this with the Asset Store version (Need to switch to my Windows machine, because of some Unity issue ). Need to go to sleep soon, so I'll look more at that tomorrow.

But I made a new unitypackage for you that you can try, if you don't mind using a "beta" version: https://github.com/mlavik1/UnityVolumeRendering/actions/runs/3518245412 Unity 2021: https://github.com/mlavik1/UnityVolumeRendering/suites/9431168676/artifacts/445763369 Unity 2019: https://github.com/mlavik1/UnityVolumeRendering/suites/9431168676/artifacts/445763368 (this is the build btw)

The build is based on the latest un-published version. You can import it by going to: Assets > Import Package > Custom Package as described here: https://docs.unity3d.com/Manual/AssetPackagesImport.html You need to remove the old "EasyVolumeRendering" folder first.

That's totally fine. I'll try the beta version and update the results. Thanks

@mlavik1
Copy link
Owner

mlavik1 commented Nov 22, 2022

Great! Let me know if that worked, please :)
I'll try on Windows with asset store version now.

@mlavik1
Copy link
Owner

mlavik1 commented Nov 22, 2022

Ok, so I found the cause of the bug:
I add a UVR_USE_SIMPLEITK definition to the standalone build target when enabling SimpleITK, and then check if this is defined in the code when importing. However, if you select another build target then it won't know that SImpleITK is enabled and available while in the editor.
I'll see if I can find some way of adding definitions to the editor 🤔

Until then you can:
A: Use the unitypackage I sent you, which supports NIFTI without SimpleITK (I expect it should also work in your UWP build)
B: Switch build target to standalone before you import, and then switch back afterwards.

SimpleITK does not work on UWP builds at the moment though. But I think adding support for that should just be a matter of adding BuildTargetGroup.WSA to the buildTargetGroups array in SimpleITKManager.cs, like this:

List<BuildTargetGroup> buildTargetGroups = new List<BuildTargetGroup> (){ BuildTargetGroup.Standalone, BuildTargetGroup.WSA };

And then disabling and enabling SimpleITK in the settings menu.
I've never build for UWP/WSA before, but I'll see if I can give it a try tomorrow, and push a fix if that works.

But if the unitypackage I sent you yesterday works fine, then you can probably just use that instead.

@Meruja Meruja closed this as completed Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants