Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
miscmaths
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
miscmaths
Commits
9ced3739
Commit
9ced3739
authored
19 years ago
by
Stephen Smith
Browse files
Options
Downloads
Patches
Plain Diff
CVS: ----------------------------------------------------------------------
parent
80761757
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
volumeseries.cc
+74
-61
74 additions, 61 deletions
volumeseries.cc
volumeseries.h
+1
-0
1 addition, 0 deletions
volumeseries.h
with
75 additions
and
61 deletions
volumeseries.cc
+
74
−
61
View file @
9ced3739
...
@@ -154,76 +154,54 @@ namespace MISCMATHS {
...
@@ -154,76 +154,54 @@ namespace MISCMATHS {
volinfo
.
miscinfo
=
FslInit
();
volinfo
.
miscinfo
=
FslInit
();
FslCloneHeader
(
volinfo
.
miscinfo
,
IP
);
FslCloneHeader
(
volinfo
.
miscinfo
,
IP
);
size_t
imagesize
=
x
*
y
*
z
*
v
;
size_t
imagesize
=
x
*
y
*
z
;
FslGetDataType
(
IP
,
&
type
);
FslGetDataType
(
IP
,
&
type
);
output
.
ReSize
(
v
,
x
*
y
*
z
);
output
.
ReSize
(
v
,
x
*
y
*
z
);
switch
(
type
)
for
(
size_t
i
=
1
;
i
<=
(
size_t
)
v
;
i
++
)
{
{
case
DT_SIGNED_SHORT
:
switch
(
type
)
{
{
short
*
sbuffer
=
new
short
[
imagesize
];
case
DT_SIGNED_SHORT
:
FslReadVolumes
(
IP
,
sbuffer
,
v
);
size_t
volsize
=
volinfo
.
x
*
volinfo
.
y
*
volinfo
.
z
;
size_t
volstart
=
1
;
for
(
size_t
i
=
1
;
i
<=
(
size_t
)
v
;
i
++
)
{
{
volstart
=
(
i
-
1
)
*
volsize
;
short
*
sbuffer
=
new
short
[
imagesize
];
for
(
size_t
j
=
1
;
j
<=
(
size_t
)
x
*
y
*
z
;
j
++
)
FslReadVolumes
(
IP
,
sbuffer
,
1
);
for
(
size_t
j
=
1
;
j
<=
imagesize
;
j
++
)
{
{
if
(
doscaling
==
0
)
{
output
(
i
,
j
)
=
sbuffer
[
volstart
+
j
-
1
];
}
if
(
doscaling
==
0
)
{
output
(
i
,
j
)
=
sbuffer
[
j
-
1
];
}
else
{
output
(
i
,
j
)
=
(
slope
*
sbuffer
[
volstart
+
j
-
1
])
+
intercept
;}
else
{
output
(
i
,
j
)
=
(
slope
*
sbuffer
[
j
-
1
])
+
intercept
;}
}
}
delete
[]
sbuffer
;
}
}
break
;
delete
[]
sbuffer
;
case
DT_FLOAT
:
}
break
;
case
DT_FLOAT
:
{
float
*
fbuffer
=
new
float
[
imagesize
];
FslReadVolumes
(
IP
,
fbuffer
,
v
);
size_t
volsize
=
volinfo
.
x
*
volinfo
.
y
*
volinfo
.
z
;
size_t
volstart
=
1
;
for
(
size_t
i
=
1
;
i
<=
(
size_t
)
v
;
i
++
)
{
{
volstart
=
(
i
-
1
)
*
volsize
;
float
*
fbuffer
=
new
float
[
imagesize
];
for
(
size_t
j
=
1
;
j
<=
(
size_t
)
x
*
y
*
z
;
j
++
)
FslReadVolumes
(
IP
,
fbuffer
,
1
);
for
(
size_t
j
=
1
;
j
<=
imagesize
;
j
++
)
{
{
if
(
doscaling
==
0
)
{
output
(
i
,
j
)
=
fbuffer
[
volstart
+
j
-
1
];
}
if
(
doscaling
==
0
)
{
output
(
i
,
j
)
=
fbuffer
[
j
-
1
];
}
else
{
output
(
i
,
j
)
=
(
slope
*
fbuffer
[
volstart
+
j
-
1
])
+
intercept
;}
else
{
output
(
i
,
j
)
=
(
slope
*
fbuffer
[
j
-
1
])
+
intercept
;}
}
}
delete
[]
fbuffer
;
}
}
delete
[]
fbuffer
;
break
;
}
case
DT_UNSIGNED_CHAR
:
break
;
case
DT_UNSIGNED_CHAR
:
{
unsigned
char
*
cbuffer
=
new
unsigned
char
[
imagesize
];
FslReadVolumes
(
IP
,
cbuffer
,
v
);
size_t
volsize
=
volinfo
.
x
*
volinfo
.
y
*
volinfo
.
z
;
size_t
volstart
=
1
;
for
(
size_t
i
=
1
;
i
<=
(
size_t
)
v
;
i
++
)
{
{
volstart
=
(
i
-
1
)
*
volsize
;
unsigned
char
*
cbuffer
=
new
unsigned
char
[
imagesize
];
for
(
size_t
j
=
1
;
j
<=
(
size_t
)
x
*
y
*
z
;
j
++
)
FslReadVolumes
(
IP
,
cbuffer
,
1
);
for
(
size_t
j
=
1
;
j
<=
imagesize
;
j
++
)
{
{
if
(
doscaling
==
0
)
{
output
(
i
,
j
)
=
cbuffer
[
volstart
+
j
-
1
];
}
if
(
doscaling
==
0
)
{
output
(
i
,
j
)
=
cbuffer
[
j
-
1
];
}
else
{
output
(
i
,
j
)
=
(
slope
*
cbuffer
[
volstart
+
j
-
1
])
+
intercept
;}
else
{
output
(
i
,
j
)
=
(
slope
*
cbuffer
[
j
-
1
])
+
intercept
;}
}
}
delete
[]
cbuffer
;
}
}
delete
[]
cbuffer
;
break
;
}
default
:
break
;
perror
(
"FslRead: DT not supported"
);
default
:
}
perror
(
"FslRead: DT not supported"
);
}
}
FslClose
(
IP
);
FslClose
(
IP
);
...
@@ -252,23 +230,58 @@ namespace MISCMATHS {
...
@@ -252,23 +230,58 @@ namespace MISCMATHS {
FslSetIntent
(
OP
,
volinfo
.
intent_code
,
volinfo
.
intent_p1
,
volinfo
.
intent_p2
,
FslSetIntent
(
OP
,
volinfo
.
intent_code
,
volinfo
.
intent_p1
,
volinfo
.
intent_p2
,
volinfo
.
intent_p3
);
volinfo
.
intent_p3
);
int
volStart
=
1
;
int
volSize
=
getNumSeries
();
int
volSize
=
getNumSeries
();
int
volNum
=
getNumVolumes
();
int
volNum
=
getNumVolumes
();
float
*
qv
=
new
float
[
volSize
*
volNum
];
FslWriteHeader
(
OP
);
float
*
qv
=
new
float
[
volSize
];
for
(
int
i
=
1
;
i
<=
volNum
;
i
++
)
for
(
int
i
=
1
;
i
<=
volNum
;
i
++
)
{
{
volStart
=
(
i
-
1
)
*
volSize
;
for
(
int
j
=
1
;
j
<=
volSize
;
j
++
)
for
(
int
j
=
1
;
j
<=
volSize
;
j
++
)
{
qv
[
j
-
1
]
=
(
*
this
)(
i
,
j
);
qv
[
volStart
+
j
-
1
]
=
(
*
this
)(
i
,
j
);
FslWriteVolumes
(
OP
,
qv
,
1
);
}
}
}
delete
[]
qv
;
FslClose
(
OP
);
}
void
VolumeSeries
::
writeThresholdedSeriesAsFloat
(
const
VolumeInfo
&
pvolinfo
,
const
ColumnVector
&
in
,
const
string
&
fname
)
{
volinfo
=
pvolinfo
;
preThresholdPositions
=
in
;
Time_Tracer
ts
(
string
(
"VolumeSeries::writeThresholdedSeriesAsFloat"
+
fname
).
c_str
());
FSLIO
*
OP
=
FslOpen
(
fname
.
c_str
(),
"wb"
);
FslCloneHeader
(
OP
,
volinfo
.
miscinfo
);
FslSetDim
(
OP
,
volinfo
.
x
,
volinfo
.
y
,
volinfo
.
z
,
volinfo
.
v
);
FslSetVoxDim
(
OP
,
volinfo
.
vx
,
volinfo
.
vy
,
volinfo
.
vz
,
volinfo
.
tr
);
FslSetDataType
(
OP
,
DT_FLOAT
);
FslSetIntent
(
OP
,
volinfo
.
intent_code
,
volinfo
.
intent_p1
,
volinfo
.
intent_p2
,
volinfo
.
intent_p3
);
int
volSize
=
getUnthresholdNumSeries
();
int
numThresholdedSeries
=
getNumSeries
();
int
volNum
=
getNumVolumes
();
FslWriteHeader
(
OP
);
FslWriteHeader
(
OP
);
FslWriteVolumes
(
OP
,
qv
,
volNum
);
float
*
qv
=
new
float
[
volSize
];
for
(
int
i
=
1
;
i
<=
volNum
;
i
++
)
{
for
(
int
j
=
1
;
j
<=
volSize
;
j
++
)
qv
[
j
-
1
]
=
0
;
for
(
int
j
=
1
;
j
<=
numThresholdedSeries
;
j
++
)
qv
[
int
(
preThresholdPositions
(
j
))
-
1
]
=
(
*
this
)(
i
,
j
);
FslWriteVolumes
(
OP
,
qv
,
1
);
}
delete
[]
qv
;
delete
[]
qv
;
...
...
This diff is collapsed.
Click to expand it.
volumeseries.h
+
1
−
0
View file @
9ced3739
...
@@ -98,6 +98,7 @@ namespace MISCMATHS {
...
@@ -98,6 +98,7 @@ namespace MISCMATHS {
void
read
(
const
string
&
fname
);
void
read
(
const
string
&
fname
);
void
writeAsInt
(
const
string
&
fname
);
void
writeAsInt
(
const
string
&
fname
);
void
writeAsFloat
(
const
string
&
fname
);
void
writeAsFloat
(
const
string
&
fname
);
void
writeThresholdedSeriesAsFloat
(
const
VolumeInfo
&
pvolinfo
,
const
ColumnVector
&
in
,
const
string
&
fname
);
void
replaceMeans
();
void
replaceMeans
();
...
...
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