Compare commits
No commits in common. "rawhide" and "f27" have entirely different histories.
5 changed files with 0 additions and 317 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1 +0,0 @@
|
|||
/pygiftiio-1.0.4.tar.gz
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
from pygiftiio import *
|
||||
import numpy
|
||||
|
||||
# Read Gifti Image
|
||||
filename = '/path/to/file'
|
||||
image = gifti_read_image(fn, 1)
|
||||
|
||||
# image is now of type GiftiImage
|
||||
# The _fields_ variable is populated with the same structure
|
||||
# as the C-based struct
|
||||
# Now we query the image to get data arrays, meta data, etc.
|
||||
print "Number of Data Arrays in Image = " + str(image.numDA)
|
||||
|
||||
# Extract a dataarray from the Gifti Image based on its index.
|
||||
def get_da_from_index(im, ind):
|
||||
if ind = im.numDA:
|
||||
print "Index exceeds number of DA's in gifti image"
|
||||
|
||||
# Most things are handled automatically by the ctypes wrapping.
|
||||
# However, in the case of pointers, you need to access the
|
||||
# contents of the pointer to get the right result
|
||||
return im.darray[ind].contents
|
||||
|
||||
# Extract a dataarray from the Gifti Image based on its IntentCode
|
||||
def get_da_from_intent(im, intent):
|
||||
for i in xrange(im.numDA):
|
||||
# Intent code is stored in the DataArray struct
|
||||
da = im.darray[i].contents
|
||||
|
||||
# The wrapping allows the intent codes to be represented as
|
||||
# integers as defined by the C-Macros or as the strings that
|
||||
# are replaced.
|
||||
if type(intent) == type(1):
|
||||
if da.intent == intent:
|
||||
# Grab the first DataArray that is the correct intent
|
||||
return da
|
||||
else:
|
||||
# If it's not an int, we have to look up the integer value in
|
||||
# the Intent Code dictionary
|
||||
if da.intent == GiftiIntentCode.intents[intent]:
|
||||
return da
|
||||
|
||||
# Extract metadata from the GiftiImage OR a GiftiDataArray
|
||||
def get_metadata_from_image(im):
|
||||
metadata = im.meta
|
||||
# metadata is now of type GiftiMetaData. It has length, name, and value arrays.
|
||||
return metadata
|
||||
|
||||
# Print all the metadata in the GiftiMetaData object
|
||||
def print_metadata(md):
|
||||
size = md.length
|
||||
for i in xrange(size):
|
||||
name = md.name[i]
|
||||
val = md.value[i]
|
||||
print str(name) + ": " + str(val)
|
||||
|
||||
# Extract the Coordinate Transform(s) from a dataarray
|
||||
def get_coord_xform(da):
|
||||
dspace = da.coordsys.contents.dataspace
|
||||
xformspace = da.coordsys.contents.xformspace
|
||||
xform = da.coordsys.contents.xform
|
||||
xform_ar = numpy.array(xform) # make the list of values into an array
|
||||
xform_ar.shape = 4,4 # reshape the array into a valid transform matrix
|
||||
return xform_ar # Return a numpy array representing the transform
|
||||
|
||||
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
from pygiftiio import *
|
||||
from ctypes import *
|
||||
import numpy
|
||||
|
||||
# setup
|
||||
image = GiftiImage()
|
||||
# CTypes provides constructors for pointer-based types. This is important
|
||||
# to the initialization of the various members of the structs we need
|
||||
# to write via the library.
|
||||
image.version = c_char_p("version_string")
|
||||
image.darray = POINTER(POINTER(GiftiDataArray))()
|
||||
image.data = c_void_p(None)
|
||||
image.numDA = c_int(0)
|
||||
image.swapped = c_int(0)
|
||||
image.compressed = c_int(0)
|
||||
|
||||
# type(im) = GiftiImage
|
||||
# type(ver) = str
|
||||
def set_version(im, ver):
|
||||
image.version = c_char_p(ver)
|
||||
|
||||
# type(im) = GiftiImage
|
||||
# type(numDA) = int
|
||||
def set_numDA(im, numDA):
|
||||
im.numDA = c_int(numDA)
|
||||
|
||||
# type(im) = GiftiImage
|
||||
# type(md) = GiftiMetaData
|
||||
def set_meta_data(im, md):
|
||||
im.meta = md
|
||||
|
||||
# type(im) = GiftiImage
|
||||
# type(da) = GiftiDataArray
|
||||
def add_data_array(im, da):
|
||||
cur_numda = im.numDA
|
||||
|
||||
# Create a pointer to the new dataarray
|
||||
da_ptr = pointer(da.data)
|
||||
# Grab the pointer to the image's dataarrays
|
||||
ptr = image.darray
|
||||
|
||||
# Create a new dataarray array pointer
|
||||
ar = (POINTER(GiftiDataArray)*(cur_numda+1))()
|
||||
# We need to cast the resulting pointer for use by C
|
||||
ar = cast(ar, POINTER(POINTER(GiftiDataArray)))
|
||||
|
||||
# Copy all of the current da's to the new array. This just copies the pointers!
|
||||
for i in xrange(num_da):
|
||||
ar[i] = im.darray[i]
|
||||
|
||||
# Add the new data array to the image's data
|
||||
ar[num_da] = da_ptr
|
||||
|
||||
# Reassign the pointer
|
||||
im.darray = ar
|
||||
|
||||
# Tell the image it has an extra DA now
|
||||
cur_numda += 1
|
||||
im.numDA = c_int(cur_numda)
|
||||
|
||||
# type(da) = GiftiDataArray
|
||||
# type(axis) = int
|
||||
# type(val) = int
|
||||
def set_da_dim(da, axis, val):
|
||||
# Simple setter. However, the axis variable here is a
|
||||
# python array index (as the da dims is an array)
|
||||
# To properly assign the value, the val variable must
|
||||
# be usable by C, so we must form a c_int type.
|
||||
# This is true for all Setters.
|
||||
da.dims[axis] = c_int(val)
|
||||
|
||||
# type(filename) = string
|
||||
# type(im) = GiftiImage
|
||||
def write_image(filename, im):
|
||||
return gifti_write_image, im, filename, 1)
|
||||
|
|
@ -1,174 +0,0 @@
|
|||
# https://fedoraproject.org/wiki/Packaging:DistTag?rd=Packaging/DistTag#Conditionals
|
||||
# http://rpm.org/user_doc/conditional_builds.html
|
||||
%if 0%{?fedora} >= 30
|
||||
# disabled by default
|
||||
%bcond_with py2
|
||||
%else
|
||||
%bcond_without py2 0
|
||||
%endif
|
||||
|
||||
%global srcname pygiftiio
|
||||
|
||||
%global desc %{expand: \
|
||||
GIFTI is an XML-based file format for cortical surface data. This reference IO
|
||||
implementation is developed by the Neuroimaging Informatics Technology
|
||||
Initiative (NIfTI).}
|
||||
|
||||
Name: python-%{srcname}
|
||||
Version: 1.0.4
|
||||
Release: 28%{?dist}
|
||||
Summary: Python bindings for Gifti
|
||||
|
||||
# Automatically converted from old format: GPLv2 - review is highly recommended.
|
||||
License: GPL-2.0-only
|
||||
URL: https://www.nitrc.org/frs/?group_id=75
|
||||
Source0: https://www.nitrc.org/frs/download.php/1285/%{srcname}-%{version}.tar.gz
|
||||
Source1: https://www.nitrc.org/frs/download.php/261/gifti_write_example.py
|
||||
Source2: https://www.nitrc.org/frs/download.php/260/gifti_read_example.py
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
%description
|
||||
%{desc}
|
||||
|
||||
%if %{with py2}
|
||||
%package -n python2-%{srcname}
|
||||
Summary: %{summary}
|
||||
BuildRequires: python2-devel
|
||||
Requires: gifticlib-devel
|
||||
%{?python_provide:%python_provide python2-%{srcname}}
|
||||
|
||||
%description -n python2-%{srcname}
|
||||
%{desc}
|
||||
%endif
|
||||
|
||||
%package -n python3-%{srcname}
|
||||
Summary: %{summary}
|
||||
BuildRequires: python3-devel
|
||||
Requires: gifticlib-devel
|
||||
%{?python_provide:%python_provide python3-%{srcname}}
|
||||
|
||||
%description -n python3-%{srcname}
|
||||
%{desc}
|
||||
|
||||
|
||||
%prep
|
||||
%autosetup -n %{srcname}
|
||||
cp -v %{SOURCE1} .
|
||||
cp -v %{SOURCE2} .
|
||||
|
||||
%build
|
||||
# Nothing to do
|
||||
|
||||
%install
|
||||
# Put things where they belong
|
||||
install -D -m 0644 %{srcname}.py -t %{buildroot}/%{python3_sitelib}/
|
||||
%if %{with py2}
|
||||
install -D -m 0644 %{srcname}.py -t %{buildroot}/%{python2_sitelib}/
|
||||
%endif
|
||||
|
||||
%check
|
||||
# No tests
|
||||
|
||||
%if %{with py2}
|
||||
%files -n python2-%{srcname}
|
||||
%license LICENSE.GPL
|
||||
%doc gifti_write_example.py gifti_read_example.py
|
||||
%{python2_sitelib}/%{srcname}.py
|
||||
%{python2_sitelib}/%{srcname}.pyc
|
||||
%{python2_sitelib}/%{srcname}.pyo
|
||||
%endif
|
||||
|
||||
%files -n python3-%{srcname}
|
||||
%license LICENSE.GPL
|
||||
%doc gifti_write_example.py gifti_read_example.py
|
||||
%{python3_sitelib}/%{srcname}.py
|
||||
%{python3_sitelib}/__pycache__/%{srcname}.cpython-3*.opt-1.pyc
|
||||
%{python3_sitelib}/__pycache__/%{srcname}.cpython-3*.pyc
|
||||
|
||||
%changelog
|
||||
* Fri Sep 19 2025 Python Maint <python-maint@redhat.com> - 1.0.4-28
|
||||
- Rebuilt for Python 3.14.0rc3 bytecode
|
||||
|
||||
* Fri Aug 15 2025 Python Maint <python-maint@redhat.com> - 1.0.4-27
|
||||
- Rebuilt for Python 3.14.0rc2 bytecode
|
||||
|
||||
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-26
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
|
||||
|
||||
* Mon Jun 02 2025 Python Maint <python-maint@redhat.com> - 1.0.4-25
|
||||
- Rebuilt for Python 3.14
|
||||
|
||||
* Sat Jan 18 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-24
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
|
||||
|
||||
* Mon Jul 29 2024 Miroslav Suchý <msuchy@redhat.com> - 1.0.4-23
|
||||
- convert license to SPDX
|
||||
|
||||
* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-22
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
|
||||
|
||||
* Fri Jun 07 2024 Python Maint <python-maint@redhat.com> - 1.0.4-21
|
||||
- Rebuilt for Python 3.13
|
||||
|
||||
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-20
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-19
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-18
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 1.0.4-17
|
||||
- Rebuilt for Python 3.12
|
||||
|
||||
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-16
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-15
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 1.0.4-14
|
||||
- Rebuilt for Python 3.11
|
||||
|
||||
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-13
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-12
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 1.0.4-11
|
||||
- Rebuilt for Python 3.10
|
||||
|
||||
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-10
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-9
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 1.0.4-8
|
||||
- Rebuilt for Python 3.9
|
||||
|
||||
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.0.4-6
|
||||
- Rebuilt for Python 3.8.0rc1 (#1748018)
|
||||
|
||||
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 1.0.4-5
|
||||
- Rebuilt for Python 3.8
|
||||
|
||||
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.4-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Mon Nov 19 2018 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 1.0.4-2
|
||||
- Fix file list to cater to different py3 versions
|
||||
|
||||
* Sun Nov 18 2018 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 1.0.4-1
|
||||
- Only install py2 files conditionally
|
||||
- Initial build
|
||||
- Correct license
|
||||
1
sources
1
sources
|
|
@ -1 +0,0 @@
|
|||
SHA512 (pygiftiio-1.0.4.tar.gz) = cf5397ab971d89f1caac8f51d515ede47ad289f4ee49c5e9bedb647ce1d334b1bbe1992816607859dde11c14c40e5322d69f2e1f71c2d5efe30bf2ee9951c83e
|
||||
Loading…
Add table
Add a link
Reference in a new issue