Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
VTK
VTK
Commits
5c5120f5
Commit
5c5120f5
authored
Jun 08, 1994
by
Ken Martin
Browse files
Initial revision
parent
0bf05725
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/VoxelR.hh
0 → 100644
View file @
5c5120f5
/*=========================================================================
Program: Visualization Library
Module: VoxelR.hh
Language: C++
Date: $Date$
Version: $Revision$
This file is part of the Visualization Library. No part of this file or its
contents may be copied, reproduced or altered in any way without the express
written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Read Voxel Data
//
#ifndef __vlVoxelReader_h
#define __vlVoxelReader_h
#include <stdio.h>
#include "SPtSrc.hh"
#include "BScalars.hh"
class
vlVoxelReader
:
public
vlStructuredPointsSource
{
public:
vlVoxelReader
()
:
Filename
(
NULL
)
{};
~
vlVoxelReader
()
{
if
(
this
->
Filename
)
delete
[]
this
->
Filename
;};
char
*
GetClassName
()
{
return
"vlVoxelReader"
;};
void
PrintSelf
(
ostream
&
os
,
vlIndent
indent
);
vlSetStringMacro
(
Filename
);
vlGetStringMacro
(
Filename
);
protected:
char
*
Filename
;
void
Execute
();
};
#endif
src/VoxelR.cc
0 → 100644
View file @
5c5120f5
/*=========================================================================
Program: Visualization Library
Module: VoxelR.cc
Language: C++
Date: $Date$
Version: $Revision$
This file is part of the Visualization Library. No part of this file or its
contents may be copied, reproduced or altered in any way without the express
written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#include <ctype.h>
#include "VoxelR.hh"
void
vlVoxelReader
::
Execute
()
{
FILE
*
fp
;
vlBitScalars
*
newScalars
;
int
i
,
numPts
;
char
tmp
[
80
];
int
bitcount
;
unsigned
char
uc
;
float
f
[
3
];
int
ti
[
3
];
// Initialize
this
->
Initialize
();
if
((
fp
=
fopen
(
this
->
Filename
,
"r"
))
==
NULL
)
{
vlErrorMacro
(
<<
"File "
<<
this
->
Filename
<<
" not found"
);
return
;
}
// read the header
fscanf
(
fp
,
"Voxel Data File
\n
"
);
// read in the
fscanf
(
fp
,
"Origin: %f %f %f
\n
"
,
f
,
f
+
1
,
f
+
2
);
this
->
SetOrigin
(
f
);
fscanf
(
fp
,
"Aspect: %f %f %f
\n
"
,
f
,
f
+
1
,
f
+
2
);
this
->
SetAspectRatio
(
f
);
fscanf
(
fp
,
"Dimensions: %i %i %i
\n
"
,
ti
,
ti
+
1
,
ti
+
2
);
this
->
SetDimensions
(
ti
);
numPts
=
this
->
Dimensions
[
0
]
*
this
->
Dimensions
[
1
]
*
this
->
Dimensions
[
2
];
newScalars
=
new
vlBitScalars
(
numPts
);
bitcount
=
0
;
for
(
i
=
0
;
i
<
numPts
;)
{
uc
=
fgetc
(
fp
);
newScalars
->
SetScalar
(
i
++
,
uc
&
0x80
);
newScalars
->
SetScalar
(
i
++
,
uc
&
0x40
);
newScalars
->
SetScalar
(
i
++
,
uc
&
0x20
);
newScalars
->
SetScalar
(
i
++
,
uc
&
0x10
);
newScalars
->
SetScalar
(
i
++
,
uc
&
0x08
);
newScalars
->
SetScalar
(
i
++
,
uc
&
0x04
);
newScalars
->
SetScalar
(
i
++
,
uc
&
0x02
);
newScalars
->
SetScalar
(
i
++
,
uc
&
0x01
);
}
vlDebugMacro
(
<<
"Read "
<<
numPts
<<
" points"
);
this
->
PointData
.
SetScalars
(
newScalars
);
}
void
vlVoxelReader
::
PrintSelf
(
ostream
&
os
,
vlIndent
indent
)
{
if
(
this
->
ShouldIPrint
(
vlVoxelReader
::
GetClassName
()))
{
vlStructuredPointsSource
::
PrintSelf
(
os
,
indent
);
os
<<
indent
<<
"Filename: "
<<
this
->
Filename
<<
"
\n
"
;
}
}
Write
Preview
Supports
Markdown
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