Comments (5)
Ah - has_data_slope refers to the class. ie nifti1 headers have a data slope. Probably a bit confusing...
from nibabel.
@yarikoptic - any comments here? Maybe renaming the class attribute? To something like 'can_use_slope' or something?
from nibabel.
Ah -- "has_data_slope refers to the class" -- sorry I have missed it I guess... Now that I know that it refers to description of a format not to a particular instance, meaning became clearer, so if you like feel free to leave it alone. Alternatively indeed it could be renamed -- not sure how many people use it though (and how many have the same incorrect understanding behind as I had) so may be break of API would be actually helpful.
May be it is worth unifying specification of format 'features'? I see that nibabel/imageclasses.py defines a class_map (with e.g. has_affine) and there is also has_data_intercept ... what if classes define something like
.properties = dict(ext=['.mgz', '.mgh'], has_affine=True, has_data_intercept=False, ....)
and then class_map just contains 'class' and the rest get assembled from classes' .properties?
Just an idea...
from nibabel.
On Fri, Mar 2, 2012 at 10:11 AM, Yaroslav Halchenko
[email protected]
wrote:
Ah -- "has_data_slope refers to the class" -- sorry I have missed it I guess... Now that I know that it refers to description of a format not to a particular instance, meaning became clearer, so if you like feel free to leave it alone. Alternatively indeed it could be renamed -- not sure how many people use it though (and how many have the same incorrect understanding behind as I had) so may be break of API would be actually helpful.
May be it is worth unifying specification of format 'features'? I see that nibabel/imageclasses.py defines a class_map (with e.g. has_affine) and there is also has_data_intercept ... what if classes define something like
.properties = dict(ext=['.mgz', '.mgh'], has_affine=True, has_data_intercept=False, ....)
and then class_map just contains 'class' and the rest get assembled from classes' .properties?
Yes... Could be nice. The disadvantage of that is that you lose the
inheritance. For example. nifti inherits from SPMAnalyze and
therefore gets 'has_data_slope'. But with a dictionary you have to
fill each class fresh.
from nibabel.
yes -- inheritance is lost... but could be easily compensated to mimic
inheritance:
class A(object):
properties = {1: 'a',
'persist': 1}
class B(A):
properties = A.properties.copy()
properties[1] = 'b' # changed
properties[2] = 'new'
print A.properties
print B.properties
results in desired
{1: 'a', 'persist': 1}
{1: 'b', 2: 'new', 'persist': 1}
Yes... Could be nice. The disadvantage of that is that you lose the
inheritance. For example. nifti inherits from SPMAnalyze and
therefore gets 'has_data_slope'. But with a dictionary you have to
fill each class fresh.
=------------------------------------------------------------------=
Keep in touch www.onerussian.com
Yaroslav Halchenko www.ohloh.net/accounts/yarikoptic
from nibabel.
Related Issues (20)
- Reading CAT12 geometries HOT 6
- Loss of Data Precision Issue When Saving Nifti1Image HOT 2
- `file` constructor in `doc/source/devel/register_me.py` HOT 6
- Add test runners for non-x86/x64 architectures
- Segfaulting on test_array_interface_with_dtype and numpy 2.0-dev HOT 3
- 1 test fails: test_pkg_info HOT 3
- Request: stop throwing ExpiredDeprecationError HOT 23
- Add M1 runners
- Shape mismatch HOT 1
- Please port to Python3.12 HOT 3
- python-nibabel fails to build with Python 3.13: AttributeError: module 'logging' has no attribute 'warn'; indentation in docstrings mismatch, AssertionError HOT 2
- Is support for memory maps discontinued? HOT 2
- Might lead to MemoryError on i386 HOT 3
- Trying to access dlabel.nii dynamic field HOT 1
- Noisy UserWarning is thrown (`np.longdouble`) when importing `nibabel` with `numpy>=1.25` on WSL1 HOT 2
- Two tests are failing in 5.2.1 with Python 3.13.0a5
- 270 tests fail because of quote issues HOT 3
- BUG: Bug with NumPy 2.0 HOT 3
- Add free-threaded CI build HOT 1
- data.shape has one more dimension
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nibabel.