Commit b1c0dc24 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Various fixes:

* Fixed FiberReader parsing TrackVis files with additional scalars
* Fixed off-by-one error in StringUtils::split()
* Fixed VoxelHierarchyMapper support for non quadratic base sizes.
parent 4bedc2f8
......@@ -87,7 +87,7 @@ namespace campvis {
while (endpos != std::string::npos) {
endpos = line.find_first_of(delimiter, linepos);
toReturn.push_back(line.substr(linepos, endpos - linepos));
linepos = endpos + delimiter.length();
linepos = endpos + 1;
}
return toReturn;
}
......
......@@ -127,7 +127,7 @@ namespace dti {
vertices[i] *= p_scaling.getValue();
vertices[i] += p_offset.getValue();
//file.read((char*)scalars, sizeof(float) * header.n_scalars);
file.read((char*)scalars, sizeof(float) * header.n_scalars);
//if(header.n_scalars > 0)
// fibers_.uncertainties_.push_back(scalars[0]);
//else
......
......@@ -224,7 +224,7 @@ namespace dti {
for (size_t z = 0; z < strainData.getSize().z; z += inc) {
for (size_t y = 0; y < strainData.getSize().y; y += inc) {
for (size_t x = 0; x < strainData.getSize().x; x += inc) {
cgt::vec3 pos(x, y, z);
cgt::vec3 pos = cgt::vec3(float(x), float(y), float(z));
if (cgt::lengthSq(getVec3FloatLinear(strainData, pos)) > threshold) {
seeds.push_back((VtW * cgt::vec4(pos, 1.f)).xyz());
}
......
......@@ -68,9 +68,9 @@ void main() {
for (int x = -1; x < _brickSize + 1; ++x) {
vec3 addendum = (vec3(x, y, z) / _volumeTextureParams._size);
vec3 texCoord = clamp(llf + addendum, 0.0, 1.0);
//float intensity = mapIntensityToTFDomain(_transferFunctionParams._intensityDomain, texture(_volume, texCoord).r);
ivec3 voxel = ivec3(texCoord * _volumeTextureParams._size);
float intensity = mapIntensityToTFDomain(_transferFunctionParams._intensityDomain, texelFetch(_volume, voxel, 0).r);
float intensity = mapIntensityToTFDomain(_transferFunctionParams._intensityDomain, texture(_volume, texCoord).r);
//ivec3 voxel = ivec3(texCoord * _volumeTextureParams._size);
//float intensity = mapIntensityToTFDomain(_transferFunctionParams._intensityDomain, texelFetch(_volume, voxel, 0).r);
//float intensity = texture(_volume, voxel).r;
//vec4 color = lookupTF(_transferFunction, _transferFunctionParams, intensity);
//if (color.a > 0) {
......
......@@ -88,7 +88,8 @@ namespace campvis {
// since the texture is a 2D texture and the elements store the depth will pack VOXEL_DEPTH number of values along the z axis into one block, the _dimBricks.z is
_dimBricks.z = 128;
_dimPackedBricks = _dimBricks;
_dimPackedBricks.x = std::max(_dimBricks.x, _dimBricks.y);
_dimPackedBricks.y = std::max(_dimBricks.x, _dimBricks.y);
_dimPackedBricks.z = 1;
_maxMipmapLevel = computeMaxLevel(_dimPackedBricks.x, _dimPackedBricks.y);
......@@ -140,7 +141,7 @@ namespace campvis {
_fbo->attachTexture(_hierarchyTexture, GL_COLOR_ATTACHMENT0, level+1, 0);
_fbo->isComplete();
glViewport(0, 0, static_cast<GLsizei>(resX / 2.0), static_cast<GLsizei>(resY / 2.0));
glViewport(0, 0, std::max(1, static_cast<GLsizei>(resX / 2.0)), std::max(1, static_cast<GLsizei>(resY / 2.0)));
_quad->render(GL_TRIANGLE_FAN);
}
......@@ -175,7 +176,7 @@ namespace campvis {
int div = 2;
for (GLuint level = 1; level <= _maxMipmapLevel; ++level) {
glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA32UI, _hierarchyTexture->getWidth()/div, _hierarchyTexture->getHeight()/div, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, 0);
glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA32UI, std::max(1, _hierarchyTexture->getWidth()/div), std::max(1, _hierarchyTexture->getHeight()/div), 0, GL_RED_INTEGER, GL_UNSIGNED_INT, 0);
div = div << 1;
LGL_ERROR;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment