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

ENH: simpler imports, image decorator, and better code organization #637

Merged
merged 15 commits into from
May 18, 2024
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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The general workflow for wrapping a library calls involves the following steps:

- write a wrapper python function (e.g. `def atropos(...)`)
- build up a list or dictionary of string argument names as in ANTs
- pass those raw arguments through the function `utils._int_antsProcessArguments(args)`
- pass those raw arguments through the function `process_arguments(args)`
- pass those processed arguments into the library call (e.g. `lib.Atropos(processed_args)`).

## Writing custom code for antspy
Expand Down
13 changes: 7 additions & 6 deletions ants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
__version__ = '0.5.3'

from .core import *
from .utils import *
from .segmentation import *
from .registration import *
from .label import *
from .learn import *
from .viz import *

from . import contrib
from .math import *
from .ops import *
from .plotting import *
from .registration import *
from .segmentation import *
from .utils import *
Empty file removed ants/contrib/__init__.py
Empty file.
105 changes: 40 additions & 65 deletions ants/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,65 +1,40 @@

from .ants_image_io import (
image_header_info,
image_clone,
image_read,
dicom_read,
image_write,
make_image,
matrix_to_images,
images_from_matrix,
image_list_to_matrix,
images_to_matrix,
matrix_from_images,
timeseries_to_matrix,
matrix_to_timeseries,
from_numpy,
_from_numpy
)

from .ants_image import (
ANTsImage,
copy_image_info,
set_origin,
get_origin,
set_direction,
get_direction,
set_spacing,
get_spacing,
image_physical_space_consistency,
image_type_cast,
allclose
)

from .ants_metric_io import (
new_ants_metric,
create_ants_metric,
supported_metrics
)

from .ants_transform_io import (
create_ants_transform,
new_ants_transform,
read_transform,
write_transform,
transform_from_displacement_field,
transform_to_displacement_field
)

from .ants_transform import (
ANTsTransform,
set_ants_transform_parameters,
get_ants_transform_parameters,
get_ants_transform_fixed_parameters,
set_ants_transform_fixed_parameters,
apply_ants_transform,
apply_ants_transform_to_point,
apply_ants_transform_to_vector,
apply_ants_transform_to_image,
invert_ants_transform,
compose_ants_transforms,
transform_index_to_physical_point,
transform_physical_point_to_index
)


from .ants_image_io import (image_header_info,
image_clone,
image_read,
dicom_read,
image_write,
make_image,
from_numpy,
new_image_like)
from .ants_image import (copy_image_info,
set_origin,
get_origin,
set_direction,
get_direction,
set_spacing,
get_spacing,
is_image,
from_pointer)
from .ants_metric_io import (new_ants_metric,
create_ants_metric,
supported_metrics)
from .ants_transform_io import (create_ants_transform,
new_ants_transform,
read_transform,
write_transform,
transform_from_displacement_field,
transform_to_displacement_field,
fsl2antstransform)
from .ants_transform import (ANTsTransform,
set_ants_transform_parameters,
get_ants_transform_parameters,
get_ants_transform_fixed_parameters,
set_ants_transform_fixed_parameters,
apply_ants_transform,
apply_ants_transform_to_point,
apply_ants_transform_to_vector,
apply_ants_transform_to_image,
invert_ants_transform,
compose_ants_transforms,
transform_index_to_physical_point,
transform_physical_point_to_index)
Loading