Coder Social home page Coder Social logo

Comments (5)

matthew-brett avatar matthew-brett commented on June 15, 2024

Ah - has_data_slope refers to the class. ie nifti1 headers have a data slope. Probably a bit confusing...

from nibabel.

matthew-brett avatar matthew-brett commented on June 15, 2024

@yarikoptic - any comments here? Maybe renaming the class attribute? To something like 'can_use_slope' or something?

from nibabel.

yarikoptic avatar yarikoptic commented on June 15, 2024

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.

matthew-brett avatar matthew-brett commented on June 15, 2024

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.

yarikoptic avatar yarikoptic commented on June 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.