Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
slicetimer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
slicetimer
Commits
81c11e77
Commit
81c11e77
authored
19 years ago
by
Stephen Smith
Browse files
Options
Downloads
Patches
Plain Diff
added --tglobal option and fixed offset for --tcustom option
parent
a2c010a8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
slicetimer.cc
+19
-13
19 additions, 13 deletions
slicetimer.cc
with
19 additions
and
13 deletions
slicetimer.cc
+
19
−
13
View file @
81c11e77
...
...
@@ -41,7 +41,7 @@ Option<bool> odd(string("--odd"), false,
string
(
"use interleaved acquisition"
),
false
,
no_argument
);
Option
<
bool
>
down
(
string
(
"--down"
),
false
,
string
(
"reverse slice indexing"
),
string
(
"reverse slice indexing
(default is: slices were acquired bottom-up)
"
),
false
,
no_argument
);
Option
<
string
>
inputname
(
string
(
"-i,--in"
),
string
(
""
),
string
(
"filename of input timeseries"
),
...
...
@@ -52,6 +52,9 @@ Option<string> outputname(string("-o,--out"), string(""),
Option
<
string
>
tcustom
(
string
(
"--tcustom"
),
string
(
""
),
string
(
"filename of single-column custom interleave timing file"
),
false
,
requires_argument
);
Option
<
float
>
tglobal
(
string
(
"--tglobal"
),
0.5
,
string
(
"global shift (default is 0.5 = no shift)"
),
false
,
requires_argument
);
Option
<
string
>
ocustom
(
string
(
"--ocustom"
),
string
(
""
),
string
(
"filename of single-column custom interleave order file (first slice is referred to as 1 not 0)"
),
false
,
requires_argument
);
...
...
@@ -106,45 +109,47 @@ int do_slice_correction()
ColumnVector
userkernel
=
sinckernel1D
(
"hanning"
,
7
,
1201
);
// for(int i=1; i<=1201; i++) cout << i << " " << userkernel(i) << endl;
float
recenter
=
(((
float
)
no_slices
)
/
2
-
0.5
)
/
no_slices
;
float
recenter
=
(((
float
)
no_slices
)
/
2
-
0.5
)
/
no_slices
;
// only valid for slice-count-based corrections
for
(
int
slice
=
1
;
slice
<=
no_slices
;
slice
++
)
{
if
(
tcustom
.
set
())
{
offset
=
-
timings
(
slice
,
1
);
if
(
tglobal
.
set
())
{
offset
=
0.5
-
tglobal
.
value
();
}
else
if
(
tcustom
.
set
())
{
offset
=
0.5
-
timings
(
slice
,
1
);
}
else
if
(
ocustom
.
set
())
{
int
local_count
=
1
;
while
(
local_count
<=
no_slices
)
{
if
(
timings
(
local_count
,
1
)
==
slice
)
{
offset
=
-
(
local_count
-
1
)
*
(
slice_spacing
/
repeat_time
);
offset
=
recenter
-
(
local_count
-
1
)
*
(
slice_spacing
/
repeat_time
);
local_count
=
no_slices
+
1
;
}
else
local_count
++
;
}
}
else
if
(
odd
.
value
())
{
// acquisition order: 1,3,5, ..., 2,4,6 ...
if
((
slice
%
2
)
==
0
)
// even
offset
=
-
(
ceil
((
float
)
no_slices
/
2
)
+
((
slice
-
1
)
/
2
))
*
(
slice_spacing
/
repeat_time
);
offset
=
recenter
-
(
ceil
((
float
)
no_slices
/
2
)
+
((
slice
-
1
)
/
2
))
*
(
slice_spacing
/
repeat_time
);
else
offset
=
-
((
slice
-
1
)
/
2
)
*
(
slice_spacing
/
repeat_time
);
offset
=
recenter
-
((
slice
-
1
)
/
2
)
*
(
slice_spacing
/
repeat_time
);
}
else
if
(
down
.
value
())
{
offset
=
-
(
no_slices
-
slice
)
*
(
slice_spacing
/
repeat_time
);
offset
=
recenter
-
(
no_slices
-
slice
)
*
(
slice_spacing
/
repeat_time
);
}
else
{
offset
=
-
(
slice
-
1
)
*
(
slice_spacing
/
repeat_time
);
offset
=
recenter
-
(
slice
-
1
)
*
(
slice_spacing
/
repeat_time
);
}
for
(
int
x_pos
=
0
;
x_pos
<
timeseries
.
xsize
();
x_pos
++
)
for
(
int
y_pos
=
0
;
y_pos
<
timeseries
.
ysize
();
y_pos
++
){
ColumnVector
voxeltimeseries
=
timeseries
.
voxelts
(
x_pos
,
y_pos
,
slice
-
1
);
ColumnVector
interpseries
=
voxeltimeseries
;
for
(
int
time_step
=
1
;
time_step
<=
no_volumes
;
time_step
++
){
// interpseries(time_step) = interpolate_1d(voxeltimeseries, time_step - offset
- recenter
);
interpseries
(
time_step
)
=
kernelinterpolation_1d
(
voxeltimeseries
,
time_step
-
offset
-
recenter
,
userkernel
,
7
);
// interpseries(time_step) = interpolate_1d(voxeltimeseries, time_step - offset);
interpseries
(
time_step
)
=
kernelinterpolation_1d
(
voxeltimeseries
,
time_step
-
offset
,
userkernel
,
7
);
}
timeseries
.
setvoxelts
(
interpseries
,
x_pos
,
y_pos
,
slice
-
1
);
}
if
(
verbose
.
value
())
cerr
<<
"Slice "
<<
slice
<<
" offset "
<<
offset
+
recenter
<<
endl
;
cerr
<<
"Slice "
<<
slice
<<
" offset "
<<
offset
<<
endl
;
}
if
(
direction
.
value
()
==
1
)
timeseries
.
swapdimensions
(
3
,
2
,
1
);
// reverse Flip z and x
...
...
@@ -170,6 +175,7 @@ int main (int argc,char** argv)
options
.
add
(
direction
);
options
.
add
(
odd
);
options
.
add
(
tcustom
);
options
.
add
(
tglobal
);
options
.
add
(
ocustom
);
options
.
parse_command_line
(
argc
,
argv
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment