Hi ImFusion Support
We are using ImFusion SDK for developing an application to perform US-CT registration.
We use a CT volume and a US sweep with tracking to create the UltrasoundRegistrationAlgortihm object. Then, we set up the algorithm parameters (like setSetMask and others), compound the US sweep to obtain a volume and run the compute() method. After the computation, algorithm status becomes equal to 0 (success) but we can’t see any changes. The matrixes of both CT and US volumes remain the same as before computation. We can’t understand where registration results are stored.
We also tried with takeOutput() method, that returns a OwningDataList containing the results, but we get a OwningDataList with size = 0.
Are we doing something wrong in the pipeline? Where can we see the registration results?
Thanks in advance for your help.
the UltrasoundRegistrationAlgorithm will run its own compounding, and the registration result will then be applied to the input sweep. No need to run the compounding yourself. Alternatively, you can also first compound, and then provide the compounded volume to the UltrasoundRegistrationAlgorithm.
For the registration to do anything, the images must be pre-aligned, so that the solution is within the capture range of the chosen similarity metric.
Hope this helps!
Thanks for your support. I tried both providing sweep and compounded volume to the UltrasoundRegistrationAlgorithm object but I still can’t see any results (the CT and US matrices are equal before and after computation).
Regarding pre-alignment, the tracking stream of the sweep has the same reference frame of CT volume, so the volumes have about the same position and orientation. There are just 3-4 centimeters of difference between them, do you think it might be too much?
Thanks in advance.
Hmm, hard to tell what went wrong then. Can you share how exactly do you call the algorithm, and the log output when running the code?
Attached please find 3 screenshots.
In the first one you can see the part of the code where I initialize and run the registration algorithm. I set the CT matrix to have the CT volume coincident with the origin [0,0,0]. US images have a track respect the same frame. Regarding the setMode methode, I tried with all the 3 possibilities (TranslationSearch, LocalRigid and LocalAffine) but nothing changes.
In the second picture you’ll find the output of the code. In the last one a visualization of CT volume, sweep and compounded US volume.
Thanks again for your help.
In general, your code looks correct.
You might want to disable the global initialization for a start, it will attempt to run some ML models to figure out the initialization, but these won’t work on this kind of data.
Can you share the log output the US registration algorithm produces? There should be something like this:
Intensity range [0..2043], scaling with 32 (TypedImage.cpp:500)
Compounding volume size 251 x 366 x 527 (GlSweepCompounding.cpp:356)
Center [-1.07e-14 -6.39e-14 2.84e-14], extent [121 176 253], spacing 0.481 (GlSweepCompounding.cpp:358)
Keeping zero values on GPU resampling is currently unsupported, switching to CPU mode (ImageResamplingAlgorithm.cpp:423)
Computing pass 2 (UltrasoundRegistrationAlgorithm.cpp:923)
LC2 PreProcessing on WATER: Ax LAVA Flex+C FT (ImageRegistration.cpp:339)
117 evaluations in 4.35095 seconds, success (Optimizer.cpp:915)
7.56767 5.97933 3.69569 -1.14127 0.38031 1.81147 -> 0.18243 (0.162454)
It is possible that the optimizer did in fact run but failed to ascertain a direction to optimize to, so after a few iterations, it will stop early and not update the matrix at all.
If you want, you can share this dataset with us (send me a PM), doesn’t look like there are privacy concerns. Oh, and if you post code, please do so in text, not as a screenshot. Easier to reproduce…
Printing out the algorithm log output has allowed me to identify the problem. The regstration was stopping because it was running out of memory. For some reason, my PC was using the built-in GPU and not the powerful one that it should have used. I solved it switching them and now the algorithm works correctly.
Thanks a lot for your support, you helped me a lot!