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

antsBOLDNetworkAnalysis function and example #409

Open
DavidBarriere opened this issue Nov 15, 2024 · 0 comments
Open

antsBOLDNetworkAnalysis function and example #409

DavidBarriere opened this issue Nov 15, 2024 · 0 comments

Comments

@DavidBarriere
Copy link

Describe the bug
function : antsBOLDNetworkAnalysis doesnt work even in the example provided.

myimg <- antsImageRead(getANTsRData( "ch2" ), 3)
mylab <- antsImageRead(getANTsRData( "ch2a" ), 3)
boldfn <- getANTsRData( "pcasl" )
bold <- antsImageRead( boldfn , 4 )
avgbold <- getAverageOfTimeSeries( bold )
breg <- antsRegistration( avgbold, myimg, typeofTransform = c("AffineFast") )
warpedParcellation <- antsApplyTransforms( avgbold, mylab,
transformlist=breg$fwdtransforms, interpolator="NearestNeighbor" )
mask <- getMask( avgbold )
result <- antsBOLDNetworkAnalysis( bold=bold, mask=mask, warpedParcellation )

Erreur dans missing(k) || is.na(k) :
'length = 18' in coercion to 'logical(1)'

Probably because of splitNDImageToList function :
{
if (class(img) != "antsImage")
stop("Input is not antsImage.")
mydimv = dim(img)
mydim = img@dimension
if (img@dimension < 3)
stop("Input image dimensionality needs to be 3 or greater")
newimgs = list()
for (z in 1:mydimv[mydim]) {
if (mydim == 3)
newimgs[[z]] = makeImage(mydimv[-mydim], img[1:mydimv[1],
1:mydimv[2], z])
if (mydim == 4)
newimgs[[z]] = makeImage(mydimv[-mydim], img[1:mydimv[1],
1:mydimv[2], 1:mydimv[3], z])

}
direction = antsGetDirection(img)[-mydim, -mydim]
spacing = antsGetSpacing(img)[-mydim]
origin = antsGetOrigin(img)[-mydim]
for (im in newimgs) {
antsSetDirection(im, direction)
antsSetSpacing(im, spacing)
antsSetOrigin(im, origin)
}
return(newimgs)
}

When I test as follow I got the error :
**z=1
newimgs[[z]] = makeImage(mydimv[-mydim], img[1:mydimv[1],

  •                                          +                 1:mydimv[2], 1:mydimv[3], z])
    

Erreur dans missing(k) || is.na(k) :
'length = 18' in coercion to 'logical(1)'**

or here :
> img[1:mydimv[1],1:mydimv[2], 1:mydimv[3], z]
Erreur dans missing(k) || is.na(k) :
'length = 18' in coercion to 'logical(1)'

> toto=img[1:64,1:64, 1:18, ]
Erreur dans missing(k) || is.na(k) :
'length = 18' in coercion to 'logical(1)'

but works when I do this :
toto=img[1:64,1:64, , ]

A problem for switching between class 2 matrix ?

Thank you

David

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant