dorianps / LESYMAP

Lesion to Symptom Mapping in R
https://dorianps.github.io/LESYMAP/
Apache License 2.0
32 stars 11 forks source link

Error in registration #39

Open katmav02 opened 6 months ago

katmav02 commented 6 months ago

Hello, I am having issues completing the registration of a couple of my participants. I have successfully run numerous other ones but there are three participants where I get the following error :

Error in checkMask(subImg, subLesion) :
Mismatch directions of mask and 4D input.

I have tried to get the Direction of the mask and the lesion to check if thats the problem but when I try to run the command getDirection from the ANTs package I get this in return : Error in getDirection(mask) : could not find function "getDirection".

I also tried a different package (oro.niftii) which has a similar command but I get the following error when it tries to read my niftii file: Error in performPermutation(trans, real.dimensions, data, verbose) : Transformation is not simple, cannot reorient!

Do you have any ideas as to how I could resolve this issue which is particulalry troubling because the registration of all the other participants worked and it just those three that are getting this error.

Thank you in advance

dorianps commented 6 months ago

This is the line that is causing the error in the code: https://github.com/dorianps/LESYMAP/blob/master/R/checkMask.R#L28

I am not sure if this is a bug. Looks like you are preloading the lesion masks and the brain mask with antsImageRead. Try comparing yourself directions that are not matching with:

antsGetDirection(T1wscan)
antsGetDirection(lesionmask)

assuming T1wsan and lesionmask are the files you loaded with antsImageRead().

If they don't match, you have a problem in the header. You can also load them in ITKsnap to make sure the lesion mask overlaps properly with the visible lesion on the scan.

If you still cannot resolve the issue, please paste the code you used next time. This looks more like a problem with your data since the other scans registered fine for you.

katmav02 commented 6 months ago

Again thank you for your quick reply. I did check the directions of the T1 scans and the lesion masks and indeed they are not matching perfectly. I tried to reorient the image using the antsImageReorient but I get the error that the function "antsImageReorient" could not be found even though I have made sure that the ANTsR package has been loaded. Can I reorient the images in any other way or do you have any idea that error could be occuring even though the package is loaded ?

dorianps commented 6 months ago

Yea, not sure about re-orienting. See the ANTsR functions, looks like there is a function reorientImage: https://github.com/ANTsX/ANTsR/blob/master/R/reorientImage.R

If the differences are just tiny in float points etc, you could just copy the headers. Whatever you do, load them in ITKsnap to make sure everthing is aligned after. You have problems with lesion not being drawn fully on the scan, so you need to understand why that happened, in my opinion.