Skip to content

Commit 05f3c72

Browse files
committed
make get_nw_clip_block_params flexible to all GGIR versions
1 parent 743189c commit 05f3c72

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

R/runActimetric.R

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,15 @@ runActimetric = function(input_directory = NULL, output_directory = NULL, studyn
217217
hvars = GGIR::g.extractheadervars(I)
218218
sf = I$sf
219219
# Extract parameters for reading file in chunks as in GGIR R package
220-
readParams = GGIR::get_nw_clip_block_params(monc = I$monc, dformat = I$dformc,
221-
sf = sf, params_rawdata = GGIR::load_params()$params_rawdata)
220+
# the if statement makes this flexible to adapt to different GGIR versions
221+
if ("chunksize" %in% names(as.list(args(GGIR::get_nw_clip_block_params)))) {
222+
readParams = GGIR::get_nw_clip_block_params(chunksize = 1, dynrange = 8,
223+
monc = I$monc, dformat = I$dformc,
224+
sf = sf, rmc.dynamic_range = NULL)
225+
} else {
226+
readParams = GGIR::get_nw_clip_block_params(monc = I$monc, dformat = I$dformc,
227+
sf = sf, params_rawdata = GGIR::load_params()$params_rawdata)
228+
}
222229
blocksize = readParams$blocksize
223230
isLastBlock = FALSE
224231
blocknumber = 1; iteration = 1

0 commit comments

Comments
 (0)