54 std::cout << options << std::endl;
63 int numPoints = numLines - 1;
67 std::cout <<
timestamp <<
"File contains no points. Exiting." << std::endl;
71 bool readColor =
true;
72 if( (options.
r() < 0) || (options.
g() < 0) || (options.
b() < 0) )
77 bool readIntensity = options.
i() >= 0;
81 std::cout <<
timestamp <<
"Read colors\t\t: " << readColor << std::endl;
82 std::cout <<
timestamp <<
"Read intensities\t\t: " << readIntensity << std::endl;
83 std::cout <<
timestamp <<
"Convert intensities\t: " << convert << std::endl;
86 floatArr points(
new float[3 * numPoints]);
90 if(readColor || (readIntensity && convert))
92 colors =
ucharArr(
new unsigned char[3 * numPoints]);
97 intensities =
floatArr(
new float[numPoints]);
105 std::ifstream in(inputFile.c_str());
110 float* data =
new float[numEntries];
111 in.getline(buffer, 2048);
113 while(in.good() && c <= numPoints)
116 for(
int i = 0; i < numEntries; i++)
124 points[posPtr ] = data[options.
x()];
125 points[posPtr + 1] = data[options.
y()];
126 points[posPtr + 2] = data[options.
z()];
128 points[posPtr ] *= options.
sx();
129 points[posPtr + 1] *= options.
sy();
130 points[posPtr + 2] *= options.
sz();
134 colors[posPtr ] = (
unsigned char)data[options.
i()];
135 colors[posPtr + 1] = (
unsigned char)data[options.
i()];
136 colors[posPtr + 2] = (
unsigned char)data[options.
i()];
140 colors[posPtr ] = (
unsigned char)data[options.
r()];
141 colors[posPtr + 1] = (
unsigned char)data[options.
g()];
142 colors[posPtr + 2] = (
unsigned char)data[options.
b()];
147 intensities[c] = data[options.
i()];
156 pointBuffer->setPointArray(points, numPoints);
157 pointBuffer->setColorArray(colors, numPoints);
158 pointBuffer->addFloatChannel(intensities,
"intensities", numPoints, 1);
165 std::cout <<
"Unable to open file for output: " << inputFile << std::endl;
168 std::cout << std::endl;
A class to handle point information with an arbitrarily large number of attribute channels...
float sy()
Returns the scaling factor for the y coordinates.
int y()
Returns the position of the x coordinate in the data.
Datastructures for holding loaded data.
const kaboom::Options * options
bool printUsage() const
Prints a usage message.
int r()
Returns the position of the x coordinate in the data.
static int getEntriesInLine(string filename)
Helper method. Returns the number of columns in the given file.
A class to parse the program options for the reconstruction executable.
void convert(COORD_SYSTEM from, COORD_SYSTEM to, float *point)
static Timestamp timestamp
A global time stamp object for program runtime measurement.
boost::shared_array< unsigned char > ucharArr
int main(int argc, char **argv)
Main entry point for the LSSR surface executable.
int i()
Returns the position of the x coordinate in the data.
std::shared_ptr< PointBuffer > PointBufferPtr
Read and write pointclouds from .pts and .3d files.
float sz()
Returns the scaling factor for the z coordinates.
int z()
Returns the position of the x coordinate in the data.
static size_t countLines(string filename)
TODO: Coordinate mapping for ascii files.
boost::shared_array< float > floatArr
bool convertRemission() const
If true, intinesites will be converted to colors.
int g()
Returns the position of the x coordinate in the data.
std::shared_ptr< Model > ModelPtr
string outputFile() const
Retuns the input file.
string inputFile() const
Retuns the input file.
float sx()
Returns the scaling factor for the x coordinates.
string getElapsedTime() const
Returns a string representation of the current timer value.
int b()
Returns the position of the x coordinate in the data.
static void saveModel(ModelPtr m, std::string file)
int x()
Returns the position of the x coordinate in the data.