Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change density to density_compensators #114

Merged

Conversation

Lenoush
Copy link
Contributor

@Lenoush Lenoush commented May 23, 2024

change : tfmri.estimate_density( samples, shape, method="pipe", max_iter=15)
to : tf.math.reciprocal_no_nan(tfmri.estimate_density( samples, shape, method="pipe", max_iter=15 ))

  • need to add test

@Lenoush Lenoush linked an issue May 23, 2024 that may be closed by this pull request
@paquiteau
Copy link
Member

Don't worry too much about the density tests, density compensations methods will probably need a new tests setup in the future.

@paquiteau paquiteau added this to the v0.9.0 milestone May 23, 2024
@chaithyagr
Copy link
Member

This can be merged, @paquiteau ?

@paquiteau
Copy link
Member

Maybe we should add the same normalization as you did for gpuNUFFT ?

@chaithyagr
Copy link
Member

chaithyagr commented May 24, 2024

I was just going through the codes, we seem to have redundant similar pipe code at:

def pipe(samples, shape, n_iter=15):
"""Estimate the density compensation using the pipe method.
Parameters
----------
samples: Tensor
The samples location of shape ``Nsamples x N_dimensions``.
It should be C-contiguous.
shape: tuple
Shape of the image space.
n_iter: int
Number of iterations.
Returns
-------
Tensor
The estimated density compensation.
"""
return tfmri.estimate_density(samples, shape, method="pipe", max_iter=n_iter)

@Lenoush maybe can you do the same update there also and then make the call to the pipe class method? See what is done in gpuNUFFT to get clarity.

Also can you please also implement the normalization like it is done at :

https://github.com/chaithyagr/mri-nufft/blob/45bc400b2cfec8abee4c550780f7a6e5f1fa433c/src/mrinufft/operators/interfaces/gpunufft.py#L512-L517

Copy link
Member

@paquiteau paquiteau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there ! This keeps getting better.

.vscode/settings.json Outdated Show resolved Hide resolved
src/mrinufft/operators/interfaces/tfnufft.py Outdated Show resolved Hide resolved
src/mrinufft/operators/interfaces/tfnufft.py Show resolved Hide resolved
@chaithyagr
Copy link
Member

One final thing left I guess: Change test_gpunufft.py to test_density,py and add a test to test the pipe method from tfnufft also.

Copy link
Member

@chaithyagr chaithyagr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, We can merge this right @paquiteau ?

@paquiteau paquiteau merged commit 8d11977 into master Jun 25, 2024
8 checks passed
@paquiteau paquiteau deleted the 109-tensorflow-nufft-density-is-not-density_compensation branch June 25, 2024 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tensorflow-NUFFT density is not density_compensation
3 participants