Skip to content

Confused about constructor #46

@PetrKryslUCSD

Description

@PetrKryslUCSD

Why does the constructor not refer to the type of the element of raw?
The lines

NIVolume(header::NIfTI1Header, extensions::Vector{NIfTI1Extension}, raw::AbstractArray{T,N}) where {T<:Number,N} =
,
NIVolume{typeof(one(T)*1f0+1f0),N,typeof(raw)}(header, extensions, raw)

create the volume of type Float32 instead of T. Shouldn't this be

NIVolume(header::NIfTI1Header, extensions::Vector{NIfTI1Extension}, raw::AbstractArray{T,N}) where {T<:Number,N} = let
    NIVolume{T,N,typeof(raw)}(header, extensions, raw)
    # Why is this not using T? That is the type of the `raw` array elements!?
    #NIVolume{typeof(one(T)*1f0+1f0),N,typeof(raw)}(header, extensions, raw)
end

?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions