3
// extract a single 3D image from a TES1 file
4
// Copyright (c) 1998-2002 by The VoxBo Development Team
6
// VoxBo is free software: you can redistribute it and/or modify it
7
// under the terms of the GNU General Public License as published by
8
// the Free Software Foundation, either version 3 of the License, or
9
// (at your option) any later version.
11
// VoxBo is distributed in the hope that it will be useful, but
12
// WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
// General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with VoxBo. If not, see <http://www.gnu.org/licenses/>.
19
// For general information on VoxBo, including the latest complete
20
// source code and binary distributions, manual, and associated files,
21
// see the VoxBo home page at: http://www.voxbo.org/
23
// original version written by Dan Kimberg
32
#include "tes2cub.hlp.h"
37
main(int argc,char *argv[])
45
args.Transfer(argc-1,argv+1);
47
if (args.size() == 0) {
52
if (args.size() != 2 && args.size() != 3) {
58
ind = strtol(args[2]);
60
if (tes->ReadFile(args[0])) {
62
tmps << "tes2cub: couldn't read tes file " << args[0];
63
printErrorMsg(VB_ERROR,tmps.str());
66
if (!tes->data_valid) {
68
tmps << "tes2cub: tes file " << args[0] << "isn't valid.";
69
printErrorMsg(VB_ERROR,tmps.str());
72
if (ind > tes->dimt) {
74
tmps << "tes2cub: index (" << ind << ") is beyond the last image (" << tes->dimt << ").";
75
printErrorMsg(VB_ERROR,tmps.str());
78
cub = new Cube((*tes)[ind]);
79
if (!cub->data_valid) {
81
tmps << "tes2cub: error extracting the cube from the 4D file (shouldn't happen!).";
82
printErrorMsg(VB_ERROR,tmps.str());
85
if (!cub->WriteFile(args[1])) {
87
tmps << "tes2cub: wrote cube " << ind << " to file " << args[1] << ".";
88
printErrorMsg(VB_INFO,tmps.str());
93
tmps << "tes2cub: failed to write extracted cube to file " << args[1] << ".";
94
printErrorMsg(VB_INFO,tmps.str());
103
cout << boost::format(myhelp) % vbversion;