mlavik1 / UnityVolumeRendering

Volume rendering, implemented in Unity3D. Want to support the project? Donate a small sum to Save The Children(https://www.savethechildren.net/) or another charity, and send me a message, and I will be greatly motivated!
https://fosstodon.org/@unityvolrend
MIT License
455 stars 127 forks source link

Doesn't load DICOM files #139

Open panteroni opened 1 year ago

panteroni commented 1 year ago

RAW and PARCHG formats are working, but the DICOM format doesn't work. I tried many DICOM samples I found online. I was able to open them up (sort of) in an external CT Viewer app, but none of them were opened at all in the Unity Editor.

I'm using Mac M1.

Here's the error message that appears in the console:

DllNotFoundException: libSimpleITKCSharpNative assembly: type: member:(null) itk.simple.SimpleITKPINVOKE+SWIGExceptionHelper..cctor () (at <646c3a3661dc48aeb8f7818e41940826>:0) Rethrow as TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. itk.simple.SimpleITKPINVOKE..cctor () (at <646c3a3661dc48aeb8f7818e41940826>:0) Rethrow as TypeInitializationException: The type initializer for 'itk.simple.SimpleITKPINVOKE' threw an exception. itk.simple.ImageSeriesReader.GetGDCMSeriesIDs (System.String directory) (at <646c3a3661dc48aeb8f7818e41940826>:0) UnityVolumeRendering.SimpleITKImageSequenceImporter.LoadSeries (System.Collections.Generic.IEnumerable`1[T] files) (at Assets/Scripts/Importing/ImageSequenceImporter/SimpleITK/SimpleITKImageSequenceImporter.cs:52) UnityVolumeRendering.RuntimeGUI.OnOpenDICOMDatasetResult (UnityVolumeRendering.RuntimeFileBrowser+DialogResult result) (at Assets/Scripts/GUI/Components/RuntimeGUI.cs:111) UnityVolumeRendering.RuntimeFileBrowser+RuntimeFileBrowserComponent.CloseBrowser (System.Boolean cancelled, System.String selectedPath) (at Assets/Scripts/GUI/Components/RuntimeFileBrowserComponent.cs:216) UnityVolumeRendering.RuntimeFileBrowser+RuntimeFileBrowserComponent.DrawBottomBar () (at Assets/Scripts/GUI/Components/RuntimeFileBrowserComponent.cs:196) UnityVolumeRendering.RuntimeFileBrowser+RuntimeFileBrowserComponent.UpdateWindow (System.Int32 windowID) (at Assets/Scripts/GUI/Components/RuntimeFileBrowserComponent.cs:71) UnityEngine.GUI.CallWindowDelegate (UnityEngine.GUI+WindowFunction func, System.Int32 id, System.Int32 instanceID, UnityEngine.GUISkin _skin, System.Int32 forceRect, System.Single width, System.Single height, UnityEngine.GUIStyle style) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUI.cs:1914)

If this works for you, or you have working DICOM files, or any suggestions, I would very appreciate your helps.

mlavik1 commented 1 year ago

Hi! Thanks a lot for reporting this :) You're actually the first Mac user I know of who try to use the SimpleITK integration, which I unfortunately had no way of testing on Mac myself (since I don't own one).

So I suppose you have already enabled SimpleITK in the "Volume Rendering" > "Settings" menu, right? image

Did that successfully download some files to "dataPath/3rdparty/SimpleITK"? And if so, does the folder contain a DLL and dyLib file?

If not: Can you try disabling and enabling that setting again, and see if it downloads it successfully, or if it throws an error somewhere?

panteroni commented 1 year ago

Thanks for the quick response!

Yes, I disabled and enabled SimpleITK but it didn't do any change. The path is different than the one you indicated: it's "Assets/3rdparty/SimpleITK" and not "dataPath/3rdparty/SimpleITK". I tried both of them. I do have the DLL and the dyLib files.

Do you have a sample DICOM file that works for you that I can check on my environment?

mlavik1 commented 1 year ago

Ah yes, that was just a copy-paste mistake from my side :sweat_smile:

Hmm.. then I'm not sure. If you click on the dyLib file in Unity, does it have the correct architecture selected? (in the inspector). The error indicates that the dyLib was not found or not built for the correct architexture. I suppose you could also try asking the SimpleITK developers here: https://github.com/SimpleITK/SimpleITK

However, do you need to import JPEG2000-compressed DICOM datasets? If not, you could try disabling the SimpleITK integration and importing without it instead. It will use the "OpenDICOM"-based importer, that's written in C# only - so no native libraries.