Skip to content

Commit

Permalink
Merge pull request #19 from mrphys/develop
Browse files Browse the repository at this point in the history
Release 0.14.0
  • Loading branch information
jmontalt authored Mar 29, 2022
2 parents 7fb996c + 279bb69 commit 2fc819a
Show file tree
Hide file tree
Showing 13 changed files with 905 additions and 52 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ versions of TensorFlow and TensorFlow MRI according to the table below.
====================== ======================== ============
TensorFlow MRI Version TensorFlow Compatibility Release Date
====================== ======================== ============
v0.14.0 v2.8.x Mar 29, 2022
v0.13.0 v2.8.x Mar 15, 2022
v0.12.0 v2.8.x Mar 14, 2022
v0.11.0 v2.8.x Mar 10, 2022
Expand Down
37 changes: 33 additions & 4 deletions RELEASE.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,38 @@
Release 0.13.0
Release 0.14.0
==============

Major Features and Improvements
-------------------------------

* Moved most API endpoints into submodules. Direct access to these operators
from the ``tfmri`` namespace is still possible, but this use is deprecated
and will be removed in Release 1.0.0.
* ``tfmri.convex``:

* Added new classes ``ConvexFunctionNorm``, ``ConvexFunctionIndicatorBall``,
``ConvexFunctionIndicatorL1Ball`` and ``ConvexFunctionIndicatorL2Ball``.
* Added new method ``conj`` to ``ConvexFunction`` and its subclasses to
support computation of convex conjugates.

* ``tfmri.math``:

* Added new indicator functions: ``indicator_box``, ``indicator_simplex`` and
``indicator_ball``.
* Added new projection functions: ``project_onto_box``,
``project_onto_simplex`` and ``project_onto_ball``.

* ``tfmri.plot``:

* ``image_sequence`` and ``tiled_image_sequence`` now support RGB(A) data.
* ``image_sequence`` and ``tiled_image_sequence`` now support use of
titles via the arguments ``fig_title`` and ``subplot_titles``.


Bug Fixes and Other Changes
---------------------------

* ``tfmri.convex``:

* ``ConvexFunction`` will no longer raise an error when passed a
``tf.Tensor`` in the ``scale`` parameter.

* ``tfmri.sampling``:

* ``spiral_trajectory`` will now return a tensor with known static shape.
2 changes: 1 addition & 1 deletion tensorflow_mri/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
__summary__ = "A collection of TensorFlow add-ons for computational MRI."
__uri__ = "https://github.com/mrphys/tensorflow-mri"

__version__ = "0.13.0"
__version__ = "0.14.0"

__author__ = "Javier Montalt Tordera"
__email__ = "javier.montalt@outlook.com"
Expand Down
63 changes: 61 additions & 2 deletions tensorflow_mri/cc/ops/traj_ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,71 @@ limitations under the License.
#include "tensorflow/core/framework/op.h"
#include "tensorflow/core/framework/shape_inference.h"

#include "spiral_waveform.h"

using namespace tensorflow;


Status SpiralWaveformShapeFn(shape_inference::InferenceContext* c) {

const PartialTensorShape output_shape({-1, 2});

int base_resolution;
int spiral_arms;
float field_of_view;
float max_grad_ampl;
float min_rise_time;
float dwell_time;
float readout_os;
float gradient_delay;
float larmor_const;
float vd_inner_cutoff;
float vd_outer_cutoff;
float vd_outer_density;
string vd_type_str;

TF_RETURN_IF_ERROR(c->GetAttr("base_resolution", &base_resolution));
TF_RETURN_IF_ERROR(c->GetAttr("spiral_arms", &spiral_arms));
TF_RETURN_IF_ERROR(c->GetAttr("field_of_view", &field_of_view));
TF_RETURN_IF_ERROR(c->GetAttr("max_grad_ampl", &max_grad_ampl));
TF_RETURN_IF_ERROR(c->GetAttr("min_rise_time", &min_rise_time));
TF_RETURN_IF_ERROR(c->GetAttr("dwell_time", &dwell_time));
TF_RETURN_IF_ERROR(c->GetAttr("readout_os", &readout_os));
TF_RETURN_IF_ERROR(c->GetAttr("gradient_delay", &gradient_delay));
TF_RETURN_IF_ERROR(c->GetAttr("larmor_const", &larmor_const));
TF_RETURN_IF_ERROR(c->GetAttr("vd_inner_cutoff", &vd_inner_cutoff));
TF_RETURN_IF_ERROR(c->GetAttr("vd_outer_cutoff", &vd_outer_cutoff));
TF_RETURN_IF_ERROR(c->GetAttr("vd_outer_density", &vd_outer_density));
TF_RETURN_IF_ERROR(c->GetAttr("vd_type", &vd_type_str));

SpiralWaveform::VDType vd_type;
if (vd_type_str == "linear") {
vd_type = SpiralWaveform::VDType::Linear;
} else if (vd_type_str == "quadratic") {
vd_type = SpiralWaveform::VDType::Quadratic;
} else if (vd_type_str == "hanning") {
vd_type = SpiralWaveform::VDType::Hanning;
}

// At the moment we do not have a way to infer the output shape of the
// waveform without actually computing it, so we compute the waveform.
float waveform_ptr[SWF_MAX_WAVEFORM_SIZE * 2];
long waveform_length = 0;
int result = calculate_spiral_trajectory(&waveform_ptr[0],
&waveform_length,
(long) base_resolution,
(long) spiral_arms,
(double) field_of_view,
(double) max_grad_ampl,
(double) min_rise_time,
(double) dwell_time,
(double) readout_os,
(double) gradient_delay,
(double) larmor_const,
(double) vd_inner_cutoff,
(double) vd_outer_cutoff,
(double) vd_outer_density,
(int) vd_type);

const PartialTensorShape output_shape({waveform_length, 2});

shape_inference::ShapeHandle shape_handle;
TF_RETURN_IF_ERROR(c->MakeShapeFromPartialTensorShape(output_shape, &shape_handle));
Expand Down
Loading

0 comments on commit 2fc819a

Please sign in to comment.