Giter Club home page Giter Club logo

Comments (14)

ntustison avatar ntustison commented on August 30, 2024 1

Okay, I don't know why this is happening on your systems but the CMake magic that is supposed to register the IO factories is just not working when compiling ANTsR but not with ANTsRCore. That's why createJacobianDeterminantImage doesn't work but antsImageRead does. I wish I figured out a fix it but the issue appears to be system-specific and I don't have more time to play around with this at the moment. In fact, if I had more time, I would avoid having it read the file and simply input the actual ANTs image. Perhaps you should add that as a wish-list item.

For now, a workaround is to manually add the required IO factories prior to calling R CMD INSTALL ANTsR. For example, to register the NiftiIO, you would add the line

itk::NiftiImageIOFactory::RegisterOneFactory();

before line 40 of CreateJacobianDeterminantImage. You would also need to include the corresponding header #include "itkNiftiImageIOFactory.h" at the top. Fortunately, it looks like this is the only file affected.

from antsr.

ntustison avatar ntustison commented on August 30, 2024

I'm not able to reproduce. And that ITK error looks wrong as it's missing several file types. You mention that you ugraded ANTsRCore and ANTsR but I don't see where you completely re-installed ITKR. You might want to try that for a possible fix.

from antsr.

muratmaga avatar muratmaga commented on August 30, 2024

Sorry, yes ITKR also got reinstalled. And I would agree this is an ITK issue, except that antsImageRead seem to work fine with the same input.
As a temporary work around I brought back the older libraries, and everything is back to working.

I will try to rebuild the ITKR cleanly one more and see if it fixes.

from antsr.

ntustison avatar ntustison commented on August 30, 2024

antsImageRead seem to work fine with the same input.

"input", I assume, refers to the temporary warp file, mytx$fwdtransforms[[1]], correct?

from antsr.

muratmaga avatar muratmaga commented on August 30, 2024

it I used the hard coded path reported in the error, because I suspected the file got corrupted for some reason.
antsImageRead("/tmp/RtmpB9ydC3/file20a543a7faac81Warp.nii.gz")

from antsr.

ntustison avatar ntustison commented on August 30, 2024

Okay, just wanted to confirm as "input" was ambiguous and the antsImageRead call of the temp warp file is missing. I just tried it and wasn't able to reproduce the error:

> mytx$fwdtransforms[[1]]
[1] "/var/folders/5h/62f7bql14zvgx34nqwd7xvnc0000gn/T//RtmpaA01Qa/file2f11583079921Warp.nii.gz"
> antsImageRead( mytx$fwdtransforms[[1]] )
antsImage
  Pixel Type          : float 
  Components Per Pixel: 2 
  Dimensions          : 128x128 
  Voxel Spacing       : 2x2 
  Origin              : 0 0 
  Direction           : 1 0 0 1 
  Filename           : /var/folders/5h/62f7bql14zvgx34nqwd7xvnc0000gn/T//RtmpaA01Qa/file2f11583079921Warp.nii.gz 

from antsr.

muratmaga avatar muratmaga commented on August 30, 2024

This is what I am getting

>  fi<-antsImageRead( getANTsRData("r16") ,2)
>      mi<-antsImageRead( getANTsRData("r64") ,2)
>      fi<-resampleImage(fi,c(128,128),1,0)
>      mi<-resampleImage(mi,c(128,128),1,0)
>      mytx<-antsRegistration(fixed=fi , moving=mi, typeofTransform = c("SyN") )
>      jac<-createJacobianDeterminantImage(fi,mytx$fwdtransforms[[1]],1)
ITK ExceptionObject caught!
Error in createJacobianDeterminantImage(fi, mytx$fwdtransforms[[1]], 1) : 
  /usr/local/lib/R/site-library/ITKR/libs/include/ITK-5.3/itkImageFileReader.hxx:132:
 Could not create IO object for reading file /tmp/RtmpUA2gDC/file211d1753c51c041Warp.nii.gz
  Tried to create one of the following:
    MGHImageIO
  You probably failed to set a file suffix, or
    set the suffix to an unsupported type.
> test = antsImageRead(mytx$fwdtransforms[[1]])
> print(test)
antsImage
  Pixel Type          : float 
  Components Per Pixel: 2 
  Dimensions          : 128x128 
  Voxel Spacing       : 2x2 
  Origin              : 0 0 
  Direction           : 1 0 0 1 
  Filename           : /tmp/RtmpUA2gDC/file211d1753c51c041Warp.nii.gz 

Will try to rebuild ITKR from scratch

from antsr.

muratmaga avatar muratmaga commented on August 30, 2024

Himm, this is what I did

root@magalab-ML:~# cd ITKR
root@magalab-ML:~/ITKR# ./cleanup
root@magalab-ML:~/ITKR# git pull origin
Already up to date.
root@magalab-ML:~/ITKR# cd ..
root@magalab-ML:~# R CMD INSTALL ITKR

successful build, but resulted in the same error. any other suggestions

from antsr.

ntustison avatar ntustison commented on August 30, 2024

Is the error reproducible on a different machine?

from antsr.

muratmaga avatar muratmaga commented on August 30, 2024

Yep, it does on a cloud Ubuntu machine I have. Same error. I can give you access, if it helps:
image

from antsr.

muratmaga avatar muratmaga commented on August 30, 2024

I am still getting the same error after building ITKR, ANTsCore, ANTsR via R CMD INSTALL with fresh clones from the primary repo on a new system. Any help will be greatly appreciated...

from antsr.

ntustison avatar ntustison commented on August 30, 2024

I don't know. I'd have to explore a bit. If you can provide access, I can try to take a look later this week.

from antsr.

muratmaga avatar muratmaga commented on August 30, 2024

just sent you an email with access information.

from antsr.

muratmaga avatar muratmaga commented on August 30, 2024

What a bizarre situation. Thank you very much for finding a workaround. Much appreciated

from antsr.

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.