Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/source/code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Code Documentation
.. toctree::
:maxdepth: 2


affine_trans
ffd
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove ffd, add free_form

ffd_parameters
Expand Down
8 changes: 0 additions & 8 deletions docs/source/ffd.rst

This file was deleted.

7 changes: 7 additions & 0 deletions docs/source/free_form.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Free Form Deformation
=====================

.. automodule:: pygem.free_form

.. autoclass:: FFD
:members:
7 changes: 4 additions & 3 deletions pygem/ffd_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class FFDParameters(object):
"""
Class that handle the Free Form Deformation parameters in terms of FFD bounding box and
Class that handles the Free Form Deformation parameters in terms of FFD bounding box and
weight of the FFD control points.

:param list n_control_points: number of control points in the x, y, and z direction.
Expand Down Expand Up @@ -102,9 +102,10 @@ def __init__(self, n_control_points=None):

def read_parameters_file(self, filename=None):
"""
Reads in the parameters file and fill the self structure.

:param string filename: parameters file to be read in.

.. todo::
DOCS
"""
if not isinstance(filename, basestring):
raise TypeError("filename must be a string")
Expand Down
12 changes: 10 additions & 2 deletions pygem/ffd.py → pygem/free_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@

class FFD(object):
"""
DOCS
Class that handles the Free Form Deformation on the mesh points.

:param class ffd_parameters: parameters of the Free Form Deformation.
:param numpy.ndarray original_mesh_points: coordinates of the original points of the mesh.

:return: modified_mesh_points: coordinates of the modified points of the mesh.
:rtype: numpy.ndarray
"""

def __init__(self, ffd_parameters, original_mesh_points):
Expand Down Expand Up @@ -77,9 +83,11 @@ def perform(self):
or (reference_frame_mesh_points[i, 1] > 1) or (reference_frame_mesh_points[i, 2] > 1):
shift_mesh_points[i, :] = 0

return self._transform_points(shift_mesh_points + reference_frame_mesh_points, \
modified_mesh_points = self._transform_points(shift_mesh_points + reference_frame_mesh_points, \
inverse_transformation) + translation

return modified_mesh_points


def _transform_points(self, original_points, transformation):
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ffd.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

from unittest import TestCase
import unittest
import pygem.ffd as ffd
import pygem.free_form as ffd
import pygem.ffd_parameters as ffdp
import pygem.file_handler as fh
import numpy as np
Expand Down