Deepreg: Preprocessing tool - resampling

Created on 8 Oct 2020  路  12Comments  路  Source: DeepRegNet/DeepReg

Subject of the feature

A pre-processing tool - either on-the-fly or batch-processing - to take anisotropic images with varying sizes and resample (=cropping+resizing) them into the isotropic volumes with the same size and voxel dimensions - a "safe" way for deepreg.

Has the feature been requested before? If yes, please provide a link to the issue.
No

If the feature request is approved, would you be willing to submit a PR? _(Help can be
provided if you need assistance submitting a PR)_
Yes

docs feature question test

Most helpful comment

in a user-case scenario for paired images one would want the bigger cropped to the size of smaller, but consistently not randomly

All 12 comments

@ciphercharly

This can be further related to #99. So we can either prepare them and save into pngs, or go one step further save into tf records.

But for this issue only, it should be quite simple for only resizing. Btw, the cropping here is random cropping or fixed cropping?

in a user-case scenario for paired images one would want the bigger cropped to the size of smaller, but consistently not randomly

This can be further related to #99. So we can either prepare them and save into pngs, or go one step further save into tf records.

But for this issue only, it should be quite simple for only resizing. Btw, the cropping here is random cropping or fixed cropping?

not pngs please... ;)

only focus on on-th-fly required pre=process per discussion

Revisiting this issue and my current understanding is to add a sampling function in data loader like:

Given a big image of size 500x500x500, we might want to do random crop of size 100x100x100 randomly from this image. Each time, we crop only one image per sample.

So this is about using https://www.tensorflow.org/api_docs/python/tf/image/random_crop. Is that what you suggested? @ciphercharly

Otherwise, we may want to sample multiple patches randomly or from the foreground per sample, which will be more complicated.

mmh no I didn't :) but i think this shifted away from the initial discussion
which was about.. automatic resizing of the fixed/moving images in the case where they differ, I think?

so to clarify: in a paired scenario for example, now the fixed/moving images do not need to be the same size (but they do need to have the same name, which is a bit confusing btw) for the code to run, but conceptually they should have the same size, right? like, in my case the vibe- and T2-channel images have different original sizes so I pre-process them separately by resizing the T2 channel in the shape of the vibe.. I think YipengHu was suggesting to have this automatically done by the data loader

maybe I misunderstood, sorry, my initial discussion was about that anyway

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Currently, deepreg supports loading images of different size, they will be resized to the same shape (which is defined in the config) automatically.

Code is here: https://github.com/DeepRegNet/DeepReg/blob/7c22a30ef27d7ff1bec5d21cbdb1a25f65cd5027/deepreg/dataset/loader/interface.py#L104

Sorry for the delay, does this solve your problem? @ciphercharly

I think it does, haven't update the git pull for a while now, but I think this means I can have whatever shapes for the nifti files in the train/test/validation datasets and the resize will happen automatically, right? so yeah

I think it does, haven't update the git pull for a while now, but I think this means I can have whatever shapes for the nifti files in the train/test/validation datasets and the resize will happen automatically, right? so yeah

That is correct.

ok perfect, thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mathpluscode picture mathpluscode  路  3Comments

NMontanaBrown picture NMontanaBrown  路  6Comments

mathpluscode picture mathpluscode  路  6Comments

NMontanaBrown picture NMontanaBrown  路  5Comments

mathpluscode picture mathpluscode  路  6Comments