PlusToolkit / PlusLib

Software library for data acquisition, pre-processing, and calibration for navigated image-guided interventions.
http://www.plustoolkit.org
Other
136 stars 103 forks source link

Add reference coordinate system on patient #1006

Closed martynakielbasa closed 2 years ago

martynakielbasa commented 2 years ago

Hello again,

I have encountered a problem that I am not able to solve on my own.

I have performed a full calibration using fCal.exe and now I would like to record a tracked ultrasound sequence of a femur phantom. I want the tool on the phantom to be the reference coordinate system, so that I can move it, rotate it etc. while scanning (picture below). I have the .rom file of the tool.
313998369_529109098646890_4545712011462187833_n So far I haven't had much success in solving this issue. Here's what I did: in my config file (the one with the calibration result) I swapped the .rom files of the tools (the one on the calibration phantom and the one on the femur phantom). When I connected my devices, the tool on the femur phantom was seen as 'Reference'. I know that my reasoning was probably wrong, but I wanted to try out the easiest solution that came to my min

After volume reconstruction I got a shattered model, that's how I know the coordinate systems are not correctly specified.

Could you please instruct me on how to solve the problem? FYI, I'm attaching the config file (with swapped file). config_file.txt

Sunderlandkyl commented 2 years ago

How are you reconstructing the volume, using Plus or 3D Slicer?

For Plus, I think you need to specify ReferenceCoordinateFrame and ImageCoordinateFrame in the VolumeReconstruction element in the config file. http://perk-software.cs.queensu.ca/plus/doc/nightly/user/AlgorithmVolumeReconstruction.html

martynakielbasa commented 2 years ago

I am using Plus' VolumeReconstructor.exe. I only use Slicer to view the volume.

I was using the command-line parameter '--image-to-reference-transform=ImageToReference'. Now I have specified ReferenceCoordinateSystem as "Reference" and ImageCoordinateSystem as "Image" and the result of reconstruction is still incorrect. The picture below is what I got after reconstruction. It was supposed to be the femural head. image

Sunderlandkyl commented 2 years ago

When you visualize the tracked ultrasound slice in 3D Slicer, does the tracking seem good?

martynakielbasa commented 2 years ago

If you mean the three slices from different planes, then not really - I'm not able to see the correct shape of the bone. image

Sunderlandkyl commented 2 years ago

No, I meant the live tracked ultrasound image.

I haven't tested it, but this config file should stream the live ultrasound image to Slicer in the Reference coordinate system. stream_us_config_file.txt

You'll need to use the "Volume reslice driver" module from SlicerIGT to display the slice as it's tracked.

martynakielbasa commented 2 years ago

I'll test it as soon as I get to the lab again and let you know about the the results.

martynakielbasa commented 2 years ago

The tracking of the slice seems good, I tried moving the probe in various directions and also rotate it a bit (result below). It gets a bit laggy but I assume that's when the camera can't see the markers on the probe.

I'm attaching two clips: one from Slicer with the tracked ultrasound slice and another of irl prove movement:

https://drive.google.com/drive/folders/1yblxomDxxZpqb28U08CPKEtnXT3X_MOk?usp=share_link

martynakielbasa commented 2 years ago

I also tried to use Slicer to reconstruct volume, but I was not able to record anything (e.g. scout scan). I assumed that it was impossible due to the fact that there was no CaptureDevice available (I compared it with your exemplary elbow sweep file and noticed it then). Does it have something to do with the config file?

My file: Zrzut ekranu (1889)

The elbow sweep file: Zrzut ekranu (1890)

Sunderlandkyl commented 2 years ago

Yes, the scout scan needs a Virtual capture device. Probably you can just copy it from the other config file.

You can also perform live volume reconstruction directly in Slicer using the Volume Reconstruction module in SlicerIGT: https://www.youtube.com/watch?v=2vXeJxYFou4

martynakielbasa commented 2 years ago

I don't see the Volume Reconstruction module in SlicerIGT. I have Slicer 5.0.3. The SlicerIGT extension version is c73b307 (2022-07-08). image

Sunderlandkyl commented 2 years ago

For Slicer 5.0.3, you'll need to install the SlicerIGSIO extension.

martynakielbasa commented 2 years ago

I tried using the Volume Reconstruction module from Slicer, but still got weird results. The reconstructed volume seems to be lacking depth and cramped.

image image

I also noticed that the image from the ultrasound probe was not displayed correctly - it looked like it was squeezed a bit. I use the Telemed linear probe size 60 mm - maybe that's the problem?

I also tried changing the transformation hierarchy. I tried two different options - none of the worked correctly: image image Perhaps I still haven't used the proper one.

Sunderlandkyl commented 2 years ago

Image_Image transforming it with ImageToReference, and sending the image as Image_Reference are both correct.

Are you using the same ultrasound probe depth that you calibrated your probe with?

martynakielbasa commented 2 years ago

Hello again,

found a solution to my problem by recalibrating with UF image orientation and adding another coordinate system named 'Patient' next to the existent 'Reference' one. I then changed the ReferenceCoordinateSystem for Volume Reconstruction and conducted live volume reconstruction using Slicer. Results below (not a full model yet, only a control scan):

image

Thank you for all your help and and involvement in this matter!

lassoan commented 2 years ago

Great, thanks for the update!