Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Christian Butz
VTK
Commits
92cabf61
Commit
92cabf61
authored
Jul 18, 2018
by
Dan Lipsa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ability to read from short integers.
parent
200888e7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
12 deletions
+15
-12
IO/SegY/vtkSegYIOUtils.cxx
IO/SegY/vtkSegYIOUtils.cxx
+7
-12
IO/SegY/vtkSegYIOUtils.h
IO/SegY/vtkSegYIOUtils.h
+1
-0
IO/SegY/vtkSegYTraceReader.cxx
IO/SegY/vtkSegYTraceReader.cxx
+7
-0
No files found.
IO/SegY/vtkSegYIOUtils.cxx
View file @
92cabf61
...
...
@@ -37,6 +37,12 @@ vtkSegYIOUtils* vtkSegYIOUtils::Instance()
short
vtkSegYIOUtils
::
readShortInteger
(
int
pos
,
std
::
ifstream
&
in
)
{
in
.
seekg
(
pos
,
in
.
beg
);
return
readShortInteger
(
in
);
}
//----------------------------------------------------------------------------
short
vtkSegYIOUtils
::
readShortInteger
(
std
::
ifstream
&
in
)
{
char
buffer
[
2
];
in
.
read
(
buffer
,
sizeof
(
buffer
));
...
...
@@ -54,18 +60,7 @@ short vtkSegYIOUtils::readShortInteger(int pos, std::ifstream& in)
int
vtkSegYIOUtils
::
readLongInteger
(
int
pos
,
std
::
ifstream
&
in
)
{
in
.
seekg
(
pos
,
in
.
beg
);
char
buffer
[
4
];
in
.
read
(
buffer
,
sizeof
(
buffer
));
if
(
!
this
->
IsBigEndian
)
{
swap
(
buffer
,
buffer
+
3
);
swap
(
buffer
+
1
,
buffer
+
2
);
}
int
num
;
memcpy
(
&
num
,
buffer
,
4
);
return
num
;
return
readLongInteger
(
in
);
}
//----------------------------------------------------------------------------
...
...
IO/SegY/vtkSegYIOUtils.h
View file @
92cabf61
...
...
@@ -24,6 +24,7 @@ class vtkSegYIOUtils
public:
char
readChar
(
std
::
ifstream
&
in
);
short
readShortInteger
(
int
pos
,
std
::
ifstream
&
in
);
short
readShortInteger
(
std
::
ifstream
&
in
);
int
readLongInteger
(
int
pos
,
std
::
ifstream
&
in
);
int
readLongInteger
(
std
::
ifstream
&
in
);
float
readFloat
(
std
::
ifstream
&
in
);
...
...
IO/SegY/vtkSegYTraceReader.cxx
View file @
92cabf61
...
...
@@ -121,6 +121,13 @@ void vtkSegYTraceReader::ReadTrace(int& startPos,
trace
->
Data
.
push_back
(
value
);
}
break
;
case
3
:
for
(
int
i
=
0
;
i
<
numSamples
;
i
++
)
{
value
=
vtkSegYIOUtils
::
Instance
()
->
readShortInteger
(
in
);
trace
->
Data
.
push_back
(
value
);
}
break
;
case
5
:
for
(
int
i
=
0
;
i
<
numSamples
;
i
++
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment