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
1656c6aa
Commit
1656c6aa
authored
20 years ago
by
David Flitney
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
2f1606bd
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
volume.cc
+27
-27
27 additions, 27 deletions
volume.cc
volumeseries.cc
+20
-19
20 additions, 19 deletions
volumeseries.cc
with
47 additions
and
46 deletions
volume.cc
+
27
−
27
View file @
1656c6aa
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
#include
<iostream>
#include
<iostream>
#include
<cstdlib>
#include
<cstdlib>
#include
"
avwio/avw
io.h"
#include
"
fslio/fsl
io.h"
#include
"newmatap.h"
#include
"newmatap.h"
#include
"newmatio.h"
#include
"newmatio.h"
...
@@ -129,12 +129,12 @@ namespace MISCMATHS {
...
@@ -129,12 +129,12 @@ namespace MISCMATHS {
float
fmin
,
fmax
;
float
fmin
,
fmax
;
const
ColumnVector
&
outputvol
=
*
this
;
const
ColumnVector
&
outputvol
=
*
this
;
AVW
*
OP
=
Avw
Open
(
fname
.
c_str
(),
"wc"
);
FSLIO
*
OP
=
Fsl
Open
(
fname
.
c_str
(),
"wc"
);
Avw
SetDim
(
OP
,
volinfo
.
x
,
volinfo
.
y
,
volinfo
.
z
,
1
);
Fsl
SetDim
(
OP
,
volinfo
.
x
,
volinfo
.
y
,
volinfo
.
z
,
1
);
Avw
SetVoxDim
(
OP
,
volinfo
.
vx
,
volinfo
.
vy
,
volinfo
.
vz
,
0
);
Fsl
SetVoxDim
(
OP
,
volinfo
.
vx
,
volinfo
.
vy
,
volinfo
.
vz
,
0
);
Avw
SetDataType
(
OP
,
DT_FLOAT
);
Fsl
SetDataType
(
OP
,
DT_FLOAT
);
Avw
SetOriginator
(
OP
,
volinfo
.
originator
);
Fsl
SetOriginator
(
OP
,
volinfo
.
originator
);
int
sizeVol
=
outputvol
.
Nrows
();
int
sizeVol
=
outputvol
.
Nrows
();
...
@@ -152,15 +152,15 @@ namespace MISCMATHS {
...
@@ -152,15 +152,15 @@ namespace MISCMATHS {
qv
[
i
-
1
]
=
outputvol
(
i
);
qv
[
i
-
1
]
=
outputvol
(
i
);
}
}
Avw
SetMinMax
(
OP
,
(
short
)
fmin
,
(
short
)
fmax
);
Fsl
SetMinMax
(
OP
,
(
short
)
fmin
,
(
short
)
fmax
);
// fwrite(qv,sizeVol*sizeof(float),1,OP->imgfp);
// fwrite(qv,sizeVol*sizeof(float),1,OP->imgfp);
//fwrite(&OP->header,sizeof(OP->header),1,OP->hdrfp);
//fwrite(&OP->header,sizeof(OP->header),1,OP->hdrfp);
Avw
WriteVolumes
(
OP
,
qv
,
1
);
Fsl
WriteVolumes
(
OP
,
qv
,
1
);
delete
[]
qv
;
delete
[]
qv
;
Avw
Close
(
OP
);
Fsl
Close
(
OP
);
}
}
void
Volume
::
writeAsInt
(
const
string
&
fname
)
void
Volume
::
writeAsInt
(
const
string
&
fname
)
...
@@ -169,12 +169,12 @@ namespace MISCMATHS {
...
@@ -169,12 +169,12 @@ namespace MISCMATHS {
int
fmin
,
fmax
;
int
fmin
,
fmax
;
const
ColumnVector
&
outputvol
=
*
this
;
const
ColumnVector
&
outputvol
=
*
this
;
AVW
*
OP
=
Avw
Open
(
fname
.
c_str
(),
"wc"
);
FSLIO
*
OP
=
Fsl
Open
(
fname
.
c_str
(),
"wc"
);
Avw
SetDim
(
OP
,
volinfo
.
x
,
volinfo
.
y
,
volinfo
.
z
,
1
);
Fsl
SetDim
(
OP
,
volinfo
.
x
,
volinfo
.
y
,
volinfo
.
z
,
1
);
Avw
SetVoxDim
(
OP
,
volinfo
.
vx
,
volinfo
.
vy
,
volinfo
.
vz
,
0
);
Fsl
SetVoxDim
(
OP
,
volinfo
.
vx
,
volinfo
.
vy
,
volinfo
.
vz
,
0
);
Avw
SetDataType
(
OP
,
DT_SIGNED_SHORT
);
Fsl
SetDataType
(
OP
,
DT_SIGNED_SHORT
);
Avw
SetOriginator
(
OP
,
volinfo
.
originator
);
Fsl
SetOriginator
(
OP
,
volinfo
.
originator
);
int
sizeVol
=
outputvol
.
Nrows
();
int
sizeVol
=
outputvol
.
Nrows
();
...
@@ -192,34 +192,34 @@ namespace MISCMATHS {
...
@@ -192,34 +192,34 @@ namespace MISCMATHS {
qv
[
i
-
1
]
=
(
short
)
outputvol
(
i
);
qv
[
i
-
1
]
=
(
short
)
outputvol
(
i
);
}
}
Avw
SetMinMax
(
OP
,
(
short
)
fmin
,
(
short
)(
fmax
+
0.9999
));
Fsl
SetMinMax
(
OP
,
(
short
)
fmin
,
(
short
)(
fmax
+
0.9999
));
Avw
WriteVolumes
(
OP
,
qv
,
1
);
Fsl
WriteVolumes
(
OP
,
qv
,
1
);
delete
[]
qv
;
delete
[]
qv
;
Avw
Close
(
OP
);
Fsl
Close
(
OP
);
}
}
void
Volume
::
read
(
const
string
&
fname
)
void
Volume
::
read
(
const
string
&
fname
)
{
{
Time_Tracer
ts
(
string
(
"Volume::read"
+
fname
).
c_str
());
Time_Tracer
ts
(
string
(
"Volume::read"
+
fname
).
c_str
());
AVW
*
IP
=
Avw
Open
(
fname
.
c_str
(),
"r"
);
FSLIO
*
IP
=
Fsl
Open
(
fname
.
c_str
(),
"r"
);
ColumnVector
&
output
=
*
this
;
ColumnVector
&
output
=
*
this
;
short
x
,
y
,
z
,
v
,
type
;
short
x
,
y
,
z
,
v
,
type
;
float
vx
,
vy
,
vz
,
tr
;
float
vx
,
vy
,
vz
,
tr
;
Avw
GetDim
(
IP
,
&
x
,
&
y
,
&
z
,
&
v
);
Fsl
GetDim
(
IP
,
&
x
,
&
y
,
&
z
,
&
v
);
Avw
GetVoxDim
(
IP
,
&
vx
,
&
vy
,
&
vz
,
&
tr
);
Fsl
GetVoxDim
(
IP
,
&
vx
,
&
vy
,
&
vz
,
&
tr
);
Avw
GetOriginator
(
IP
,
volinfo
.
originator
);
Fsl
GetOriginator
(
IP
,
volinfo
.
originator
);
volinfo
.
x
=
x
;
volinfo
.
y
=
y
;
volinfo
.
z
=
z
;
volinfo
.
v
=
v
;
volinfo
.
x
=
x
;
volinfo
.
y
=
y
;
volinfo
.
z
=
z
;
volinfo
.
v
=
v
;
volinfo
.
vx
=
vx
;
volinfo
.
vy
=
vy
;
volinfo
.
vz
=
vz
;
volinfo
.
tr
=
tr
;
volinfo
.
vx
=
vx
;
volinfo
.
vy
=
vy
;
volinfo
.
vz
=
vz
;
volinfo
.
tr
=
tr
;
size_t
imagesize
=
x
*
y
*
z
;
size_t
imagesize
=
x
*
y
*
z
;
Avw
GetDataType
(
IP
,
&
type
);
Fsl
GetDataType
(
IP
,
&
type
);
output
.
ReSize
(
x
*
y
*
z
);
output
.
ReSize
(
x
*
y
*
z
);
...
@@ -228,7 +228,7 @@ namespace MISCMATHS {
...
@@ -228,7 +228,7 @@ namespace MISCMATHS {
case
DT_SIGNED_SHORT
:
case
DT_SIGNED_SHORT
:
{
{
short
*
sbuffer
=
new
short
[
imagesize
];
short
*
sbuffer
=
new
short
[
imagesize
];
Avw
ReadVolumes
(
IP
,
sbuffer
,
v
);
Fsl
ReadVolumes
(
IP
,
sbuffer
,
v
);
for
(
size_t
j
=
1
;
j
<=
(
size_t
)
x
*
y
*
z
;
j
++
)
for
(
size_t
j
=
1
;
j
<=
(
size_t
)
x
*
y
*
z
;
j
++
)
{
{
...
@@ -241,7 +241,7 @@ namespace MISCMATHS {
...
@@ -241,7 +241,7 @@ namespace MISCMATHS {
case
DT_FLOAT
:
case
DT_FLOAT
:
{
{
float
*
fbuffer
=
new
float
[
imagesize
];
float
*
fbuffer
=
new
float
[
imagesize
];
Avw
ReadVolumes
(
IP
,
fbuffer
,
v
);
Fsl
ReadVolumes
(
IP
,
fbuffer
,
v
);
for
(
size_t
j
=
1
;
j
<=
(
size_t
)
x
*
y
*
z
;
j
++
)
for
(
size_t
j
=
1
;
j
<=
(
size_t
)
x
*
y
*
z
;
j
++
)
{
{
...
@@ -254,7 +254,7 @@ namespace MISCMATHS {
...
@@ -254,7 +254,7 @@ namespace MISCMATHS {
case
DT_UNSIGNED_CHAR
:
case
DT_UNSIGNED_CHAR
:
{
{
unsigned
char
*
cbuffer
=
new
unsigned
char
[
imagesize
];
unsigned
char
*
cbuffer
=
new
unsigned
char
[
imagesize
];
Avw
ReadVolumes
(
IP
,
cbuffer
,
v
);
Fsl
ReadVolumes
(
IP
,
cbuffer
,
v
);
for
(
size_t
j
=
1
;
j
<=
(
size_t
)
x
*
y
*
z
;
j
++
)
for
(
size_t
j
=
1
;
j
<=
(
size_t
)
x
*
y
*
z
;
j
++
)
{
{
...
@@ -265,10 +265,10 @@ namespace MISCMATHS {
...
@@ -265,10 +265,10 @@ namespace MISCMATHS {
}
}
break
;
break
;
default
:
default
:
perror
(
"
Avw
Read: DT not supported"
);
perror
(
"
Fsl
Read: DT not supported"
);
}
}
Avw
Close
(
IP
);
Fsl
Close
(
IP
);
return
;
return
;
}
}
...
...
This diff is collapsed.
Click to expand it.
volumeseries.cc
+
20
−
19
View file @
1656c6aa
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
#include
<iostream>
#include
<iostream>
#include
<cstdlib>
#include
<cstdlib>
#include
"
avwio/avw
io.h"
#include
"
fslio/fsl
io.h"
#include
"newmatap.h"
#include
"newmatap.h"
#include
"newmatio.h"
#include
"newmatio.h"
...
@@ -97,7 +97,8 @@ namespace MISCMATHS {
...
@@ -97,7 +97,8 @@ namespace MISCMATHS {
cerr << "j = " << j+1 << endl;
cerr << "j = " << j+1 << endl;
}
}
*/
*/
if
(
m
>
thresh
&&
s
>
0.0
)
if
(
m
>
thresh
&&
s
>
1e-10
)
{
{
j
++
;
j
++
;
preThresholdPositions
(
j
)
=
i
;
preThresholdPositions
(
j
)
=
i
;
...
@@ -133,21 +134,21 @@ namespace MISCMATHS {
...
@@ -133,21 +134,21 @@ namespace MISCMATHS {
{
{
Time_Tracer
ts
(
string
(
"VolumeSeries::read-"
+
fname
).
c_str
());
Time_Tracer
ts
(
string
(
"VolumeSeries::read-"
+
fname
).
c_str
());
AVW
*
IP
=
Avw
Open
(
fname
.
c_str
(),
"r"
);
FSLIO
*
IP
=
Fsl
Open
(
fname
.
c_str
(),
"r"
);
Matrix
&
output
=
*
this
;
Matrix
&
output
=
*
this
;
short
x
,
y
,
z
,
v
,
type
;
short
x
,
y
,
z
,
v
,
type
;
float
vx
,
vy
,
vz
,
tr
;
float
vx
,
vy
,
vz
,
tr
;
Avw
GetDim
(
IP
,
&
x
,
&
y
,
&
z
,
&
v
);
Fsl
GetDim
(
IP
,
&
x
,
&
y
,
&
z
,
&
v
);
Avw
GetVoxDim
(
IP
,
&
vx
,
&
vy
,
&
vz
,
&
tr
);
Fsl
GetVoxDim
(
IP
,
&
vx
,
&
vy
,
&
vz
,
&
tr
);
Avw
GetOriginator
(
IP
,
volinfo
.
originator
);
Fsl
GetOriginator
(
IP
,
volinfo
.
originator
);
volinfo
.
x
=
x
;
volinfo
.
y
=
y
;
volinfo
.
z
=
z
;
volinfo
.
v
=
v
;
volinfo
.
x
=
x
;
volinfo
.
y
=
y
;
volinfo
.
z
=
z
;
volinfo
.
v
=
v
;
volinfo
.
vx
=
vx
;
volinfo
.
vy
=
vy
;
volinfo
.
vz
=
vz
;
volinfo
.
tr
=
tr
;
volinfo
.
vx
=
vx
;
volinfo
.
vy
=
vy
;
volinfo
.
vz
=
vz
;
volinfo
.
tr
=
tr
;
size_t
imagesize
=
x
*
y
*
z
*
v
;
size_t
imagesize
=
x
*
y
*
z
*
v
;
Avw
GetDataType
(
IP
,
&
type
);
Fsl
GetDataType
(
IP
,
&
type
);
output
.
ReSize
(
v
,
x
*
y
*
z
);
output
.
ReSize
(
v
,
x
*
y
*
z
);
...
@@ -157,7 +158,7 @@ namespace MISCMATHS {
...
@@ -157,7 +158,7 @@ namespace MISCMATHS {
{
{
short
*
sbuffer
=
new
short
[
imagesize
];
short
*
sbuffer
=
new
short
[
imagesize
];
Avw
ReadVolumes
(
IP
,
sbuffer
,
v
);
Fsl
ReadVolumes
(
IP
,
sbuffer
,
v
);
size_t
volsize
=
volinfo
.
x
*
volinfo
.
y
*
volinfo
.
z
;
size_t
volsize
=
volinfo
.
x
*
volinfo
.
y
*
volinfo
.
z
;
size_t
volstart
=
1
;
size_t
volstart
=
1
;
...
@@ -177,7 +178,7 @@ namespace MISCMATHS {
...
@@ -177,7 +178,7 @@ namespace MISCMATHS {
case
DT_FLOAT
:
case
DT_FLOAT
:
{
{
float
*
fbuffer
=
new
float
[
imagesize
];
float
*
fbuffer
=
new
float
[
imagesize
];
Avw
ReadVolumes
(
IP
,
fbuffer
,
v
);
Fsl
ReadVolumes
(
IP
,
fbuffer
,
v
);
size_t
volsize
=
volinfo
.
x
*
volinfo
.
y
*
volinfo
.
z
;
size_t
volsize
=
volinfo
.
x
*
volinfo
.
y
*
volinfo
.
z
;
size_t
volstart
=
1
;
size_t
volstart
=
1
;
...
@@ -195,7 +196,7 @@ namespace MISCMATHS {
...
@@ -195,7 +196,7 @@ namespace MISCMATHS {
case
DT_UNSIGNED_CHAR
:
case
DT_UNSIGNED_CHAR
:
{
{
unsigned
char
*
cbuffer
=
new
unsigned
char
[
imagesize
];
unsigned
char
*
cbuffer
=
new
unsigned
char
[
imagesize
];
Avw
ReadVolumes
(
IP
,
cbuffer
,
v
);
Fsl
ReadVolumes
(
IP
,
cbuffer
,
v
);
size_t
volsize
=
volinfo
.
x
*
volinfo
.
y
*
volinfo
.
z
;
size_t
volsize
=
volinfo
.
x
*
volinfo
.
y
*
volinfo
.
z
;
size_t
volstart
=
1
;
size_t
volstart
=
1
;
...
@@ -211,10 +212,10 @@ namespace MISCMATHS {
...
@@ -211,10 +212,10 @@ namespace MISCMATHS {
}
}
break
;
break
;
default
:
default
:
perror
(
"
Avw
Read: DT not supported"
);
perror
(
"
Fsl
Read: DT not supported"
);
}
}
Avw
Close
(
IP
);
Fsl
Close
(
IP
);
return
;
return
;
}
}
...
@@ -230,12 +231,12 @@ namespace MISCMATHS {
...
@@ -230,12 +231,12 @@ namespace MISCMATHS {
{
{
Time_Tracer
ts
(
string
(
"VolumeSeries::writeAsFloat"
+
fname
).
c_str
());
Time_Tracer
ts
(
string
(
"VolumeSeries::writeAsFloat"
+
fname
).
c_str
());
AVW
*
OP
=
Avw
Open
(
fname
.
c_str
(),
"wc"
);
FSLIO
*
OP
=
Fsl
Open
(
fname
.
c_str
(),
"wc"
);
Avw
SetDim
(
OP
,
volinfo
.
x
,
volinfo
.
y
,
volinfo
.
z
,
volinfo
.
v
);
Fsl
SetDim
(
OP
,
volinfo
.
x
,
volinfo
.
y
,
volinfo
.
z
,
volinfo
.
v
);
Avw
SetVoxDim
(
OP
,
volinfo
.
vx
,
volinfo
.
vy
,
volinfo
.
vz
,
volinfo
.
tr
);
Fsl
SetVoxDim
(
OP
,
volinfo
.
vx
,
volinfo
.
vy
,
volinfo
.
vz
,
volinfo
.
tr
);
Avw
SetDataType
(
OP
,
DT_FLOAT
);
Fsl
SetDataType
(
OP
,
DT_FLOAT
);
Avw
SetOriginator
(
OP
,
volinfo
.
originator
);
Fsl
SetOriginator
(
OP
,
volinfo
.
originator
);
int
volStart
=
1
;
int
volStart
=
1
;
int
volSize
=
getNumSeries
();
int
volSize
=
getNumSeries
();
...
@@ -252,11 +253,11 @@ namespace MISCMATHS {
...
@@ -252,11 +253,11 @@ namespace MISCMATHS {
}
}
}
}
Avw
WriteVolumes
(
OP
,
qv
,
volNum
);
Fsl
WriteVolumes
(
OP
,
qv
,
volNum
);
delete
[]
qv
;
delete
[]
qv
;
Avw
Close
(
OP
);
Fsl
Close
(
OP
);
}
}
...
...
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