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
969cc35a
Commit
969cc35a
authored
16 years ago
by
Matthew Webster
Browse files
Options
Downloads
Patches
Plain Diff
Fixed matrix reading routines
parent
77c1754f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
miscmaths.cc
+22
-22
22 additions, 22 deletions
miscmaths.cc
with
22 additions
and
22 deletions
miscmaths.cc
+
22
−
22
View file @
969cc35a
/* miscmaths.cc
Mark Jenkinson
&
Mark Woolrich
&
Christian Beckmann
&
Tim Behrens, FMRIB Image Analysis Group
Mark Jenkinson
,
Mark Woolrich
,
Christian Beckmann
,
Tim Behrens
and Matthew Webster
, FMRIB Image Analysis Group
Copyright (C) 1999-200
0
University of Oxford */
Copyright (C) 1999-200
9
University of Oxford */
/* CCOPYRIGHT */
...
...
@@ -74,9 +74,9 @@ namespace MISCMATHS {
getline
(
fs
,
cline
);
cline
+=
" "
;
// force extra entry in parsing
istringstream
ss
(
cline
.
c_str
());
string
cc
=
""
;
ss
>>
cc
;
if
(
isNumber
(
cc
.
substr
(
0
,
2
)
))
{
string
firstToken
=
""
;
ss
>>
firstToken
;
//Put first non-whitespace sequence into
cc
if
(
isNumber
(
firstToken
))
{
if
(
!
fs
.
eof
())
{
fs
.
seekg
(
curpos
);
}
else
{
fs
.
clear
();
fs
.
seekg
(
0
,
ios
::
beg
);
}
return
cline
;
}
...
...
@@ -154,36 +154,36 @@ namespace MISCMATHS {
ReturnMatrix
read_ascii_matrix
(
ifstream
&
fs
)
{
int
rcount
=
0
,
cmax
=
0
;
string
c
l
ine
;
int
nRows
(
0
),
nColumns
(
0
)
;
string
c
urrentL
ine
;
// skip initial non-numeric lines
// and count the number of columns in the first numeric line
c
l
ine
=
skip_alpha
(
fs
);
c
l
ine
+=
" "
;
c
urrentL
ine
=
skip_alpha
(
fs
);
c
urrentL
ine
+=
" "
;
{
istringstream
ss
(
c
l
ine
.
c_str
());
string
cc
=
""
;
istringstream
ss
(
c
urrentL
ine
.
c_str
());
string
dummyToken
=
""
;
while
(
!
ss
.
eof
())
{
cmax
++
;
ss
>>
cc
;
nColumns
++
;
ss
>>
dummyToken
;
}
}
cmax
--
;
nColumns
--
;
do
{
getline
(
fs
,
c
l
ine
);
c
l
ine
+=
" "
;
// force extra entry in parsing
istringstream
ss
(
c
l
ine
.
c_str
());
string
cc
=
""
;
ss
>>
cc
;
if
(
!
isNumber
(
cc
.
substr
(
0
,
2
)
))
break
;
// stop processing when non-numeric line found
rcount
++
;
// add new row to matrix
getline
(
fs
,
c
urrentL
ine
);
c
urrentL
ine
+=
" "
;
// force extra entry in parsing
istringstream
ss
(
c
urrentL
ine
.
c_str
());
string
firstToken
(
""
)
;
ss
>>
firstToken
;
//Put first non-whitespace sequence into
cc
if
(
!
isNumber
(
firstToken
))
break
;
// stop processing when non-numeric line found
nRows
++
;
// add new row to matrix
}
while
(
!
fs
.
eof
());
// now know the size of matrix
fs
.
clear
();
fs
.
seekg
(
0
,
ios
::
beg
);
return
read_ascii_matrix
(
fs
,
rcount
,
cmax
);
return
read_ascii_matrix
(
fs
,
nRows
,
nColumns
);
}
...
...
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