diff --git a/Common.cmake b/Common.cmake index bb41ca1..958ca3c 100644 --- a/Common.cmake +++ b/Common.cmake @@ -18,9 +18,9 @@ if(NOT COMMAND SETIFEMPTY) endif() #----------------------------------------------------------------------------- -SETIFEMPTY(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PRIMARY_PROJECT_NAME}-build/lib) -SETIFEMPTY(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PRIMARY_PROJECT_NAME}-build/lib) -SETIFEMPTY(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PRIMARY_PROJECT_NAME}-build/bin) +SETIFEMPTY(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PRIMARY_PROJECT_NAME}build/lib) +SETIFEMPTY(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PRIMARY_PROJECT_NAME}build/lib) +SETIFEMPTY(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PRIMARY_PROJECT_NAME}build/bin) #----------------------------------------------------------------------------- SETIFEMPTY(CMAKE_INSTALL_LIBRARY_DESTINATION lib) diff --git a/README.md b/README.md new file mode 100644 index 0000000..f14ee28 --- /dev/null +++ b/README.md @@ -0,0 +1,60 @@ +## Surface Remesh + +## Description + +Surface reconstruction from rotated spheres (after RigidAlignment) or from coefficients (after GROUPS). + + +## Build + +#### Requirements + +Building SurfRemesh requires to have built previously: + +* MeshLib (https://github.com/pdedumast/MeshLib) +* SlicerExecutionModel + +SurfRemesh can either be built from GROUPS SuperBuild. + + +###### Linux or MacOSX + +Consider this tree of repertories: +``` +~/Project/SurfRemesh + /SurfRemesh-build +``` + +Start a terminal. +First change your current working directory to the build directory ```SurfRemesh-build``` +``` +cd ~/Project/SurfRemesh-build +``` + +Generate the project using ```cmake``` +``` +cmake -DMeshLib_DIR:PATH=path/to/MeshLib -DSlicerExecutionModel:PATH=path/to/SlicerExecutionModel ../SurfRemesh +make +``` + + +## Usage + +Reconstruction from new rotated sphere, after RigidAlignment: +Output surface will have the same parametrization with one specified by the reference sphere. +``` +./SurfRemesh --input [ input surface model] --tempModel [ rotate sphere] +--ref [ common sphere model (same as refSphere in RigidAlignment)] +--output [ reconstructed surface] +``` + +Reconstruction from coefficients, after GROUPS: +``` +./SurfRemesh --input [ input surface model] --tempModel [ sphere model used in GROUPS] +--ref [ common sphere model] --coeff [ Coefficients file from GROUPS] +--output [ reconstructed surface] +``` + +## Licence + +See LICENSE.txt for information on using and contributing. \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 87d300b..cb7150e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,3 +1,4 @@ add_library(SurfRemesh STATIC - SurfaceRemeshing.cpp) \ No newline at end of file + SurfaceRemeshing.cpp) + diff --git a/src/SurfaceRemeshing.cpp b/src/SurfaceRemeshing.cpp index 0b59430..517418e 100644 --- a/src/SurfaceRemeshing.cpp +++ b/src/SurfaceRemeshing.cpp @@ -102,6 +102,7 @@ SurfaceRemeshing::SurfaceRemeshing(const char *subject, const char *sphere, cons m_coeff[0] = 0; m_coeff[1] = 0; } + float phi, theta; Coordinate::cart2sph(m_pole, &phi, &theta); @@ -137,7 +138,7 @@ SurfaceRemeshing::SurfaceRemeshing(const char *subject, const char *sphere, cons if (fabs(phi - phi_) < eps && fabs(theta - theta_) < eps) continue; SphericalHarmonics::basis(m_degree, (float *)v->fv(), Y); reconsCoord(v->fv(), v1, Y, m_coeff, m_degree, m_pole); - MathVector V(v1); V.unit(); + MathVector V(v1); V.unit(); v->setVertex(V.fv()); } } @@ -194,6 +195,7 @@ SurfaceRemeshing::SurfaceRemeshing(const char *subject, const char *sphere, cons } } + void SurfaceRemeshing::reconsCoord(const float *v0, float *v1, float *Y, float *coeff, int degree, float *pole) { // spharm basis @@ -244,8 +246,8 @@ void SurfaceRemeshing::reconsCoord(const float *v0, float *v1, float *Y, float * // inverse rotation Coordinate::rotPoint(rv, rot, v1); } - -/*void SurfaceRemeshing::reconsCoord(const float *v0, float *v1, float *Y, float *coeff, float degree, float *pole) +/* +void SurfaceRemeshing::reconsCoord(const float *v0, float *v1, float *Y, float *coeff, float degree, float *pole) { // spharm basis int n = (degree + 1) * (degree + 1); @@ -354,7 +356,7 @@ void SurfaceRemeshing::deformSurface() d_v[0] = dataInterpolation(m_x, id, coeff, m_sphere_subj); d_v[1] = dataInterpolation(m_y, id, coeff, m_sphere_subj); d_v[2] = dataInterpolation(m_z, id, coeff, m_sphere_subj); - + if (m_keepColor) { int *d_c = new int[3]; @@ -372,6 +374,7 @@ void SurfaceRemeshing::deformSurface() d_v[2] = dataMedian(m_z, id, m_sphere_subj); } Vertex *new_v = (Vertex *)m_remesh->vertex(i); + new_v->setVertex(d_v); } } diff --git a/wrapper/CMakeLists.txt b/wrapper/CMakeLists.txt index cc02d93..efa78f1 100644 --- a/wrapper/CMakeLists.txt +++ b/wrapper/CMakeLists.txt @@ -1,5 +1,4 @@ - if(UNIX) set( INSTALL_RUNTIME_DESTINATION bin) set( INSTALL_LIBRARY_DESTINATION lib) @@ -20,4 +19,5 @@ SEMMacroBuildCLI( INSTALL_ARCHIVE_DESTINATION ${INSTALL_ARCHIVE_DESTINATION} ) -install(TARGETS SRemesh RUNTIME DESTINATION ${INSTALL_RUNTIME_DESTINATION}) \ No newline at end of file +install(TARGETS SRemesh RUNTIME DESTINATION ${INSTALL_RUNTIME_DESTINATION}) + diff --git a/wrapper/SRemesh.cxx b/wrapper/SRemesh.cxx index 68af043..07b6cfe 100644 --- a/wrapper/SRemesh.cxx +++ b/wrapper/SRemesh.cxx @@ -7,6 +7,8 @@ int main(int argc, char* argv[]) { PARSE_ARGS; + std::cout<