PerkLab / SlicerSandbox

Collection of utilities that are not polished implementations but can be useful to users
BSD 2-Clause "Simplified" License
68 stars 24 forks source link

inconsistency of import modules - OpenInventor vs STL #32

Closed amymmorton closed 1 month ago

amymmorton commented 2 months ago

the same file data saved in STL vs IV imports differently in slicer (one assuming LPS and modifying to RAS (stl) the other no modification: iv)

correct import: overlay in geomagic and matlab

image

Then incorrect loading (or should I say inconsistent loading assumptions applied) in slicer: image image

image

lassoan commented 2 months ago

Is there a way to specify coordinate system (LPS or RAS) in the .iv file? Or should we assume that .iv file always uses LPS?

If .iv is always LPS then we could ensure consistent coordinate system use by changing this:

modelNode = slicer.modules.models.logic().AddModel(polyData)

to this:

outputMeshInRAS = vtk.vtkPolyData()
slicer.vtkMRMLModelStorageNode.ConvertBetweenRASAndLPS(polyData, outputMeshInRAS)
modelNode = slicer.modules.models.logic().AddModel(outputMeshInRAS)
amymmorton commented 2 months ago

Much like vrml / wrl files the iv file has a basis in virtual scene modeling- without association to anatomical orientations. STL format is the same in this respect.

I think the same processing and assumptions acted on stl files should as be applied to iv

On Tue, Aug 6, 2024 at 6:16 PM Andras Lasso @.***> wrote:

Is there a way to specify coordinate system (LPS or RAS) in the .iv file? Or should we assume that .iv file always uses LPS?

If .iv is always LPS then we could ensure consistent coordinate system use by changing this:

modelNode = slicer.modules.models.logic().AddModel(polyData)

to this:

outputMeshInRAS = vtk.vtkPolyData()slicer.vtkMRMLModelStorageNode.ConvertBetweenRASAndLPS(polyData, outputMeshInRAS)modelNode = slicer.modules.models.logic().AddModel(outputMeshInRAS)

— Reply to this email directly, view it on GitHub https://github.com/PerkLab/SlicerSandbox/issues/32#issuecomment-2272241924, or unsubscribe https://github.com/notifications/unsubscribe-auth/APUUPFVP4SI3L2SXMOXDN7LZQFDKTAVCNFSM6AAAAABMCX32IKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZSGI2DCOJSGQ . You are receiving this because you authored the thread.Message ID: @.***>

--

Amy Morton, MSc

Sr. Research Engineer, Bioengineering Lab, Department of Orthopaedic Research The Warren Alpert Medical School of Brown University and Rhode Island Hospital 1 Hoppin Street, CORO West, Ste. 404, Providence, RI 02903

lassoan commented 2 months ago

For commonly used medical image computing file formats (nrrd, nifti, stl, vtk, vtp, vtu, obj, ...) coordinate system is either described in the file format specification or common conventions are followed. If there is no official specification for .iv then we should follow the convention of the world coordinate system being LPS, with millimeters as unit. That few-line change that I described above implements exactly this. It would be great if you could test it (by modifying the iv importer file on your computer at this line) and let me know if it works well.

amymmorton commented 2 months ago

Modifying C:\Users\amorton1\AppData\Local\slicer.org\Slicer 5.6.2\slicer.org \Extensions-32448\Sandbox\lib\Slicer-5.6\qt-scripted-modules\ImportOpenInventor.py

followed by slicer 5.6.2 restart imports the iv as intended.

Thank you

[image: image.png]

On Wed, Aug 7, 2024 at 10:44 AM Andras Lasso @.***> wrote:

For commonly used medical image computing file formats (nrrd, nifti, stl, vtk, vtp, vtu, obj, ...) coordinate system is either described in the file format specification or common conventions are followed. If there is no official specification for .iv then we should follow the convention of the world coordinate system being LPS, with millimeters as unit. That few-line change that I described above implements exactly this. It would be great if you could test it (by modifying the iv importer file on your computer at this line https://github.com/PerkLab/SlicerSandbox/blob/master/ImportOpenInventor/ImportOpenInventor.py#L94) and let me know if it works well.

— Reply to this email directly, view it on GitHub https://github.com/PerkLab/SlicerSandbox/issues/32#issuecomment-2273649364, or unsubscribe https://github.com/notifications/unsubscribe-auth/APUUPFXNO2OQCPRSWVURG63ZQIXFVAVCNFSM6AAAAABMCX32IKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZTGY2DSMZWGQ . You are receiving this because you authored the thread.Message ID: @.***>

--

Amy Morton, MSc

Sr. Research Engineer, Bioengineering Lab, Department of Orthopaedic Research The Warren Alpert Medical School of Brown University and Rhode Island Hospital 1 Hoppin Street, CORO West, Ste. 404, Providence, RI 02903