* Bug Fix
  Before : pipeline script broken because of permutation of axes after reading the image.
  Fix : Not permuting the axes after reading image. Instead doing the permutation for every access of the image in R using methods 'GetVector' and like.

* Bug Fix
  Before : 'as.antsMatrix' produced garbage values in the matrix as shown by 'as.data.frame'.
  Fix : Setting the number of rows and cols for the matrix was wrong and has been fixed.

* Update
  'antsr_frequency_filter' modified to accept and return data.frames instead of files.

* Update
  ANTS 'sccan.cxx' modified so it can accept and return images for the option '--svd sparse' and like. This enables us to have the following script working.
-----------------------------------------------------------------------------------------------------
library(ANTsR)
img = antsImageRead( "KKI2009-01-fMRI.nii" , "float" , 4 )
avg_img = new( "antsImage" , "float" , 3 )
antsMotionCorr( list( d = 3 , a = img , o = avg_img ) )
moco_img = new( "antsImage" , "float" , 4 )
moco_params = new( "antsMatrix" , "double" )
antsMotionCorr( list( d = 3 , o = list( moco_params , moco_img , avg_img ) , m = list( name = "MI" , avg_img , img , 1 , 32 , 50 ) , t = "Rigid[0.01]" , i = 25 , u = 1 , e = 1 , s = 0 , f = 1 , n = 25 ) )
bm_img = new( "antsImage" , "float" , 3 )
ThresholdImage( 3 , avg_img , bm_img , "Otsu" , 3 )
ThresholdImage( 3 , bm_img , bm_img , 2 , 3 )
ImageMath( 3 , bm_img , "ME" , bm_img , 1 )
ImageMath( 3 , bm_img , "GetLargestComponent" , bm_img )
ImageMath( 3 , bm_img , "MD" , bm_img , 1 )
ImageMath( 3 , bm_img , "ME" , bm_img , 1 )
compcorr_corr_img = new( "antsImage" , "float" , 4 )
compcorr_var_img = new( "antsImage" , "float" , 3 )
ImageMath( 4 , antsImagePair( compcorr_corr_img , compcorr_var_img ) , "CompCorrAuto" , moco_img , bm_img , 6 )
N3BiasFieldCorrection( 3 , avg_img , avg_img , 2 , bm_img )
N3BiasFieldCorrection( 3 , avg_img , avg_img , 1 , bm_img )
N3BiasFieldCorrection( 3 , avg_img , avg_img , 1 , bm_img )
N3BiasFieldCorrection( 3 , avg_img , avg_img , 1 , bm_img )
bm_img_uint = antsImageClone( bm_img , "unsigned int" )
seg_img_uint = new( "antsImage" , "unsigned int" , 3 )
Atropos( list( d = 3 , a = avg_img , a = compcorr_var_img , m = "[0.3,1x1x1]" , o = seg_img_uint , c = "[5,0]" , i = "kmeans[3]" , x = bm_img_uint ) )
prob_img_list = new( "antsImageList" , "float" , 3 )
Atropos( list( d = 3 , a = avg_img , a = compcorr_var_img , m = "[0.3,1x1x1]" , o = list( seg_img_uint , prob_img_list ) , c = "[5,0]" , i = "kmeans[3]" , x = bm_img_uint ) )
Atropos( list( d = 3 , a = avg_img , a = compcorr_var_img , m = "[0.3,1x1x1]" , o = list( seg_img_uint , prob_img_list ) , c = "[5,0]" , i = list( name = "priorprobabilityimages" , 3 , prob_img_list , 0 ) , x = bm_img_uint ) )
seg_img_float = antsImageClone( seg_img_uint , "float" )
cortmask_img = new( "antsImage" , "float" , 3 )
ThresholdImage( 3 , seg_img_float , cortmask_img , 2 , 2 )
cortmask_img_double = antsImageClone( cortmask_img , "double" )
moco_img_double = antsImageClone( moco_img , "double" )
mat = new( "antsMatrix" , "double" )
sccan( list( "timeseriesimage-to-matrix" = list( moco_img_double , cortmask_img_double , 0.0 , 0.0  ) , o = mat ) )
filt_mat_df = antsr_frequency_filter( values = as.data.frame(mat) , tr = 0.15 , freqLo = 0.03 , freqHi = 0.1 )
filt_mat_df = as.data.frame( filt_mat_df )
filt_mat = as.antsMatrix( filt_mat_df , "double" )
mat1 = new( "antsMatrix" , "double" )
mat2 = new( "antsMatrix" , "double" )
imglist = new( "antsImageList" , "double" , 3 )
sccan( list( svd = list( name = "sparse" , filt_mat , cortmask_img_double , -0.15 ) , n = 40 , i = 40 , PClusterThresh = 50 , o = list( mat1 , imglist , mat2 ) ) )
-----------------------------------------------------------------------------------------------------