Skip to content

Commit

Permalink
Merge pull request #702 from rijobro/process_undeprecate
Browse files Browse the repository at this point in the history
remove NiftyResample::process deprecation, improve documentation
  • Loading branch information
KrisThielemans committed Jun 5, 2020
2 parents 18132d3 + e525c66 commit 08d0547
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 18 deletions.
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* A passthrough for both the maximum and minimum relative change during OSMAPOSL reconstruction has been added.
* We have now corrected the geometrical information of `.h5` images (coming from ISMRMRD and Gadgetron). This means we can now convert them to other SIRF image types (e.g., `NiftiImageData` and `STIRImageData`). This is necessary for any kind of synergistic reconstruction. Further, to the best of our knowledge, this is the first ISMRMRD to NIfTI converter out there!
* The adjoint transformation has now been implemented for `NiftyResample` through the wrapping of NiftyMoMo.
* `Resample::process()` has been marked as deprecated. Instead, the following methods have been added to C++, python and matlab NiftyResample:
* The following methods have been added to C++, python and matlab NiftyResample:
* `out = forward(in)`
* `forward(out, in)`
* `out = adjoint(in)`
Expand Down
29 changes: 21 additions & 8 deletions doc/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -595,12 +595,22 @@ Below examples are given for rigid/affine and non-rigid registrations, as well a
##### Resampling (NiftyResample)
###### Methods

set_reference_image Set the reference image
set_floating_image Set the floating
process Start the registration process
get_output Get the registered image
add_transformation Add transformation (any type)
set_interpolation_type Set interpolation type
set_reference_image Set the reference image
set_floating_image Set the floating
process Start the resampling process.
This is the equivalent of
forward(floating_image).
get_output Get the registered image
add_transformation Add transformation (any type)
clear_transformations Remove all transformations
set_interpolation_type Set interpolation type
forward(im, out=None) Resample image in forward direction.
Image should have same properties as
floating image used in set_up.
backward(im, out=None) Resample image in backward/adjoint direction.
Image should have same properties as
reference image used in set_up.
adjoint(im, out=None) Alias of backward.

###### Example
res = NiftyResample()
Expand All @@ -609,8 +619,11 @@ Below examples are given for rigid/affine and non-rigid registrations, as well a
res.set_interpolation_type(1)
res.add_transformation(trans1)
res.add_transformation(trans2)
res.process()
output = res.get_output()
out = res.forward(flo)
# No allocation, faster
res.forward(flo, out=out)
# Backwards/adjoint
out2 = res.adjoint(ref)

### Other classes <a name="Other_classes"></a>

Expand Down
4 changes: 2 additions & 2 deletions src/Registration/cReg/include/sirf/Reg/NiftyResample.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ class NiftyResample : public Resample<dataType>
/// Destructor
virtual ~NiftyResample() {}

/// Process
DEPRECATED virtual void process();
/// Process. Equivalent of calling forward(floating_image). Use get_output to get resampled image.
virtual void process();

/// Do the forward transformation
virtual std::shared_ptr<ImageData> forward(const std::shared_ptr<const ImageData> input_sptr);
Expand Down
4 changes: 2 additions & 2 deletions src/Registration/cReg/include/sirf/Reg/Resample.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ class Resample
/// Set padding value
void set_padding_value(const float padding_value) { _padding_value = padding_value; }

/// Process - will call forward
DEPRECATED virtual void process() = 0;
/// Process. Equivalent of calling forward(floating_image). Use get_output to get resampled image.
virtual void process() = 0;

/// Get output
const std::shared_ptr<const ImageData> get_output_sptr() const { return _output_image_sptr; }
Expand Down
2 changes: 1 addition & 1 deletion src/Registration/mReg/+sirf/+Reg/NiftyResample.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function set_padding_value(self, val)
sirf.Reg.setParameter(self.handle_, self.name, 'padding', val, 'f')
end
function process(self)
%Process.
%Process. Equivalent of calling forward(floating_image). Use get_output to get resampled image.
h = calllib('mreg', 'mReg_NiftyResample_process', self.handle_);
sirf.Utilities.check_status([self.name ':process'], h);
sirf.Utilities.delete(h)
Expand Down
5 changes: 1 addition & 4 deletions src/Registration/pReg/Reg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Object-Oriented wrap for the cReg-to-Python interface pyreg.py

import abc
import sys
import deprecation

from pUtilities import *
from sirf import SIRF
Expand Down Expand Up @@ -954,10 +953,8 @@ class NiftyResample(object):
"""Set padding value."""
parms.set_float_par(self.handle, self.name, 'padding', val)

@deprecation.deprecated(deprecated_in="2.1.0",
details="Use forward(image) instead")
def process(self):
"""Process."""
"""Process. Equivalent of calling forward(floating_image). Use get_output to get resampled image."""
try_calling(pyreg.cReg_NiftyResample_process(self.handle))

def get_output(self):
Expand Down

0 comments on commit 08d0547

Please sign in to comment.