-
-
Notifications
You must be signed in to change notification settings - Fork 125
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
Scale and Position of Objects Differ between OBJ vs DICOM/NRRD #124
Comments
Hi @eldrickm ! The importers seem set the scale correctly (I think?):
However, the if(dataset.scaleX != 0.0f && dataset.scaleY != 0.0f && dataset.scaleZ != 0.0f)
{
float maxScale = Mathf.Max(dataset.scaleX, dataset.scaleY, dataset.scaleZ);
volObj.transform.localScale = new Vector3(dataset.scaleX / maxScale, dataset.scaleY / maxScale, dataset.scaleZ / maxScale);
} (see
I suppose you could try to remove that I can also take a look at it when I have time (this weekend or early next week I think! Getting some visitors first :) ) |
Thank you for the prompt reply Matias! Yes - it looks like by removing the normalization, the true size is actually preserved (after scaling down by appropriate units!). For example, for our dataset, the true size is given by the result of the following: Line 121 in 70ed1d1
Then I just have to divide by I am now investigating how to correct for positioning - it seems that one can use the metadata in the NRRD (the |
That's great to hear! :) So for that the relevant file to look in would be Please let me know if you get that to work, or if you have any further questions or issues :) |
Yes I was able to read the tags using the OpenDICOM importer - in fact it already takes it into account! UnityVolumeRendering/Assets/Scripts/Importing/ImageSequenceImporter/OpenDICOM/DICOMImporter.cs Line 188 in 70ed1d1
My question is how to use that metadata in positioning the volume render game object. Do you know the relationship between the coordinates that are given in that metadata field and say, the |
Oh right, you're using the OpenDICOM importer :) We sort the slices here: UnityVolumeRendering/Assets/Scripts/Importing/ImageSequenceImporter/OpenDICOM/DICOMImporter.cs Line 122 in 70ed1d1
After that, you could fetch the location of the first slice, and maybe use that as position? (that is, |
Hmm I noticed that the location is a UnityVolumeRendering/Assets/Scripts/Importing/ImageSequenceImporter/OpenDICOM/DICOMImporter.cs Line 198 in 70ed1d1
So simply change that to read elemLoc.Value[0] , elemLoc.Value[1] , elemLoc.Value[2] to a Vector3.
By the way, if you're on Windows or Linux I would recommend using the newer SimpleITK importer for DICOM btw :) https://github.com/mlavik1/UnityVolumeRendering/blob/master/Documentation/SimpleITK.md |
Hi Matias, Sorry for the delay in response! Yes, that was my thought as well, however I am not sure which game object in particular to assign the value to. |
Hi again! Hmm.. I'm not too sure about that, to be honest. According to this the slice locations need to be interpreted according to another DICOM tag: Image Orientation (0020,0037)? |
Thank you for the link - I'll take a closer look and will see if I can get a solution within the next few weeks! |
Great, thanks! :) |
First of all, a deep thank you for working on this project. It works wonderfully and has been extremely helpful. I am planning on donating on your behalf to the ICRC.
I am working on aligning an .obj file of an object I am exporting out of 3D Slicer with it's DICOM / NRRD representation. I am exporting each of these files directly from the same data set in 3D Slicer.
However, I am observing that there are differences in the scale, rotation, and position of the origin across both imports. For example, I have exported a cuboid object from 3D slicer (Figure 1) - the peach-colored box corresponds to the OBJ file to be exported from a segmentation (Figure 2). Notice that they are basically superimposed on each other in 3D slicer.
When I import the OBJ file, all is as expected. (Figure 3 - I've re-oriented it so it faces up)
But when I import the NRRD (DICOM is also affected) as a rendered volume (Fig. 4) I observe the following:
Could you help me debug or find the issue? Thank you kindly in advance!
Here is a ZIP of the two files: https://drive.google.com/file/d/1z6vPmmyuQD5B45JExmGrz2bEbyVzrXdP/view?usp=sharing
The text was updated successfully, but these errors were encountered: