How to register 3d example dataset on colab?

106 views
Skip to first unread message

Tanmay Nath

unread,
Nov 15, 2019, 1:35:06 PM11/15/19
to Deformetrica

Hi, I am using the deformetrica 4.0.3rc to register the 3d example brain dataset on colab and I am constantly getting the following error message which I believe is due to keops library. I tested the installation of keops using http://www.kernel-operations.io/keops/python/installation.html and it seems to work. I also have my cmake installed on the colab.


I am able to run the provided colab notebook (with skull dataset)but since it does not use the keops library, it works fine. If I try to change the kernel to torch while running the registration, then the notebook crashes! (maybe because keops handles memory better!) Could you please help in running the example dataset on colab?


Thank you!


Here is the full error message:

`/content/drive/My Drive/examples Logger has been set to: INFO

No initial CP spacing given: using diffeo kernel width of 10.0 OMP_NUM_THREADS found in environment variables. Using value OMP_NUM_THREADS=2 context has already been set No specified state-file. By default, Deformetrica state will by saved in file: output/deformetrica-state.p. Using a Sobolev gradient for the template data with the ScipyLBFGS estimator memory length being larger than 1. Beware: that can be tricky. {'optimization_method_type': 'ScipyLBFGS', 'save-every-n-iters': 10, 'print-every-n-iters': 1, 'convergence-tolerance': 0.0001, 'initial-step-size': 1e-06, 'downsampling-factor': 2, 'freeze-template': 1, 'max_iterations': 50, 'max_line_search_iterations': 10, 'callback': <function estimator_callback at 0x7fe65b7a07b8>, 'gpu_mode': <GpuMode.KERNEL: 4>, 'state_file': 'output/deformetrica-state.p', 'load_state_file': False, 'memory_length': 10} Set of 7942 control points defined. Momenta initialized to zero, for 1 subjects. Started estimator: ScipyOptimize

Scipy optimization method: L-BFGS-B

------------------------------------- Iteration: 1 ------------------------------------- Compiling libKeOpstorch7a00fab597 in /root/.cache/pykeops-1.0.1/: formula: Sum_Reduction(Exp(-G*SqDist(X,Y)) * P,0) aliases: G = Pm(0,1); X = Vi(1,3); Y = Vj(2,3); P = Vj(3,3); dtype : float32 ... Done.

ImportError Traceback (most recent call last) /usr/local/lib/python3.7/site-packages/pykeops/common/keops_io.py in load_keops(formula, aliases, dtype, lang, optional_flags) 44 # high frequency path ---> 45 return importlib.import_module(dll_name) 46 except ImportError:

46 frames ImportError: dynamic module does not define module export function (PyInit_libKeOpstorch7a00fab597)

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last) ImportError: dynamic module does not define module export function (PyInit_libKeOpstorch7a00fab597)

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last) /usr/lib/python3.6/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)

ImportError: dynamic module does not define module export function (PyInit_libKeOpstorch7a00fab597)


NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the "Open Examples" button below.

Alexandre Bône

unread,
Nov 16, 2019, 6:13:30 AM11/16/19
to Deformetrica
Hello Tanmay, 

Could you please share your colab ? 

I will try to give it a look, but I admit already that this error seems rather exotic to me. My first simple attempt would be to delete the folder /root/.cache/pykeops-1.0.1 and run again the script. 
Then I guess the way to go would be to contact the PyKeops developers. 

Best, 
Alex

Tanmay Nath

unread,
Nov 18, 2019, 10:03:12 PM11/18/19
to Deformetrica
Hi Alex,

Thank you for your response. It seems the issue was the Pykeops version! I see that deformetrica freezes the pykeops version to 1.0.1, but for some unknown reason, my pykeops version was 1.2. Downgrading to 1.0.1 fixes the error!

Attached is the notebook that I am using!

Also, I noticed that even if I change the parameters for printing(i.e. print-every-n-iters), it still prints at every iteration.

If I understand correctly, the filename DeterministicAtlas__Reconstruction__brains__XXXX.nii is the final registered image while the DeterministicAtlas__flow__brains__subject_XXXX__tp_0.nii are the intermedite files . Right? 

Please feel free to comment, in case you see my optimization parameters are incorrect. 
Thanks
Tanmay
registration.ipynb
Reply all
Reply to author
Forward
0 new messages