diff --git a/anatomicuts/CMakeLists.txt b/anatomicuts/CMakeLists.txt index 66805a59218..2bb2560520c 100644 --- a/anatomicuts/CMakeLists.txt +++ b/anatomicuts/CMakeLists.txt @@ -69,5 +69,5 @@ install(PROGRAMS install_pyscript( diffusionUtils - anatomiCutsUtils + anatomiCutsUtils.py ) diff --git a/hiam_make_surfaces/hiam_make_surfaces.cpp b/hiam_make_surfaces/hiam_make_surfaces.cpp index 07c08a9358e..29d0d2ce6e4 100644 --- a/hiam_make_surfaces/hiam_make_surfaces.cpp +++ b/hiam_make_surfaces/hiam_make_surfaces.cpp @@ -43,29 +43,31 @@ #include #include +#include "macros.h" + +#include "mri.h" +#include "mrimorph.h" +#include "mrinorm.h" + #include "mrisurf.h" +#include "mrisurf_project.h" #include "mrishash_internals.h" -#include "macros.h" #include "error.h" #include "diag.h" #include "proto.h" #include "timer.h" -#include "mri.h" -#include "macros.h" -#include "mrimorph.h" -#include "mrinorm.h" #include "matrix.h" -#define VERTEX_EDGE(vec, v0, v1) VECTOR_LOAD(vec,v1->x-v0->x,v1->y-v0->y,v1->z-v0->z) - #define MAX_4_NEIGHBORS 100 #define MAX_3_NEIGHBORS 70 #define MAX_2_NEIGHBORS 20 #define MAX_1_NEIGHBORS 8 - #define REPULSE_K 1.0 + +#undef REPULSE_E // differs from mrisurf_base.h 0.25 #define REPULSE_E 0.5 + #define MAX_MOMENTUM_MM 1 static int get_option(int argc, char *argv[]) ; @@ -94,8 +96,8 @@ static double mrisComputeGaussianCurvatureSpringEnergy(MRI_SURFACE *mris, double static double mrismomentumTimeStep(MRI_SURFACE *mris, float momentum, float dt, float tol, float n_averages); -static int mrisProjectSurface(MRI_SURFACE *mris); -static int mrisComputeTangentPlanes(MRI_SURFACE *mris); +static int my_mrisProjectSurface(MRI_SURFACE *mris); +static int my_mrisComputeTangentPlanes(MRI_SURFACE *mris); static int FindSpikes(MRI_SURFACE *mris, int iter); static int SmoothSpikes(MRI_SURFACE *mris, int niter); @@ -1122,7 +1124,7 @@ mrisComputeQuadraticCurvatureTerm(MRI_SURFACE *mris, double l_curv) { if (FZERO(l_curv)) return(NO_ERROR) ; - mrisComputeTangentPlanes(mris) ; + my_mrisComputeTangentPlanes(mris) ; v_n = VectorAlloc(3, MATRIX_REAL) ; v_A = VectorAlloc(2, MATRIX_REAL) ; v_e1 = VectorAlloc(3, MATRIX_REAL) ; @@ -1197,7 +1199,7 @@ mrisComputeQuadraticCurvatureEnergy(MRI_SURFACE *mris) { double sse = 0.0 ; - mrisComputeTangentPlanes(mris) ; + my_mrisComputeTangentPlanes(mris) ; v_n = VectorAlloc(3, MATRIX_REAL) ; v_A = VectorAlloc(2, MATRIX_REAL) ; v_e1 = VectorAlloc(3, MATRIX_REAL) ; @@ -1782,12 +1784,12 @@ mrismomentumTimeStep(MRI_SURFACE *mris, float momentum, float dt, float tol, } } - mrisProjectSurface(mris) ; + my_mrisProjectSurface(mris) ; return(delta_t) ; } static int -mrisProjectSurface(MRI_SURFACE *mris) { +my_mrisProjectSurface(MRI_SURFACE *mris) { /* MRISupdateSurface(mris) ;*/ switch (mris->status) { @@ -1815,7 +1817,7 @@ mrisProjectSurface(MRI_SURFACE *mris) { static int -mrisComputeTangentPlanes(MRI_SURFACE *mris) { +my_mrisComputeTangentPlanes(MRI_SURFACE *mris) { VECTOR *v_n, *v_e1, *v_e2, *v ; int vno ; VERTEX *vertex ; diff --git a/hiam_register/hiam_register.cpp b/hiam_register/hiam_register.cpp index f0b6c98e00b..3ea6ba7cc5e 100644 --- a/hiam_register/hiam_register.cpp +++ b/hiam_register/hiam_register.cpp @@ -31,12 +31,14 @@ #include #include "macros.h" + +#include "mri.h" +#include "mrisurf.h" +#include "mrisurf_project.h" + #include "error.h" #include "diag.h" #include "proto.h" -#include "mrisurf.h" -#include "mri.h" -#include "macros.h" #include "timer.h" static char vcid[] = "$Id: hiam_register.c,v 1.6 2011/12/12 03:28:32 greve Exp $"; @@ -92,7 +94,6 @@ static int use_defaults = 1 ; #define IMAGES_PER_SURFACE 3 /* mean, variance, and dof */ #define SURFACES sizeof(curvature_names) / sizeof(curvature_names[0]) -#define PARAM_IMAGES (IMAGES_PER_SURFACE*SURFACES) #define NSIGMAS (sizeof(sigmas) / sizeof(sigmas[0])) #define MAX_NBHD_SIZE 200 diff --git a/include/mrishash_SurfaceFromMRIS.h b/include/mrishash_SurfaceFromMRIS.h index 9a4d023c3d5..bb11ab2349d 100644 --- a/include/mrishash_SurfaceFromMRIS.h +++ b/include/mrishash_SurfaceFromMRIS.h @@ -19,8 +19,10 @@ #include "mrishash.h" #include "mrisurf_SurfaceFromMRIS_generated.h" -MRIS_HASH_TABLE* MHTcreateFaceTable (SurfaceFromMRIS::Analysis::Surface surface); -MRIS_HASH_TABLE* MHTcreateFaceTable_Resolution (SurfaceFromMRIS::Analysis::Surface surface, int which, float res); -MRIS_HASH_TABLE* MHTcreateVertexTable (SurfaceFromMRIS::Analysis::Surface surface, int which); -MRIS_HASH_TABLE* MHTcreateVertexTable_Resolution(SurfaceFromMRIS::Analysis::Surface surface, int which, float res); +namespace Minimal_Surface_MRIS = SurfaceFromMRIS::XYZPosition; + +MRIS_HASH_TABLE* MHTcreateFaceTable (Minimal_Surface_MRIS::Surface surface); +MRIS_HASH_TABLE* MHTcreateFaceTable_Resolution (Minimal_Surface_MRIS::Surface surface, int which, float res); +MRIS_HASH_TABLE* MHTcreateVertexTable (Minimal_Surface_MRIS::Surface surface, int which); +MRIS_HASH_TABLE* MHTcreateVertexTable_Resolution(Minimal_Surface_MRIS::Surface surface, int which, float res); diff --git a/include/mrisurf.h b/include/mrisurf.h index c35a1746a00..d73098f119d 100644 --- a/include/mrisurf.h +++ b/include/mrisurf.h @@ -122,10 +122,6 @@ void MRIS_checkAcquiredTemp(MRIS* mris, MRIS_TempAssigned temp, int MRIS_acquire void MRIS_releaseTemp (MRIS* mris, MRIS_TempAssigned temp, int MRIS_acquireTemp_result); // ... be allowed to release it -FaceNormCacheEntry const * getFaceNorm(MRIS const * const mris, int fno); -void setFaceNorm(MRIS const * const mris, int fno, float nx, float ny, float nz); - - // Support for writing traces that can be compared across test runs to help find where differences got introduced // void mrisVertexHash(MRIS_HASH* hash, MRIS const * mris, int vno); @@ -668,9 +664,6 @@ int MRISintegrate(MRI_SURFACE *mris, INTEGRATION_PARMS *parms, int n_avgs); int mrisLogIntegrationParms(FILE *fp, MRI_SURFACE *mris, INTEGRATION_PARMS *parms) ; -MRIS* MRISprojectOntoSphere (MRIS* mris_src, MRIS* mris_dst, double r) ; -MRIS* MRISprojectOntoEllipsoid(MRIS* mris_src, MRIS* mris_dst, float a, float b, float c) ; - int MRISsampleDistances(MRI_SURFACE *mris, int *nbr_count,int n_nbrs); int MRISsampleAtEachDistance(MRI_SURFACE *mris, int nbhd_size, int nbrs_per_distance) ; @@ -777,11 +770,6 @@ MRI_SURFACE *MRISremoveNegativeVertices(MRI_SURFACE *mris, int MRIScomputeFaceAreas(MRI_SURFACE *mris) ; int MRISupdateEllipsoidSurface(MRI_SURFACE *mris) ; -MRIS* MRIStranslate_along_vertex_dxdydz(MRIS* mris_src, MRIS* mris_dst, double dt); - -MRIS* MRISrotate(MRIS* mris_src, MRIS* mris_dst, - float alpha, float beta, float gamma) ; - MRI *MRISwriteIntoVolume(MRI_SURFACE *mris, MRI *mri, int which) ; MRI_SURFACE *MRISreadFromVolume(MRI *mri, MRI_SURFACE *mris, int which) ; @@ -2123,7 +2111,6 @@ void mrisRemoveEdge(MRIS *mris, int vno1, int vno2); // Neighbourhoods // -#define MAX_NEIGHBORS (1024) void mrisVertexReplacingNeighbors(MRIS * mris, int vno, int vnum); void mrisForgetNeighborhoods (MRIS * mris); @@ -2131,7 +2118,6 @@ int MRISresetNeighborhoodSize (MRIS *mris, int nsize) ; void MRISsetNeighborhoodSize (MRIS *mris, int nsize) ; // Doesn't compute distances if not already present void MRISsetNeighborhoodSizeAndDist (MRIS *mris, int nsize) ; // Always computes distances -#define MRIS_MAX_NEIGHBORHOOD_LINKS 50 // bound on nlinks int MRISfindNeighborsAtVertex (MRIS *mris, int vno, int nlinks, size_t listCapacity, int* vlist, int* hops); // sets vlist[*] to the neighboring vno // sets hops [*] to -1 for [vno] and the number of hops for all entries returned in the vlist @@ -2185,8 +2171,14 @@ int MRIStranslate (MRIS *mris, float dx, float dy, float dz); void MRISmoveOrigin(MRIS *mris, float x0, float y0, float z0); int MRISscale (MRIS *mris, double scale); -void MRISblendXYZandTXYZ(MRIS* mris, float xyzScale, float txyzScale); // x = x*xyzScale + tx*txyzScale etc. -void MRISblendXYZandNXYZ(MRIS* mris, float nxyzScale); // x = x + nx*nxyzScale etc. +void MRISblendXYZandTXYZ(MRIS* mris, float xyzScale, float txyzScale); // x = x*xyzScale + tx*txyzScale etc. +void MRISblendXYZandNXYZ(MRIS* mris, float nxyzScale); // x = x + nx*nxyzScale etc. + + +void MRIStranslate_along_vertex_dxdydz(MRIS* dst, MRIS* src, double dt); // dst.x = src.x + src.dx*dt, etc. +void MRIStranslate_along_vertex_dxdydz(MRIS_MP* dst, MRIS_MP* src, double dt); + +MRIS* MRISrotate(MRIS* mris_src, MRIS* mris_dst, float alpha, float beta, float gamma) ; void mrisDisturbVertices(MRIS *mris, double amount); @@ -2209,7 +2201,9 @@ int mrisComputeSurfaceDimensions(MRIS *mris); // dist is created by calls to MRISsetNeighborhoodSizeAndDist // dist_orig must be explicitly created // -void MRISfreeDistsButNotOrig(MRIS *mris); +void MRISfreeDistsButNotOrig(MRIS* mris); +void MRISfreeDistsButNotOrig(MRISPV* mris); +void MRISfreeDistsButNotOrig(MRIS_MP* mris); void MRISmakeDistOrig (MRIS *mris, int vno); // makes it the same size as the current VERTEX.dist void MRISgrowDistOrig (MRIS *mris, int vno, int minimumCapacity); // same size as current or bigger diff --git a/include/mrisurf_FACE_VERTEX_MRIS_generated.h b/include/mrisurf_FACE_VERTEX_MRIS_generated.h index 09af1d2ae44..d9c0d7b3432 100644 --- a/include/mrisurf_FACE_VERTEX_MRIS_generated.h +++ b/include/mrisurf_FACE_VERTEX_MRIS_generated.h @@ -1,7 +1,9 @@ +#pragma once // GENERATED SOURCE - DO NOT DIRECTLY EDIT // // ======================================= +#include "mrisurf_aaa.h" #define SEPARATE_VERTEX_TOPOLOGY struct face_type_ { vertices_per_face_t v ; @@ -20,17 +22,16 @@ struct VERTEX_TOPOLOGY { // the whole fits in much less than one cache line, so further ordering is no use pSeveralInt f ; // size() is num. array[v->num] the fno's of the neighboring faces pSeveralUchar n ; // size() is num. array[v->num] the face.v[*] index for this vertex - pSeveralInt e ; // edge state for neighboring vertices (used by MRI_EDGE,MRI_CORNER) + pSeveralInt e ; // edge state for neighboring vertices pSeveralInt v ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops - short const vnum ; // number of 1-hop neighbors should use [p]VERTEXvnum(i, + short vnum ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) short v2num ; // number of 1, or 2-hop neighbors short v3num ; // number of 1,2,or 3-hop neighbors short vtotal ; // total # of neighbors. copy of vnum.nsizeCur short nsizeMaxClock ; // copy of mris->nsizeMaxClock when v#num uchar nsizeMax ; // the max nsize that was used to fill in vnum etc uchar nsizeCur ; // index of the current v#num in vtotal - uchar num ; // number of neighboring faces - VERTEX_TOPOLOGY() : vnum(0) {} + uchar num ; // number of neighboring faces }; // VERTEX_TOPOLOGY struct vertex_type_ { @@ -185,6 +186,7 @@ struct MRIS { float x0 ; // center of spherical expansion float y0 ; float z0 ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices PVERTEX v_temporal_pole ; PVERTEX v_frontal_pole ; PVERTEX v_occipital_pole ; @@ -282,7 +284,7 @@ struct MRIS { ELTX(short,nsizeMaxClock) SEP \ ELTT(uchar,nsizeMax) SEP \ ELTT(uchar,nsizeCur) SEP \ - ELTT(uchar,num) SEP \ + ELTT(uchar,num) \ // end of macro #define LIST_OF_VERTEX_ELTS_1 \ @@ -435,6 +437,7 @@ struct MRIS { ELTT(int,tempsAssigned) SEP \ ELTP(FACE,faces) SEP \ ELTP(MRI_EDGE,edges) SEP \ + ELTP(MRI_CORNER,corners) SEP \ ELTP(FaceNormCacheEntry,faceNormCacheEntries) SEP \ ELTP(FaceNormDeferredEntry,faceNormDeferredEntries) SEP \ ELTP(STRIP,strips) SEP \ diff --git a/include/mrisurf_MRIS.h b/include/mrisurf_MRIS.h new file mode 100644 index 00000000000..66eb12c5c2e --- /dev/null +++ b/include/mrisurf_MRIS.h @@ -0,0 +1 @@ +#include "mrisurf_FACE_VERTEX_MRIS_generated.h" diff --git a/include/mrisurf_MRISPV.h b/include/mrisurf_MRISPV.h new file mode 100644 index 00000000000..448ee2487cf --- /dev/null +++ b/include/mrisurf_MRISPV.h @@ -0,0 +1 @@ +#include "mrisurf_MRIS_PropertiesInVectors.h" diff --git a/include/mrisurf_MRIS_MP.h b/include/mrisurf_MRIS_MP.h new file mode 100644 index 00000000000..404e9b417e7 --- /dev/null +++ b/include/mrisurf_MRIS_MP.h @@ -0,0 +1,136 @@ +#pragma once + +#include "mrisurf_aaa.h" +#include "mrisurf_MRIS_MPPropertiesInVectors.h" + +// Just the information needed to compute the metric properties +// Some read-only information is obtained from the underlyingMRIS + + + // MRIS + // + // In + // +#define ELT(C,T,N) T C N; + + #define MRIS_MP__LIST_MRIS_IN \ + ELT(const, MRIS_Status, status ) SEP \ + ELT(const, MRIS_Status, origxyz_status ) SEP \ + ELT(const, int, nvertices ) SEP \ + ELT(const, int, nfaces ) SEP \ + ELT(const, char, nsize ) SEP \ + ELT(const, double, radius ) SEP \ + ELT(const, VERTEX_TOPOLOGY const *, vertices_topology) \ + ELTX(const, FACE_TOPOLOGY const *, faces_topology) + + // In out + #define MRIS_MP__LIST_MRIS_IN_OUT \ + ELT(, char, dist_nsize ) \ + + // Out + #define MRIS_MP__LIST_MRIS_OUT \ + ELT(, float, xlo ) SEP \ + ELT(, float, xhi ) SEP \ + ELT(, float, ylo ) SEP \ + ELT(, float, yhi ) SEP \ + ELT(, float, zlo ) SEP \ + ELT(, float, zhi ) SEP \ + ELT(, float, xctr ) SEP \ + ELT(, float, yctr ) SEP \ + ELT(, float, zctr ) SEP \ + ELT(, float, total_area ) SEP \ + ELT(, double, avg_vertex_area ) SEP \ + ELTX(, double, avg_vertex_dist ) SEP \ + ELT(, double, std_vertex_dist ) SEP \ + ELT(, float, neg_orig_area ) SEP \ + ELT(, float, neg_area ) + +#undef ELT + + // Vertices + // +#define ELT(C,T,N) C T * v_##N; + + // In + #define MRIS_MP__LIST_V_IN \ + ELT(const, char, ripflag ) SEP \ + ELTX(const, int, VSize ) SEP \ + /* following needed for SSE */ \ + ELT(const, float, whitex ) SEP \ + ELT(const, float, whitey ) SEP \ + ELT(const, float, whitez ) SEP \ + ELT(const, float, pialx ) SEP \ + ELT(const, float, pialy ) SEP \ + ELT(const, float, pialz ) SEP \ + ELT(const, float, wnx ) SEP \ + ELT(const, float, wny ) SEP \ + ELT(const, float, wnz ) SEP \ + ELTX(const, float*, dist_orig) /* note: these keep pointing to the original ones in the MRIS - change if code wants to change these values */ + + // In out + #define MRIS_MP__LIST_V_IN_OUT_XYZ \ + ELT(, float, x ) SEP \ + ELT(, float, y ) SEP \ + ELT(, float, z ) + + #define MRIS_MP__LIST_V_IN_OUT_NOXYZ \ + ELTX(, int, dist_capacity) SEP \ + ELT(, char, border ) SEP \ + ELT(, float, cx ) SEP \ + ELT(, float, cy ) SEP \ + ELT(, float, cz ) SEP \ + ELT(, float, curv ) SEP \ + ELT(, float, origarea ) SEP \ + ELT(, int, fno ) + + #define MRIS_MP__LIST_V_IN_OUT \ + MRIS_MP__LIST_V_IN_OUT_XYZ SEP MRIS_MP__LIST_V_IN_OUT_NOXYZ + + // Out + #define MRIS_MP__LIST_V_OUT \ + ELT(, float, area ) SEP \ + ELT(, float, nx ) SEP \ + ELT(, float, ny ) SEP \ + ELT(, float, nz ) SEP \ + ELTX(, char, neg ) SEP \ + ELTX(, float*, dist ) + +#undef ELT + + // Faces + // +#define ELT(C,T,N) C T * f_##N; + #define MRIS_MP__LIST_F_IN \ + ELT(const, char, ripflag ) SEP \ + ELTX(const, float, norm_orig_area ) SEP \ + ELTX(const, angles_per_triangle_t, orig_angle ) + + #define MRIS_MP__LIST_F_OUT \ + ELT(, float, area ) SEP \ + ELTX(, char, normSet ) SEP \ + ELTX(, FloatXYZ, norm ) SEP \ + ELTX(, angles_per_triangle_t, angle) + +#undef ELT + +#undef ELTX +#undef SEP + + +// Should turn these into member functions now we are using C++ +// +void MRISMP_ctr(MRIS_MP* mp); +void MRISMP_dtr(MRIS_MP* mp); +void MRISMP_copy(MRIS_MP* dst, MRIS_MP* src, + bool only_inputs, + bool no_need_to_copy_xyz); + +void MRISMP_load( + MRIS_MP* mp, // output + MRIS* mris, // input + bool loadOutputs = false, // used when doing stuff based on the outputs - see MRIScomputeSSE_asThoughGradientApplied + float * dx_or_NULL = nullptr, // loaded if not nullptr. The dx,dy,dz for ripped vertices are set to zero + float * dy_or_NULL = nullptr, + float * dz_or_NULL = nullptr); + +void MRISMP_unload(MRIS* mris, MRIS_MP* mp, bool check); diff --git a/include/mrisurf_MRIS_MPPropertiesInVectors.h b/include/mrisurf_MRIS_MPPropertiesInVectors.h new file mode 100644 index 00000000000..ac16eaed051 --- /dev/null +++ b/include/mrisurf_MRIS_MPPropertiesInVectors.h @@ -0,0 +1,87 @@ + +#pragma once +// GENERATED SOURCE - DO NOT DIRECTLY EDIT +// +// ======================================= +#include "mrisurf_aaa.h" +struct MRIS_MP { + MRIS* underlyingMRIS ; // for properties that are read from the underlying MRIS + MRIS_MP* in_src ; // since the in are not written, they can be shared by copies + int in_ref_count ; // check the src doesn't go away + VERTEX_TOPOLOGY const * vertices_topology ; // pointer copied from MRIS + FACE_TOPOLOGY const * faces_topology ; // pointer copied from MRIS + int* v_VSize ; + float** v_dist_buffer ; + const float* f_norm_orig_area ; + char* f_normSet ; + vertices_per_face_t* f_v ; + float* f_area ; + angles_per_triangle_t* f_angle ; + angles_per_triangle_t* f_orig_angle ; + char* f_ripflag ; + FloatXYZ* f_norm ; + pSeveralFloat* v_dist ; // size() is vtotal. distance to neighboring vertices based on xyz + pSeveralFloat* v_dist_orig ; // size() is vtotal. distance to neighboring vertices based on origxyz + int* v_dist_capacity ; // -- should contain at least vtx_vtotal elements + float* v_x ; // current coordinates + float* v_y ; // use MRISsetXYZ() to set + float* v_z ; + float* v_origx ; // original coordinates, see also MRIS::origxyz_status + float* v_origy ; // use MRISsetOriginalXYZ(, + float* v_origz ; // or MRISsetOriginalXYZfromXYZ to set + float* v_nx ; + float* v_ny ; + float* v_nz ; // curr normal + float* v_wnx ; + float* v_wny ; + float* v_wnz ; // white normal + float* v_dx ; + float* v_dy ; + float* v_dz ; // current change in position + float* v_curv ; // curr curvature + float* v_cx ; + float* v_cy ; + float* v_cz ; // coordinates in canonical coordinate system + float* v_pialx ; + float* v_pialy ; + float* v_pialz ; // pial surface coordinates + float* v_whitex ; + float* v_whitey ; + float* v_whitez ; // white surface coordinates + float* v_area ; + float* v_origarea ; + int* v_fno ; // face that this vertex is in + char* v_neg ; // 1 if the normal vector is inverted + char* v_border ; // flag + char* v_ripflag ; // vertex no longer exists - placed last to load the next vertex into cache + int nvertices ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + int nfaces ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + pSeveralVERTEX vertices ; + pSeveralFACE faces ; + pSeveralFaceNormCacheEntry faceNormCacheEntries ; + pSeveralFaceNormDeferredEntry faceNormDeferredEntries ; + float xctr ; + float yctr ; + float zctr ; + float xlo ; + float ylo ; + float zlo ; + float xhi ; + float yhi ; + float zhi ; + float total_area ; + double avg_vertex_area ; + double avg_vertex_dist ; // set by MRIScomputeAvgInterVertexDist + double std_vertex_dist ; + float orig_area ; + float neg_area ; + float neg_orig_area ; // amount of original surface in folds + double radius ; // radius (if status==MRIS_SPHERE) + MRIS_Status status ; // type of surface (e.g. sphere, plane) + MRIS_Status origxyz_status ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + int patch ; // if a patch of the surface + char nsize ; // size of neighborhoods or -1 + char dist_nsize ; // max mrisComputeVertexDistances has computed distances out to + int noscale ; // don't scale by surface area if true +}; // MRIS_MP + diff --git a/include/mrisurf_MRIS_PropertiesInVectors.h b/include/mrisurf_MRIS_PropertiesInVectors.h index 823b8b31edc..3ad5d9f9b97 100644 --- a/include/mrisurf_MRIS_PropertiesInVectors.h +++ b/include/mrisurf_MRIS_PropertiesInVectors.h @@ -1,52 +1,249 @@ +#pragma once // GENERATED SOURCE - DO NOT DIRECTLY EDIT // // ======================================= +#include "mrisurf_aaa.h" struct MRISPV { - vertices_per_face_t * f_v ; - float * f_area ; - angles_per_triangle_t * f_angle ; - char * f_ripflag ; - PDMATRIX * f_norm ; + vertices_per_face_t* f_v ; + float* f_area ; + angles_per_triangle_t* f_angle ; + angles_per_triangle_t* f_orig_angle ; + char* f_ripflag ; + char* f_oripflag ; + int* f_marked ; + PDMATRIX* f_norm ; + A3PDMATRIX* f_gradNorm ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - pSeveralInt * v_f ; // size() is num. array[v->num] the fno's of the neighboring faces - uchar * v_num ; // number of neighboring faces + pSeveralInt* v_f ; // size() is num. array[v->num] the fno's of the neighboring faces + pSeveralUchar* v_n ; // size() is num. array[v->num] the face.v[*] index for this vertex + pSeveralInt* v_e ; // edge state for neighboring vertices + pSeveralInt* v_v ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + short* v_vnum ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + short* v_v2num ; // number of 1, or 2-hop neighbors + short* v_v3num ; // number of 1,2,or 3-hop neighbors + short* v_vtotal ; // total # of neighbors. copy of vnum.nsizeCur + short* v_nsizeMaxClock ; // copy of mris->nsizeMaxClock when v#num + uchar* v_nsizeMax ; // the max nsize that was used to fill in vnum etc + uchar* v_nsizeCur ; // index of the current v#num in vtotal + uchar* v_num ; // number of neighboring faces // managed by MRISfreeDists[_orig] and MRISmakeDists[_orig] - pSeveralFloat * v_dist ; // size() is vtotal. distance to neighboring vertices based on xyz - int * v_dist_capacity ; // -- should contain at least vtx_vtotal elements - float * v_x ; // current coordinates - float * v_y ; // use MRISsetXYZ() to set - float * v_z ; - float * v_nx ; - float * v_ny ; - float * v_nz ; // curr normal - float * v_area ; - float * v_origarea ; - char * v_neg ; // 1 if the normal vector is inverted - char * v_border ; // flag - char * v_ripflag ; // vertex no longer exists - placed last to load the next vertex into cache + pSeveralFloat* v_dist ; // size() is vtotal. distance to neighboring vertices based on xyz + pSeveralFloat* v_dist_orig ; // size() is vtotal. distance to neighboring vertices based on origxyz + int* v_dist_capacity ; // -- should contain at least vtx_vtotal elements + int* v_dist_orig_capacity ; // -- should contain at least vtx_vtotal elements + float* v_x ; // current coordinates + float* v_y ; // use MRISsetXYZ() to set + float* v_z ; + float* v_origx ; // original coordinates, see also MRIS::origxyz_status + float* v_origy ; // use MRISsetOriginalXYZ(, + float* v_origz ; // or MRISsetOriginalXYZfromXYZ to set + float* v_nx ; + float* v_ny ; + float* v_nz ; // curr normal + float* v_pnx ; + float* v_pny ; + float* v_pnz ; // pial normal + float* v_wnx ; + float* v_wny ; + float* v_wnz ; // white normal + float* v_onx ; + float* v_ony ; + float* v_onz ; // original normal + float* v_dx ; + float* v_dy ; + float* v_dz ; // current change in position + float* v_odx ; + float* v_ody ; + float* v_odz ; // last change of position (for momentum, + float* v_tdx ; + float* v_tdy ; + float* v_tdz ; // temporary storage for averaging gradient + float* v_curv ; // curr curvature + float* v_curvbak ; + float* v_val ; // scalar data value (file: rh.val, sig2-rh.w) + float* v_imag_val ; // imaginary part of complex data value + float* v_cx ; + float* v_cy ; + float* v_cz ; // coordinates in canonical coordinate system + float* v_tx ; + float* v_ty ; + float* v_tz ; // tmp coordinate storage + float* v_t2x ; + float* v_t2y ; + float* v_t2z ; // another tmp coordinate storage + float* v_targx ; + float* v_targy ; + float* v_targz ; // target coordinates + float* v_pialx ; + float* v_pialy ; + float* v_pialz ; // pial surface coordinates + float* v_whitex ; + float* v_whitey ; + float* v_whitez ; // white surface coordinates + float* v_l4x ; + float* v_l4y ; + float* v_l4z ; // layerIV surface coordinates + float* v_infx ; + float* v_infy ; + float* v_infz ; // inflated coordinates + float* v_fx ; + float* v_fy ; + float* v_fz ; // flattened coordinates + int* v_px ; + int* v_qx ; + int* v_py ; + int* v_qy ; + int* v_pz ; + int* v_qz ; // rational coordinates for exact calculations + float* v_e1x ; + float* v_e1y ; + float* v_e1z ; // 1st basis vector for the local tangent plane + float* v_e2x ; + float* v_e2y ; + float* v_e2z ; // 2nd basis vector for the local tangent plane + float* v_pe1x ; + float* v_pe1y ; + float* v_pe1z ; // 1st basis vector for the local tangent plane + float* v_pe2x ; + float* v_pe2y ; + float* v_pe2z ; // 2nd basis vector for the local tangent plane + float* v_nc ; // curr length normal comp + float* v_val2 ; // complex comp data value (file: sig3-rh.w) + float* v_valbak ; // scalar data stack + float* v_val2bak ; // complex comp data stack + float* v_stat ; // statistic + int* v_undefval ; // [previously dist=0] + int* v_old_undefval ; // for smooth_val_sparse + int* v_fixedval ; // [previously val=0] + float* v_fieldsign ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + float* v_fsmask ; // significance mask (file: rh.fm) + float* v_d ; // for distance calculations + int* v_annotation ; // area label (defunct--now from label file name!) + char* v_oripflag ; + char* v_origripflag ; // cuts flags + p_void* v_vp ; // to store user's information + float* v_theta ; + float* v_phi ; // parameterization + float* v_area ; + float* v_origarea ; + float* v_group_avg_area ; + float* v_K ; // Gaussian curvature + float* v_H ; // mean curvature + float* v_k1 ; + float* v_k2 ; // the principal curvatures + float* v_mean ; + float* v_mean_imag ; // imaginary part of complex statistic + float* v_std_error ; + uint* v_flags ; + int* v_fno ; // face that this vertex is in + int* v_cropped ; + short* v_marked ; // for a variety of uses + short* v_marked2 ; + short* v_marked3 ; + char* v_neg ; // 1 if the normal vector is inverted + char* v_border ; // flag + char* v_ripflag ; // vertex no longer exists - placed last to load the next vertex into cache // Fields being maintained by specialist functions - int nvertices ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - int nfaces ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - float xctr ; - float yctr ; - float zctr ; - float xlo ; - float ylo ; - float zlo ; - float xhi ; - float yhi ; - float zhi ; - float total_area ; - double avg_vertex_area ; - double avg_vertex_dist ; // set by MRIScomputeAvgInterVertexDist - double std_vertex_dist ; - float neg_area ; - float neg_orig_area ; // amount of original surface in folds - double radius ; // radius (if status==MRIS_SPHERE) - MRIS_Status status ; // type of surface (e.g. sphere, plane) - MRIS_Status origxyz_status ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - char nsize ; // size of neighborhoods or -1 - char dist_nsize ; // max mrisComputeVertexDistances has computed distances out to -}; + int nverticesFrozen ; // # of vertices on surface is frozen + int nvertices ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + int nfaces ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + bool faceAttachmentDeferred ; // defer connecting faces to vertices for performance reasons + int nedges ; // # of edges on surface + int ncorners ; // # of triangle corners + int nstrips ; + pSeveralVERTEX_TOPOLOGY vertices_topology ; + pSeveralVERTEX vertices ; + p_p_void dist_storage ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + p_p_void dist_orig_storage ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + int tempsAssigned ; // State of various temp fields that can be borrowed if not already in use + pSeveralFACE faces ; + pSeveralMRI_EDGE edges ; + pSeveralMRI_CORNER corners ; + pSeveralFaceNormCacheEntry faceNormCacheEntries ; + pSeveralFaceNormDeferredEntry faceNormDeferredEntries ; + pSeveralSTRIP strips ; + float xctr ; + float yctr ; + float zctr ; + float xlo ; + float ylo ; + float zlo ; + float xhi ; + float yhi ; + float zhi ; + float x0 ; // center of spherical expansion + float y0 ; + float z0 ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + float max_curv ; + float min_curv ; + float total_area ; + double avg_vertex_area ; + double avg_vertex_dist ; // set by MRIScomputeAvgInterVertexDist + double std_vertex_dist ; + float orig_area ; + float neg_area ; + float neg_orig_area ; // amount of original surface in folds + int zeros ; + int hemisphere ; // which hemisphere + int initialized ; + PLTA lta ; + PMATRIX SRASToTalSRAS_ ; + PMATRIX TalSRASToSRAS_ ; + int free_transform ; + double radius ; // radius (if status==MRIS_SPHERE) + float a ; + float b ; + float c ; // ellipsoid parameters + MRIS_fname_t fname ; // file it was originally loaded from + float Hmin ; // min mean curvature + float Hmax ; // max mean curvature + float Kmin ; // min Gaussian curvature + float Kmax ; // max Gaussian curvature + double Ktotal ; // total Gaussian curvature + MRIS_Status status ; // type of surface (e.g. sphere, plane) + MRIS_Status origxyz_status ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + int patch ; // if a patch of the surface + int nlabels ; + PMRIS_AREA_LABEL labels ; // nlabels of these (may be null) + char nsize ; // size of neighborhoods or -1 + uchar vtotalsMightBeTooBig ; // MRISsampleDistances sets this + short nsizeMaxClock ; // changed whenever an edge is added or removed, which invalidates the vertex v#num values + char max_nsize ; // max the neighborhood size has been set to (typically 3) + char dist_nsize ; // max mrisComputeVertexDistances has computed distances out to + char dist_orig_nsize ; // max mrisComputeOriginalVertexDistances has computed distances out to + char dist_alloced_flags ; // two flags, set when any dist(1) or dist_orig(2) allocated + float avg_nbrs ; // mean # of vertex neighbors + p_void vp ; // for misc. use + float alpha ; // rotation around z-axis + float beta ; // rotation around y-axis + float gamma ; // rotation around x-axis + float da ; + float db ; + float dg ; // old deltas + int type ; // what type of surface was this initially + int max_vertices ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + int max_faces ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + MRIS_subject_name_t subject_name ; // name of the subject + float canon_area ; + int noscale ; // don't scale by surface area if true + pSeveralFloat dx2 ; // an extra set of gradient (not always alloced) + pSeveralFloat dy2 ; + pSeveralFloat dz2 ; + PCOLOR_TABLE ct ; + int useRealRAS ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + VOL_GEOM vg ; // volume info from which this surface is created. valid iff vg.valid = 1 + MRIS_cmdlines_t cmdlines ; + int ncmds ; + float group_avg_surface_area ; // average of total surface area for group + int group_avg_vtxarea_loaded ; // average vertex area for group at each vertex + int triangle_links_removed ; // for quad surfaces + p_void user_parms ; // for whatever the user wants to hang here + PMATRIX m_sras2vox ; // for converting surface ras to voxel + PMRI mri_sras2vox ; // volume that the above matrix is for + p_void mht ; + p_void temps ; +}; // MRISPV + diff --git a/include/mrisurf_SurfaceFromMRISPV_generated.h b/include/mrisurf_SurfaceFromMRISPV_generated.h index cf72b3fc92e..f6ff8aaebb8 100644 --- a/include/mrisurf_SurfaceFromMRISPV_generated.h +++ b/include/mrisurf_SurfaceFromMRISPV_generated.h @@ -1,9 +1,11 @@ #pragma once #include "./mrisurf_SurfaceFromMRISPV_generated_prefix.h" +#pragma once // GENERATED SOURCE - DO NOT DIRECTLY EDIT // // ======================================= +#include "mrisurf_aaa.h" namespace SurfaceFromMRISPV { typedef MRISPV Representation; #include "mrisurf_SurfaceFromMRISPV_generated_Existence.h" diff --git a/include/mrisurf_SurfaceFromMRISPV_generated_AllM.h b/include/mrisurf_SurfaceFromMRISPV_generated_AllM.h index 5b77c404284..f3f9a7ff35d 100644 --- a/include/mrisurf_SurfaceFromMRISPV_generated_AllM.h +++ b/include/mrisurf_SurfaceFromMRISPV_generated_AllM.h @@ -1,24 +1,36 @@ namespace AllM { struct Face : public Repr_Elt { + typedef AllM::Surface Surface; + typedef AllM::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline float area ( ) const ; - inline angles_per_triangle_t angle ( ) const ; - inline char ripflag ( ) const ; - inline PDMATRIX norm ( ) const ; + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; + inline PDMATRIX norm ( ) const ; + inline A3PDMATRIX gradNorm ( ) const ; - inline void set_v ( size_t i, Vertex to ) ; - inline void set_area ( float to ) ; - inline void set_angle ( angles_per_triangle_t to ) ; - inline void set_ripflag ( char to ) ; - inline void set_norm ( PDMATRIX to ) ; - }; + inline void set_v ( size_t i, Vertex to ) ; + inline void set_area ( float to ) ; + inline void set_angle ( angles_per_triangle_t to ) ; + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + inline void set_norm ( PDMATRIX to ) ; + inline void set_gradNorm ( A3PDMATRIX to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef AllM::Surface Surface; + typedef AllM::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -26,99 +38,418 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline uchar num ( ) const ; // number of neighboring faces + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces // managed by MRISfreeDists[_orig] and MRISmakeDists[_orig] - inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz - inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements // - inline float x ( ) const ; // current coordinates - inline float y ( ) const ; // use MRISsetXYZ() to set - inline float z ( ) const ; + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; // + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set // - inline float nx ( ) const ; - inline float ny ( ) const ; - inline float nz ( ) const ; // curr normal + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float pnx ( ) const ; + inline float pny ( ) const ; + inline float pnz ( ) const ; // pial normal // + inline float wnx ( ) const ; + inline float wny ( ) const ; + inline float wnz ( ) const ; // white normal + inline float onx ( ) const ; + inline float ony ( ) const ; + inline float onz ( ) const ; // original normal + inline float dx ( ) const ; + inline float dy ( ) const ; + inline float dz ( ) const ; // current change in position + inline float odx ( ) const ; + inline float ody ( ) const ; + inline float odz ( ) const ; // last change of position (for momentum, + inline float tdx ( ) const ; + inline float tdy ( ) const ; + inline float tdz ( ) const ; // temporary storage for averaging gradient + inline float curv ( ) const ; // curr curvature + inline float curvbak ( ) const ; + inline float val ( ) const ; // scalar data value (file: rh.val, sig2-rh.w) + inline float imag_val ( ) const ; // imaginary part of complex data value + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float tx ( ) const ; + inline float ty ( ) const ; + inline float tz ( ) const ; // tmp coordinate storage + inline float t2x ( ) const ; + inline float t2y ( ) const ; + inline float t2z ( ) const ; // another tmp coordinate storage + inline float targx ( ) const ; + inline float targy ( ) const ; + inline float targz ( ) const ; // target coordinates + inline float pialx ( ) const ; + inline float pialy ( ) const ; + inline float pialz ( ) const ; // pial surface coordinates + inline float whitex ( ) const ; + inline float whitey ( ) const ; + inline float whitez ( ) const ; // white surface coordinates + inline float l4x ( ) const ; + inline float l4y ( ) const ; + inline float l4z ( ) const ; // layerIV surface coordinates + inline float infx ( ) const ; + inline float infy ( ) const ; + inline float infz ( ) const ; // inflated coordinates + inline float fx ( ) const ; + inline float fy ( ) const ; + inline float fz ( ) const ; // flattened coordinates + inline int px ( ) const ; + inline int qx ( ) const ; + inline int py ( ) const ; + inline int qy ( ) const ; + inline int pz ( ) const ; + inline int qz ( ) const ; // rational coordinates for exact calculations + inline float e1x ( ) const ; + inline float e1y ( ) const ; + inline float e1z ( ) const ; // 1st basis vector for the local tangent plane + inline float e2x ( ) const ; + inline float e2y ( ) const ; + inline float e2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float pe1x ( ) const ; + inline float pe1y ( ) const ; + inline float pe1z ( ) const ; // 1st basis vector for the local tangent plane + inline float pe2x ( ) const ; + inline float pe2y ( ) const ; + inline float pe2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float nc ( ) const ; // curr length normal comp + inline float val2 ( ) const ; // complex comp data value (file: sig3-rh.w) + inline float valbak ( ) const ; // scalar data stack + inline float val2bak ( ) const ; // complex comp data stack + inline float stat ( ) const ; // statistic // + inline int undefval ( ) const ; // [previously dist=0] + inline int old_undefval ( ) const ; // for smooth_val_sparse + inline int fixedval ( ) const ; // [previously val=0] // - inline float area ( ) const ; - inline float origarea ( ) const ; - inline char neg ( ) const ; // 1 if the normal vector is inverted - inline char border ( ) const ; // flag - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache - inline void which_coords (int which, float *x, float *y, float *z) const ; + inline float fieldsign ( ) const ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline float fsmask ( ) const ; // significance mask (file: rh.fm) + inline float d ( ) const ; // for distance calculations + inline int annotation ( ) const ; // area label (defunct--now from label file name!) + inline char oripflag ( ) const ; + inline char origripflag ( ) const ; // cuts flags + inline p_void vp ( ) const ; // to store user's information + inline float theta ( ) const ; + inline float phi ( ) const ; // parameterization + inline float area ( ) const ; + inline float origarea ( ) const ; + inline float group_avg_area ( ) const ; + inline float K ( ) const ; // Gaussian curvature + inline float H ( ) const ; // mean curvature + inline float k1 ( ) const ; + inline float k2 ( ) const ; // the principal curvatures + inline float mean ( ) const ; + inline float mean_imag ( ) const ; // imaginary part of complex statistic + inline float std_error ( ) const ; + inline uint flags ( ) const ; + inline int fno ( ) const ; // face that this vertex is in + inline int cropped ( ) const ; + inline short marked ( ) const ; // for a variety of uses + inline short marked2 ( ) const ; + inline short marked3 ( ) const ; + inline char neg ( ) const ; // 1 if the normal vector is inverted + inline char border ( ) const ; // flag + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces - inline void set_num ( uchar to ) ; // number of neighboring faces + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices + inline void set_v ( size_t i, Vertex to ) ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline void set_vnum ( short to ) ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline void set_v2num ( short to ) ; // number of 1, or 2-hop neighbors + inline void set_v3num ( short to ) ; // number of 1,2,or 3-hop neighbors + inline void set_vtotal ( short to ) ; // total # of neighbors. copy of vnum.nsizeCur + inline void set_nsizeMaxClock ( short to ) ; // copy of mris->nsizeMaxClock when v#num + inline void set_nsizeMax ( uchar to ) ; // the max nsize that was used to fill in vnum etc + inline void set_nsizeCur ( uchar to ) ; // index of the current v#num in vtotal + inline void set_num ( uchar to ) ; // number of neighboring faces // - inline void set_x ( float to ) ; // current coordinates - inline void set_y ( float to ) ; // use MRISsetXYZ() to set - inline void set_z ( float to ) ; + inline void set_x ( float to ) ; // current coordinates + inline void set_y ( float to ) ; // use MRISsetXYZ() to set + inline void set_z ( float to ) ; // + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_pnx ( float to ) ; + inline void set_pny ( float to ) ; + inline void set_pnz ( float to ) ; // pial normal // - inline void set_nx ( float to ) ; - inline void set_ny ( float to ) ; - inline void set_nz ( float to ) ; // curr normal + inline void set_wnx ( float to ) ; + inline void set_wny ( float to ) ; + inline void set_wnz ( float to ) ; // white normal + inline void set_onx ( float to ) ; + inline void set_ony ( float to ) ; + inline void set_onz ( float to ) ; // original normal + inline void set_dx ( float to ) ; + inline void set_dy ( float to ) ; + inline void set_dz ( float to ) ; // current change in position + inline void set_odx ( float to ) ; + inline void set_ody ( float to ) ; + inline void set_odz ( float to ) ; // last change of position (for momentum, + inline void set_tdx ( float to ) ; + inline void set_tdy ( float to ) ; + inline void set_tdz ( float to ) ; // temporary storage for averaging gradient + inline void set_curv ( float to ) ; // curr curvature + inline void set_curvbak ( float to ) ; + inline void set_val ( float to ) ; // scalar data value (file: rh.val, sig2-rh.w) + inline void set_imag_val ( float to ) ; // imaginary part of complex data value + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_tx ( float to ) ; + inline void set_ty ( float to ) ; + inline void set_tz ( float to ) ; // tmp coordinate storage + inline void set_t2x ( float to ) ; + inline void set_t2y ( float to ) ; + inline void set_t2z ( float to ) ; // another tmp coordinate storage + inline void set_targx ( float to ) ; + inline void set_targy ( float to ) ; + inline void set_targz ( float to ) ; // target coordinates + inline void set_pialx ( float to ) ; + inline void set_pialy ( float to ) ; + inline void set_pialz ( float to ) ; // pial surface coordinates + inline void set_whitex ( float to ) ; + inline void set_whitey ( float to ) ; + inline void set_whitez ( float to ) ; // white surface coordinates + inline void set_l4x ( float to ) ; + inline void set_l4y ( float to ) ; + inline void set_l4z ( float to ) ; // layerIV surface coordinates + inline void set_infx ( float to ) ; + inline void set_infy ( float to ) ; + inline void set_infz ( float to ) ; // inflated coordinates + inline void set_fx ( float to ) ; + inline void set_fy ( float to ) ; + inline void set_fz ( float to ) ; // flattened coordinates + inline void set_px ( int to ) ; + inline void set_qx ( int to ) ; + inline void set_py ( int to ) ; + inline void set_qy ( int to ) ; + inline void set_pz ( int to ) ; + inline void set_qz ( int to ) ; // rational coordinates for exact calculations + inline void set_e1x ( float to ) ; + inline void set_e1y ( float to ) ; + inline void set_e1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_e2x ( float to ) ; + inline void set_e2y ( float to ) ; + inline void set_e2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_pe1x ( float to ) ; + inline void set_pe1y ( float to ) ; + inline void set_pe1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_pe2x ( float to ) ; + inline void set_pe2y ( float to ) ; + inline void set_pe2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_nc ( float to ) ; // curr length normal comp + inline void set_val2 ( float to ) ; // complex comp data value (file: sig3-rh.w) + inline void set_valbak ( float to ) ; // scalar data stack + inline void set_val2bak ( float to ) ; // complex comp data stack + inline void set_stat ( float to ) ; // statistic // + inline void set_undefval ( int to ) ; // [previously dist=0] + inline void set_old_undefval ( int to ) ; // for smooth_val_sparse + inline void set_fixedval ( int to ) ; // [previously val=0] // - // - inline void set_area ( float to ) ; - inline void set_origarea ( float to ) ; - inline void set_neg ( char to ) ; // 1 if the normal vector is inverted - inline void set_border ( char to ) ; // flag - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_fieldsign ( float to ) ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline void set_fsmask ( float to ) ; // significance mask (file: rh.fm) + inline void set_d ( float to ) ; // for distance calculations + inline void set_annotation ( int to ) ; // area label (defunct--now from label file name!) + inline void set_oripflag ( char to ) ; + inline void set_origripflag ( char to ) ; // cuts flags + inline void set_vp ( p_void to ) ; // to store user's information + inline void set_theta ( float to ) ; + inline void set_phi ( float to ) ; // parameterization + inline void set_area ( float to ) ; + inline void set_origarea ( float to ) ; + inline void set_group_avg_area ( float to ) ; + inline void set_K ( float to ) ; // Gaussian curvature + inline void set_H ( float to ) ; // mean curvature + inline void set_k1 ( float to ) ; + inline void set_k2 ( float to ) ; // the principal curvatures + inline void set_mean ( float to ) ; + inline void set_mean_imag ( float to ) ; // imaginary part of complex statistic + inline void set_std_error ( float to ) ; + inline void set_flags ( uint to ) ; + inline void set_fno ( int to ) ; // face that this vertex is in + inline void set_cropped ( int to ) ; + inline void set_marked ( short to ) ; // for a variety of uses + inline void set_marked2 ( short to ) ; + inline void set_marked3 ( short to ) ; + inline void set_neg ( char to ) ; // 1 if the normal vector is inverted + inline void set_border ( char to ) ; // flag + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef AllM::Face Face; + typedef AllM::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); // Fields being maintained by specialist functions - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline Vertex vertices ( size_t i ) const ; - inline Face faces ( size_t i ) const ; - inline float xctr ( ) const ; - inline float yctr ( ) const ; - inline float zctr ( ) const ; - inline float xlo ( ) const ; - inline float ylo ( ) const ; - inline float zlo ( ) const ; - inline float xhi ( ) const ; - inline float yhi ( ) const ; - inline float zhi ( ) const ; - inline float total_area ( ) const ; - inline double avg_vertex_area ( ) const ; - inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist - inline double std_vertex_dist ( ) const ; - inline float neg_area ( ) const ; - inline float neg_orig_area ( ) const ; // amount of original surface in folds - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline STRIP strips ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float x0 ( ) const ; // center of spherical expansion + inline float y0 ( ) const ; + inline float z0 ( ) const ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + // + inline float max_curv ( ) const ; + inline float min_curv ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline int zeros ( ) const ; + inline int hemisphere ( ) const ; // which hemisphere + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline float Hmin ( ) const ; // min mean curvature + inline float Hmax ( ) const ; // max mean curvature + inline float Kmin ( ) const ; // min Gaussian curvature + inline float Kmax ( ) const ; // max Gaussian curvature + inline double Ktotal ( ) const ; // total Gaussian curvature + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int nlabels ( ) const ; + inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) + inline p_void vp ( ) const ; // for misc. use + inline float alpha ( ) const ; // rotation around z-axis + inline float beta ( ) const ; // rotation around y-axis + inline float gamma ( ) const ; // rotation around x-axis + inline float da ( ) const ; + inline float db ( ) const ; + inline float dg ( ) const ; // old deltas + inline int type ( ) const ; // what type of surface was this initially + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; - inline void set_xctr ( float to ) ; - inline void set_yctr ( float to ) ; - inline void set_zctr ( float to ) ; - inline void set_xlo ( float to ) ; - inline void set_ylo ( float to ) ; - inline void set_zlo ( float to ) ; - inline void set_xhi ( float to ) ; - inline void set_yhi ( float to ) ; - inline void set_zhi ( float to ) ; - inline void set_total_area ( float to ) ; - inline void set_avg_vertex_area ( double to ) ; - inline void set_avg_vertex_dist ( double to ) ; // set by MRIScomputeAvgInterVertexDist - inline void set_std_vertex_dist ( double to ) ; - inline void set_neg_area ( float to ) ; - inline void set_neg_orig_area ( float to ) ; // amount of original surface in folds - inline void set_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) - inline void set_origxyz_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - }; + inline void set_strips ( size_t i, STRIP to ) ; + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_x0 ( float to ) ; // center of spherical expansion + inline void set_y0 ( float to ) ; + inline void set_z0 ( float to ) ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + // + inline void set_max_curv ( float to ) ; + inline void set_min_curv ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + inline void set_avg_vertex_dist ( double to ) ; // set by MRIScomputeAvgInterVertexDist + inline void set_std_vertex_dist ( double to ) ; + inline void set_orig_area ( float to ) ; + inline void set_neg_area ( float to ) ; + inline void set_neg_orig_area ( float to ) ; // amount of original surface in folds + inline void set_zeros ( int to ) ; + inline void set_hemisphere ( int to ) ; // which hemisphere + inline void set_fname ( MRIS_fname_t to ) ; // file it was originally loaded from + inline void set_Hmin ( float to ) ; // min mean curvature + inline void set_Hmax ( float to ) ; // max mean curvature + inline void set_Kmin ( float to ) ; // min Gaussian curvature + inline void set_Kmax ( float to ) ; // max Gaussian curvature + inline void set_Ktotal ( double to ) ; // total Gaussian curvature + inline void set_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) + inline void set_origxyz_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline void set_patch ( int to ) ; // if a patch of the surface + inline void set_nlabels ( int to ) ; + inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) + inline void set_vp ( p_void to ) ; // for misc. use + inline void set_alpha ( float to ) ; // rotation around z-axis + inline void set_beta ( float to ) ; // rotation around y-axis + inline void set_gamma ( float to ) ; // rotation around x-axis + inline void set_da ( float to ) ; + inline void set_db ( float to ) ; + inline void set_dg ( float to ) ; // old deltas + inline void set_type ( int to ) ; // what type of surface was this initially + }; // Surface } // namespace AllM diff --git a/include/mrisurf_SurfaceFromMRISPV_generated_Analysis.h b/include/mrisurf_SurfaceFromMRISPV_generated_Analysis.h index 79b0f7832b4..31800a7202c 100644 --- a/include/mrisurf_SurfaceFromMRISPV_generated_Analysis.h +++ b/include/mrisurf_SurfaceFromMRISPV_generated_Analysis.h @@ -1,21 +1,32 @@ namespace Analysis { struct Face : public Repr_Elt { + typedef Analysis::Surface Surface; + typedef Analysis::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline float area ( ) const ; - inline angles_per_triangle_t angle ( ) const ; - inline char ripflag ( ) const ; - inline PDMATRIX norm ( ) const ; + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; + inline PDMATRIX norm ( ) const ; + inline A3PDMATRIX gradNorm ( ) const ; - inline void set_ripflag ( char to ) ; - }; + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef Analysis::Surface Surface; + typedef Analysis::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -24,85 +35,396 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline uchar num ( ) const ; // number of neighboring faces + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces // managed by MRISfreeDists[_orig] and MRISmakeDists[_orig] - inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz - inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements // - inline float x ( ) const ; // current coordinates - inline float y ( ) const ; // use MRISsetXYZ() to set - inline float z ( ) const ; + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; // + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set // - inline float nx ( ) const ; - inline float ny ( ) const ; - inline float nz ( ) const ; // curr normal + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float pnx ( ) const ; + inline float pny ( ) const ; + inline float pnz ( ) const ; // pial normal // + inline float wnx ( ) const ; + inline float wny ( ) const ; + inline float wnz ( ) const ; // white normal + inline float onx ( ) const ; + inline float ony ( ) const ; + inline float onz ( ) const ; // original normal + inline float dx ( ) const ; + inline float dy ( ) const ; + inline float dz ( ) const ; // current change in position + inline float odx ( ) const ; + inline float ody ( ) const ; + inline float odz ( ) const ; // last change of position (for momentum, + inline float tdx ( ) const ; + inline float tdy ( ) const ; + inline float tdz ( ) const ; // temporary storage for averaging gradient + inline float curv ( ) const ; // curr curvature + inline float curvbak ( ) const ; + inline float val ( ) const ; // scalar data value (file: rh.val, sig2-rh.w) + inline float imag_val ( ) const ; // imaginary part of complex data value + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float tx ( ) const ; + inline float ty ( ) const ; + inline float tz ( ) const ; // tmp coordinate storage + inline float t2x ( ) const ; + inline float t2y ( ) const ; + inline float t2z ( ) const ; // another tmp coordinate storage + inline float targx ( ) const ; + inline float targy ( ) const ; + inline float targz ( ) const ; // target coordinates + inline float pialx ( ) const ; + inline float pialy ( ) const ; + inline float pialz ( ) const ; // pial surface coordinates + inline float whitex ( ) const ; + inline float whitey ( ) const ; + inline float whitez ( ) const ; // white surface coordinates + inline float l4x ( ) const ; + inline float l4y ( ) const ; + inline float l4z ( ) const ; // layerIV surface coordinates + inline float infx ( ) const ; + inline float infy ( ) const ; + inline float infz ( ) const ; // inflated coordinates + inline float fx ( ) const ; + inline float fy ( ) const ; + inline float fz ( ) const ; // flattened coordinates + inline int px ( ) const ; + inline int qx ( ) const ; + inline int py ( ) const ; + inline int qy ( ) const ; + inline int pz ( ) const ; + inline int qz ( ) const ; // rational coordinates for exact calculations + inline float e1x ( ) const ; + inline float e1y ( ) const ; + inline float e1z ( ) const ; // 1st basis vector for the local tangent plane + inline float e2x ( ) const ; + inline float e2y ( ) const ; + inline float e2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float pe1x ( ) const ; + inline float pe1y ( ) const ; + inline float pe1z ( ) const ; // 1st basis vector for the local tangent plane + inline float pe2x ( ) const ; + inline float pe2y ( ) const ; + inline float pe2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float nc ( ) const ; // curr length normal comp + inline float val2 ( ) const ; // complex comp data value (file: sig3-rh.w) + inline float valbak ( ) const ; // scalar data stack + inline float val2bak ( ) const ; // complex comp data stack + inline float stat ( ) const ; // statistic // + inline int undefval ( ) const ; // [previously dist=0] + inline int old_undefval ( ) const ; // for smooth_val_sparse + inline int fixedval ( ) const ; // [previously val=0] // - inline float area ( ) const ; - inline float origarea ( ) const ; - inline char neg ( ) const ; // 1 if the normal vector is inverted - inline char border ( ) const ; // flag - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache - inline void which_coords (int which, float *x, float *y, float *z) const ; + inline float fieldsign ( ) const ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline float fsmask ( ) const ; // significance mask (file: rh.fm) + inline float d ( ) const ; // for distance calculations + inline int annotation ( ) const ; // area label (defunct--now from label file name!) + inline char oripflag ( ) const ; + inline char origripflag ( ) const ; // cuts flags + inline p_void vp ( ) const ; // to store user's information + inline float theta ( ) const ; + inline float phi ( ) const ; // parameterization + inline float area ( ) const ; + inline float origarea ( ) const ; + inline float group_avg_area ( ) const ; + inline float K ( ) const ; // Gaussian curvature + inline float H ( ) const ; // mean curvature + inline float k1 ( ) const ; + inline float k2 ( ) const ; // the principal curvatures + inline float mean ( ) const ; + inline float mean_imag ( ) const ; // imaginary part of complex statistic + inline float std_error ( ) const ; + inline uint flags ( ) const ; + inline int fno ( ) const ; // face that this vertex is in + inline int cropped ( ) const ; + inline short marked ( ) const ; // for a variety of uses + inline short marked2 ( ) const ; + inline short marked3 ( ) const ; + inline char neg ( ) const ; // 1 if the normal vector is inverted + inline char border ( ) const ; // flag + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices // + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_pnx ( float to ) ; + inline void set_pny ( float to ) ; + inline void set_pnz ( float to ) ; // pial normal // - inline void set_nx ( float to ) ; - inline void set_ny ( float to ) ; - inline void set_nz ( float to ) ; // curr normal - inline void set_origarea ( float to ) ; - inline void set_neg ( char to ) ; // 1 if the normal vector is inverted - inline void set_border ( char to ) ; // flag - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_wnx ( float to ) ; + inline void set_wny ( float to ) ; + inline void set_wnz ( float to ) ; // white normal + inline void set_onx ( float to ) ; + inline void set_ony ( float to ) ; + inline void set_onz ( float to ) ; // original normal + inline void set_dx ( float to ) ; + inline void set_dy ( float to ) ; + inline void set_dz ( float to ) ; // current change in position + inline void set_odx ( float to ) ; + inline void set_ody ( float to ) ; + inline void set_odz ( float to ) ; // last change of position (for momentum, + inline void set_tdx ( float to ) ; + inline void set_tdy ( float to ) ; + inline void set_tdz ( float to ) ; // temporary storage for averaging gradient + inline void set_curv ( float to ) ; // curr curvature + inline void set_curvbak ( float to ) ; + inline void set_val ( float to ) ; // scalar data value (file: rh.val, sig2-rh.w) + inline void set_imag_val ( float to ) ; // imaginary part of complex data value + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_tx ( float to ) ; + inline void set_ty ( float to ) ; + inline void set_tz ( float to ) ; // tmp coordinate storage + inline void set_t2x ( float to ) ; + inline void set_t2y ( float to ) ; + inline void set_t2z ( float to ) ; // another tmp coordinate storage + inline void set_targx ( float to ) ; + inline void set_targy ( float to ) ; + inline void set_targz ( float to ) ; // target coordinates + inline void set_pialx ( float to ) ; + inline void set_pialy ( float to ) ; + inline void set_pialz ( float to ) ; // pial surface coordinates + inline void set_whitex ( float to ) ; + inline void set_whitey ( float to ) ; + inline void set_whitez ( float to ) ; // white surface coordinates + inline void set_l4x ( float to ) ; + inline void set_l4y ( float to ) ; + inline void set_l4z ( float to ) ; // layerIV surface coordinates + inline void set_infx ( float to ) ; + inline void set_infy ( float to ) ; + inline void set_infz ( float to ) ; // inflated coordinates + inline void set_fx ( float to ) ; + inline void set_fy ( float to ) ; + inline void set_fz ( float to ) ; // flattened coordinates + inline void set_px ( int to ) ; + inline void set_qx ( int to ) ; + inline void set_py ( int to ) ; + inline void set_qy ( int to ) ; + inline void set_pz ( int to ) ; + inline void set_qz ( int to ) ; // rational coordinates for exact calculations + inline void set_e1x ( float to ) ; + inline void set_e1y ( float to ) ; + inline void set_e1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_e2x ( float to ) ; + inline void set_e2y ( float to ) ; + inline void set_e2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_pe1x ( float to ) ; + inline void set_pe1y ( float to ) ; + inline void set_pe1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_pe2x ( float to ) ; + inline void set_pe2y ( float to ) ; + inline void set_pe2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_nc ( float to ) ; // curr length normal comp + inline void set_val2 ( float to ) ; // complex comp data value (file: sig3-rh.w) + inline void set_valbak ( float to ) ; // scalar data stack + inline void set_val2bak ( float to ) ; // complex comp data stack + inline void set_stat ( float to ) ; // statistic + // + inline void set_undefval ( int to ) ; // [previously dist=0] + inline void set_old_undefval ( int to ) ; // for smooth_val_sparse + inline void set_fixedval ( int to ) ; // [previously val=0] + // + inline void set_fieldsign ( float to ) ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline void set_fsmask ( float to ) ; // significance mask (file: rh.fm) + inline void set_d ( float to ) ; // for distance calculations + inline void set_annotation ( int to ) ; // area label (defunct--now from label file name!) + inline void set_oripflag ( char to ) ; + inline void set_origripflag ( char to ) ; // cuts flags + inline void set_vp ( p_void to ) ; // to store user's information + inline void set_theta ( float to ) ; + inline void set_phi ( float to ) ; // parameterization + inline void set_origarea ( float to ) ; + inline void set_group_avg_area ( float to ) ; + inline void set_K ( float to ) ; // Gaussian curvature + inline void set_H ( float to ) ; // mean curvature + inline void set_k1 ( float to ) ; + inline void set_k2 ( float to ) ; // the principal curvatures + inline void set_mean ( float to ) ; + inline void set_mean_imag ( float to ) ; // imaginary part of complex statistic + inline void set_std_error ( float to ) ; + inline void set_flags ( uint to ) ; + inline void set_fno ( int to ) ; // face that this vertex is in + inline void set_cropped ( int to ) ; + inline void set_marked ( short to ) ; // for a variety of uses + inline void set_marked2 ( short to ) ; + inline void set_marked3 ( short to ) ; + inline void set_neg ( char to ) ; // 1 if the normal vector is inverted + inline void set_border ( char to ) ; // flag + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef Analysis::Face Face; + typedef Analysis::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); inline Surface ( AllM::Surface const & src ); // Fields being maintained by specialist functions - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline Vertex vertices ( size_t i ) const ; - inline Face faces ( size_t i ) const ; - inline float xctr ( ) const ; - inline float yctr ( ) const ; - inline float zctr ( ) const ; - inline float xlo ( ) const ; - inline float ylo ( ) const ; - inline float zlo ( ) const ; - inline float xhi ( ) const ; - inline float yhi ( ) const ; - inline float zhi ( ) const ; - inline float total_area ( ) const ; - inline double avg_vertex_area ( ) const ; - inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist - inline double std_vertex_dist ( ) const ; - inline float neg_area ( ) const ; - inline float neg_orig_area ( ) const ; // amount of original surface in folds - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline STRIP strips ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float x0 ( ) const ; // center of spherical expansion + inline float y0 ( ) const ; + inline float z0 ( ) const ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + // + inline float max_curv ( ) const ; + inline float min_curv ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline int zeros ( ) const ; + inline int hemisphere ( ) const ; // which hemisphere + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline float Hmin ( ) const ; // min mean curvature + inline float Hmax ( ) const ; // max mean curvature + inline float Kmin ( ) const ; // min Gaussian curvature + inline float Kmax ( ) const ; // max Gaussian curvature + inline double Ktotal ( ) const ; // total Gaussian curvature + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int nlabels ( ) const ; + inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) + inline p_void vp ( ) const ; // for misc. use + inline float alpha ( ) const ; // rotation around z-axis + inline float beta ( ) const ; // rotation around y-axis + inline float gamma ( ) const ; // rotation around x-axis + inline float da ( ) const ; + inline float db ( ) const ; + inline float dg ( ) const ; // old deltas + inline int type ( ) const ; // what type of surface was this initially + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; - inline void set_xctr ( float to ) ; - inline void set_yctr ( float to ) ; - inline void set_zctr ( float to ) ; - inline void set_xlo ( float to ) ; - inline void set_ylo ( float to ) ; - inline void set_zlo ( float to ) ; - inline void set_xhi ( float to ) ; - inline void set_yhi ( float to ) ; - inline void set_zhi ( float to ) ; - inline void set_total_area ( float to ) ; - inline void set_avg_vertex_area ( double to ) ; - }; + inline void set_strips ( size_t i, STRIP to ) ; + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_x0 ( float to ) ; // center of spherical expansion + inline void set_y0 ( float to ) ; + inline void set_z0 ( float to ) ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + // + inline void set_max_curv ( float to ) ; + inline void set_min_curv ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + inline void set_zeros ( int to ) ; + inline void set_hemisphere ( int to ) ; // which hemisphere + inline void set_Hmin ( float to ) ; // min mean curvature + inline void set_Hmax ( float to ) ; // max mean curvature + inline void set_Kmin ( float to ) ; // min Gaussian curvature + inline void set_Kmax ( float to ) ; // max Gaussian curvature + inline void set_Ktotal ( double to ) ; // total Gaussian curvature + inline void set_nlabels ( int to ) ; + inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) + inline void set_vp ( p_void to ) ; // for misc. use + inline void set_alpha ( float to ) ; // rotation around z-axis + inline void set_beta ( float to ) ; // rotation around y-axis + inline void set_gamma ( float to ) ; // rotation around x-axis + inline void set_da ( float to ) ; + inline void set_db ( float to ) ; + inline void set_dg ( float to ) ; // old deltas + inline void set_type ( int to ) ; // what type of surface was this initially + }; // Surface } // namespace Analysis diff --git a/include/mrisurf_SurfaceFromMRISPV_generated_AnalysisM.h b/include/mrisurf_SurfaceFromMRISPV_generated_AnalysisM.h index a9898edc6f6..3e360da47ab 100644 --- a/include/mrisurf_SurfaceFromMRISPV_generated_AnalysisM.h +++ b/include/mrisurf_SurfaceFromMRISPV_generated_AnalysisM.h @@ -1,21 +1,32 @@ namespace AnalysisM { struct Face : public Repr_Elt { + typedef AnalysisM::Surface Surface; + typedef AnalysisM::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline float area ( ) const ; - inline angles_per_triangle_t angle ( ) const ; - inline char ripflag ( ) const ; - inline PDMATRIX norm ( ) const ; + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; + inline PDMATRIX norm ( ) const ; + inline A3PDMATRIX gradNorm ( ) const ; - inline void set_ripflag ( char to ) ; - }; + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef AnalysisM::Surface Surface; + typedef AnalysisM::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -24,85 +35,396 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline uchar num ( ) const ; // number of neighboring faces + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces // managed by MRISfreeDists[_orig] and MRISmakeDists[_orig] - inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz - inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements // - inline float x ( ) const ; // current coordinates - inline float y ( ) const ; // use MRISsetXYZ() to set - inline float z ( ) const ; + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; // + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set // - inline float nx ( ) const ; - inline float ny ( ) const ; - inline float nz ( ) const ; // curr normal + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float pnx ( ) const ; + inline float pny ( ) const ; + inline float pnz ( ) const ; // pial normal // + inline float wnx ( ) const ; + inline float wny ( ) const ; + inline float wnz ( ) const ; // white normal + inline float onx ( ) const ; + inline float ony ( ) const ; + inline float onz ( ) const ; // original normal + inline float dx ( ) const ; + inline float dy ( ) const ; + inline float dz ( ) const ; // current change in position + inline float odx ( ) const ; + inline float ody ( ) const ; + inline float odz ( ) const ; // last change of position (for momentum, + inline float tdx ( ) const ; + inline float tdy ( ) const ; + inline float tdz ( ) const ; // temporary storage for averaging gradient + inline float curv ( ) const ; // curr curvature + inline float curvbak ( ) const ; + inline float val ( ) const ; // scalar data value (file: rh.val, sig2-rh.w) + inline float imag_val ( ) const ; // imaginary part of complex data value + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float tx ( ) const ; + inline float ty ( ) const ; + inline float tz ( ) const ; // tmp coordinate storage + inline float t2x ( ) const ; + inline float t2y ( ) const ; + inline float t2z ( ) const ; // another tmp coordinate storage + inline float targx ( ) const ; + inline float targy ( ) const ; + inline float targz ( ) const ; // target coordinates + inline float pialx ( ) const ; + inline float pialy ( ) const ; + inline float pialz ( ) const ; // pial surface coordinates + inline float whitex ( ) const ; + inline float whitey ( ) const ; + inline float whitez ( ) const ; // white surface coordinates + inline float l4x ( ) const ; + inline float l4y ( ) const ; + inline float l4z ( ) const ; // layerIV surface coordinates + inline float infx ( ) const ; + inline float infy ( ) const ; + inline float infz ( ) const ; // inflated coordinates + inline float fx ( ) const ; + inline float fy ( ) const ; + inline float fz ( ) const ; // flattened coordinates + inline int px ( ) const ; + inline int qx ( ) const ; + inline int py ( ) const ; + inline int qy ( ) const ; + inline int pz ( ) const ; + inline int qz ( ) const ; // rational coordinates for exact calculations + inline float e1x ( ) const ; + inline float e1y ( ) const ; + inline float e1z ( ) const ; // 1st basis vector for the local tangent plane + inline float e2x ( ) const ; + inline float e2y ( ) const ; + inline float e2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float pe1x ( ) const ; + inline float pe1y ( ) const ; + inline float pe1z ( ) const ; // 1st basis vector for the local tangent plane + inline float pe2x ( ) const ; + inline float pe2y ( ) const ; + inline float pe2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float nc ( ) const ; // curr length normal comp + inline float val2 ( ) const ; // complex comp data value (file: sig3-rh.w) + inline float valbak ( ) const ; // scalar data stack + inline float val2bak ( ) const ; // complex comp data stack + inline float stat ( ) const ; // statistic // + inline int undefval ( ) const ; // [previously dist=0] + inline int old_undefval ( ) const ; // for smooth_val_sparse + inline int fixedval ( ) const ; // [previously val=0] // - inline float area ( ) const ; - inline float origarea ( ) const ; - inline char neg ( ) const ; // 1 if the normal vector is inverted - inline char border ( ) const ; // flag - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache - inline void which_coords (int which, float *x, float *y, float *z) const ; + inline float fieldsign ( ) const ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline float fsmask ( ) const ; // significance mask (file: rh.fm) + inline float d ( ) const ; // for distance calculations + inline int annotation ( ) const ; // area label (defunct--now from label file name!) + inline char oripflag ( ) const ; + inline char origripflag ( ) const ; // cuts flags + inline p_void vp ( ) const ; // to store user's information + inline float theta ( ) const ; + inline float phi ( ) const ; // parameterization + inline float area ( ) const ; + inline float origarea ( ) const ; + inline float group_avg_area ( ) const ; + inline float K ( ) const ; // Gaussian curvature + inline float H ( ) const ; // mean curvature + inline float k1 ( ) const ; + inline float k2 ( ) const ; // the principal curvatures + inline float mean ( ) const ; + inline float mean_imag ( ) const ; // imaginary part of complex statistic + inline float std_error ( ) const ; + inline uint flags ( ) const ; + inline int fno ( ) const ; // face that this vertex is in + inline int cropped ( ) const ; + inline short marked ( ) const ; // for a variety of uses + inline short marked2 ( ) const ; + inline short marked3 ( ) const ; + inline char neg ( ) const ; // 1 if the normal vector is inverted + inline char border ( ) const ; // flag + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices // + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_pnx ( float to ) ; + inline void set_pny ( float to ) ; + inline void set_pnz ( float to ) ; // pial normal // - inline void set_nx ( float to ) ; - inline void set_ny ( float to ) ; - inline void set_nz ( float to ) ; // curr normal - inline void set_origarea ( float to ) ; - inline void set_neg ( char to ) ; // 1 if the normal vector is inverted - inline void set_border ( char to ) ; // flag - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_wnx ( float to ) ; + inline void set_wny ( float to ) ; + inline void set_wnz ( float to ) ; // white normal + inline void set_onx ( float to ) ; + inline void set_ony ( float to ) ; + inline void set_onz ( float to ) ; // original normal + inline void set_dx ( float to ) ; + inline void set_dy ( float to ) ; + inline void set_dz ( float to ) ; // current change in position + inline void set_odx ( float to ) ; + inline void set_ody ( float to ) ; + inline void set_odz ( float to ) ; // last change of position (for momentum, + inline void set_tdx ( float to ) ; + inline void set_tdy ( float to ) ; + inline void set_tdz ( float to ) ; // temporary storage for averaging gradient + inline void set_curv ( float to ) ; // curr curvature + inline void set_curvbak ( float to ) ; + inline void set_val ( float to ) ; // scalar data value (file: rh.val, sig2-rh.w) + inline void set_imag_val ( float to ) ; // imaginary part of complex data value + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_tx ( float to ) ; + inline void set_ty ( float to ) ; + inline void set_tz ( float to ) ; // tmp coordinate storage + inline void set_t2x ( float to ) ; + inline void set_t2y ( float to ) ; + inline void set_t2z ( float to ) ; // another tmp coordinate storage + inline void set_targx ( float to ) ; + inline void set_targy ( float to ) ; + inline void set_targz ( float to ) ; // target coordinates + inline void set_pialx ( float to ) ; + inline void set_pialy ( float to ) ; + inline void set_pialz ( float to ) ; // pial surface coordinates + inline void set_whitex ( float to ) ; + inline void set_whitey ( float to ) ; + inline void set_whitez ( float to ) ; // white surface coordinates + inline void set_l4x ( float to ) ; + inline void set_l4y ( float to ) ; + inline void set_l4z ( float to ) ; // layerIV surface coordinates + inline void set_infx ( float to ) ; + inline void set_infy ( float to ) ; + inline void set_infz ( float to ) ; // inflated coordinates + inline void set_fx ( float to ) ; + inline void set_fy ( float to ) ; + inline void set_fz ( float to ) ; // flattened coordinates + inline void set_px ( int to ) ; + inline void set_qx ( int to ) ; + inline void set_py ( int to ) ; + inline void set_qy ( int to ) ; + inline void set_pz ( int to ) ; + inline void set_qz ( int to ) ; // rational coordinates for exact calculations + inline void set_e1x ( float to ) ; + inline void set_e1y ( float to ) ; + inline void set_e1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_e2x ( float to ) ; + inline void set_e2y ( float to ) ; + inline void set_e2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_pe1x ( float to ) ; + inline void set_pe1y ( float to ) ; + inline void set_pe1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_pe2x ( float to ) ; + inline void set_pe2y ( float to ) ; + inline void set_pe2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_nc ( float to ) ; // curr length normal comp + inline void set_val2 ( float to ) ; // complex comp data value (file: sig3-rh.w) + inline void set_valbak ( float to ) ; // scalar data stack + inline void set_val2bak ( float to ) ; // complex comp data stack + inline void set_stat ( float to ) ; // statistic + // + inline void set_undefval ( int to ) ; // [previously dist=0] + inline void set_old_undefval ( int to ) ; // for smooth_val_sparse + inline void set_fixedval ( int to ) ; // [previously val=0] + // + inline void set_fieldsign ( float to ) ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline void set_fsmask ( float to ) ; // significance mask (file: rh.fm) + inline void set_d ( float to ) ; // for distance calculations + inline void set_annotation ( int to ) ; // area label (defunct--now from label file name!) + inline void set_oripflag ( char to ) ; + inline void set_origripflag ( char to ) ; // cuts flags + inline void set_vp ( p_void to ) ; // to store user's information + inline void set_theta ( float to ) ; + inline void set_phi ( float to ) ; // parameterization + inline void set_origarea ( float to ) ; + inline void set_group_avg_area ( float to ) ; + inline void set_K ( float to ) ; // Gaussian curvature + inline void set_H ( float to ) ; // mean curvature + inline void set_k1 ( float to ) ; + inline void set_k2 ( float to ) ; // the principal curvatures + inline void set_mean ( float to ) ; + inline void set_mean_imag ( float to ) ; // imaginary part of complex statistic + inline void set_std_error ( float to ) ; + inline void set_flags ( uint to ) ; + inline void set_fno ( int to ) ; // face that this vertex is in + inline void set_cropped ( int to ) ; + inline void set_marked ( short to ) ; // for a variety of uses + inline void set_marked2 ( short to ) ; + inline void set_marked3 ( short to ) ; + inline void set_neg ( char to ) ; // 1 if the normal vector is inverted + inline void set_border ( char to ) ; // flag + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef AnalysisM::Face Face; + typedef AnalysisM::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); inline Surface ( AllM::Surface const & src ); // Fields being maintained by specialist functions - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline Vertex vertices ( size_t i ) const ; - inline Face faces ( size_t i ) const ; - inline float xctr ( ) const ; - inline float yctr ( ) const ; - inline float zctr ( ) const ; - inline float xlo ( ) const ; - inline float ylo ( ) const ; - inline float zlo ( ) const ; - inline float xhi ( ) const ; - inline float yhi ( ) const ; - inline float zhi ( ) const ; - inline float total_area ( ) const ; - inline double avg_vertex_area ( ) const ; - inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist - inline double std_vertex_dist ( ) const ; - inline float neg_area ( ) const ; - inline float neg_orig_area ( ) const ; // amount of original surface in folds - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline STRIP strips ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float x0 ( ) const ; // center of spherical expansion + inline float y0 ( ) const ; + inline float z0 ( ) const ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + // + inline float max_curv ( ) const ; + inline float min_curv ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline int zeros ( ) const ; + inline int hemisphere ( ) const ; // which hemisphere + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline float Hmin ( ) const ; // min mean curvature + inline float Hmax ( ) const ; // max mean curvature + inline float Kmin ( ) const ; // min Gaussian curvature + inline float Kmax ( ) const ; // max Gaussian curvature + inline double Ktotal ( ) const ; // total Gaussian curvature + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int nlabels ( ) const ; + inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) + inline p_void vp ( ) const ; // for misc. use + inline float alpha ( ) const ; // rotation around z-axis + inline float beta ( ) const ; // rotation around y-axis + inline float gamma ( ) const ; // rotation around x-axis + inline float da ( ) const ; + inline float db ( ) const ; + inline float dg ( ) const ; // old deltas + inline int type ( ) const ; // what type of surface was this initially + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; - inline void set_xctr ( float to ) ; - inline void set_yctr ( float to ) ; - inline void set_zctr ( float to ) ; - inline void set_xlo ( float to ) ; - inline void set_ylo ( float to ) ; - inline void set_zlo ( float to ) ; - inline void set_xhi ( float to ) ; - inline void set_yhi ( float to ) ; - inline void set_zhi ( float to ) ; - inline void set_total_area ( float to ) ; - inline void set_avg_vertex_area ( double to ) ; - }; + inline void set_strips ( size_t i, STRIP to ) ; + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_x0 ( float to ) ; // center of spherical expansion + inline void set_y0 ( float to ) ; + inline void set_z0 ( float to ) ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + // + inline void set_max_curv ( float to ) ; + inline void set_min_curv ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + inline void set_zeros ( int to ) ; + inline void set_hemisphere ( int to ) ; // which hemisphere + inline void set_Hmin ( float to ) ; // min mean curvature + inline void set_Hmax ( float to ) ; // max mean curvature + inline void set_Kmin ( float to ) ; // min Gaussian curvature + inline void set_Kmax ( float to ) ; // max Gaussian curvature + inline void set_Ktotal ( double to ) ; // total Gaussian curvature + inline void set_nlabels ( int to ) ; + inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) + inline void set_vp ( p_void to ) ; // for misc. use + inline void set_alpha ( float to ) ; // rotation around z-axis + inline void set_beta ( float to ) ; // rotation around y-axis + inline void set_gamma ( float to ) ; // rotation around x-axis + inline void set_da ( float to ) ; + inline void set_db ( float to ) ; + inline void set_dg ( float to ) ; // old deltas + inline void set_type ( int to ) ; // what type of surface was this initially + }; // Surface } // namespace AnalysisM diff --git a/include/mrisurf_SurfaceFromMRISPV_generated_Distort.h b/include/mrisurf_SurfaceFromMRISPV_generated_Distort.h index db82feb642a..6ce0a7d44ab 100644 --- a/include/mrisurf_SurfaceFromMRISPV_generated_Distort.h +++ b/include/mrisurf_SurfaceFromMRISPV_generated_Distort.h @@ -1,5 +1,7 @@ namespace Distort { struct Face : public Repr_Elt { + typedef Distort::Surface Surface; + typedef Distort::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); @@ -8,16 +10,25 @@ inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline float area ( ) const ; - inline angles_per_triangle_t angle ( ) const ; - inline char ripflag ( ) const ; - inline PDMATRIX norm ( ) const ; + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; + inline PDMATRIX norm ( ) const ; + inline A3PDMATRIX gradNorm ( ) const ; - inline void set_ripflag ( char to ) ; - }; + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef Distort::Surface Surface; + typedef Distort::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -28,45 +39,262 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline uchar num ( ) const ; // number of neighboring faces + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces // managed by MRISfreeDists[_orig] and MRISmakeDists[_orig] - inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz - inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements // - inline float x ( ) const ; // current coordinates - inline float y ( ) const ; // use MRISsetXYZ() to set - inline float z ( ) const ; + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; // + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set // - inline float nx ( ) const ; - inline float ny ( ) const ; - inline float nz ( ) const ; // curr normal + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float pnx ( ) const ; + inline float pny ( ) const ; + inline float pnz ( ) const ; // pial normal // + inline float wnx ( ) const ; + inline float wny ( ) const ; + inline float wnz ( ) const ; // white normal + inline float onx ( ) const ; + inline float ony ( ) const ; + inline float onz ( ) const ; // original normal + inline float dx ( ) const ; + inline float dy ( ) const ; + inline float dz ( ) const ; // current change in position + inline float odx ( ) const ; + inline float ody ( ) const ; + inline float odz ( ) const ; // last change of position (for momentum, + inline float tdx ( ) const ; + inline float tdy ( ) const ; + inline float tdz ( ) const ; // temporary storage for averaging gradient + inline float curv ( ) const ; // curr curvature + inline float curvbak ( ) const ; + inline float val ( ) const ; // scalar data value (file: rh.val, sig2-rh.w) + inline float imag_val ( ) const ; // imaginary part of complex data value + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float tx ( ) const ; + inline float ty ( ) const ; + inline float tz ( ) const ; // tmp coordinate storage + inline float t2x ( ) const ; + inline float t2y ( ) const ; + inline float t2z ( ) const ; // another tmp coordinate storage + inline float targx ( ) const ; + inline float targy ( ) const ; + inline float targz ( ) const ; // target coordinates + inline float pialx ( ) const ; + inline float pialy ( ) const ; + inline float pialz ( ) const ; // pial surface coordinates + inline float whitex ( ) const ; + inline float whitey ( ) const ; + inline float whitez ( ) const ; // white surface coordinates + inline float l4x ( ) const ; + inline float l4y ( ) const ; + inline float l4z ( ) const ; // layerIV surface coordinates + inline float infx ( ) const ; + inline float infy ( ) const ; + inline float infz ( ) const ; // inflated coordinates + inline float fx ( ) const ; + inline float fy ( ) const ; + inline float fz ( ) const ; // flattened coordinates + inline int px ( ) const ; + inline int qx ( ) const ; + inline int py ( ) const ; + inline int qy ( ) const ; + inline int pz ( ) const ; + inline int qz ( ) const ; // rational coordinates for exact calculations + inline float e1x ( ) const ; + inline float e1y ( ) const ; + inline float e1z ( ) const ; // 1st basis vector for the local tangent plane + inline float e2x ( ) const ; + inline float e2y ( ) const ; + inline float e2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float pe1x ( ) const ; + inline float pe1y ( ) const ; + inline float pe1z ( ) const ; // 1st basis vector for the local tangent plane + inline float pe2x ( ) const ; + inline float pe2y ( ) const ; + inline float pe2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float nc ( ) const ; // curr length normal comp + inline float val2 ( ) const ; // complex comp data value (file: sig3-rh.w) + inline float valbak ( ) const ; // scalar data stack + inline float val2bak ( ) const ; // complex comp data stack + inline float stat ( ) const ; // statistic // + inline int undefval ( ) const ; // [previously dist=0] + inline int old_undefval ( ) const ; // for smooth_val_sparse + inline int fixedval ( ) const ; // [previously val=0] // - inline float area ( ) const ; - inline float origarea ( ) const ; - inline char neg ( ) const ; // 1 if the normal vector is inverted - inline char border ( ) const ; // flag - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache - inline void which_coords (int which, float *x, float *y, float *z) const ; + inline float fieldsign ( ) const ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline float fsmask ( ) const ; // significance mask (file: rh.fm) + inline float d ( ) const ; // for distance calculations + inline int annotation ( ) const ; // area label (defunct--now from label file name!) + inline char oripflag ( ) const ; + inline char origripflag ( ) const ; // cuts flags + inline p_void vp ( ) const ; // to store user's information + inline float theta ( ) const ; + inline float phi ( ) const ; // parameterization + inline float area ( ) const ; + inline float origarea ( ) const ; + inline float group_avg_area ( ) const ; + inline float K ( ) const ; // Gaussian curvature + inline float H ( ) const ; // mean curvature + inline float k1 ( ) const ; + inline float k2 ( ) const ; // the principal curvatures + inline float mean ( ) const ; + inline float mean_imag ( ) const ; // imaginary part of complex statistic + inline float std_error ( ) const ; + inline uint flags ( ) const ; + inline int fno ( ) const ; // face that this vertex is in + inline int cropped ( ) const ; + inline short marked ( ) const ; // for a variety of uses + inline short marked2 ( ) const ; + inline short marked3 ( ) const ; + inline char neg ( ) const ; // 1 if the normal vector is inverted + inline char border ( ) const ; // flag + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices // + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_pnx ( float to ) ; + inline void set_pny ( float to ) ; + inline void set_pnz ( float to ) ; // pial normal // - inline void set_nx ( float to ) ; - inline void set_ny ( float to ) ; - inline void set_nz ( float to ) ; // curr normal - inline void set_origarea ( float to ) ; - inline void set_neg ( char to ) ; // 1 if the normal vector is inverted - inline void set_border ( char to ) ; // flag - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_wnx ( float to ) ; + inline void set_wny ( float to ) ; + inline void set_wnz ( float to ) ; // white normal + inline void set_onx ( float to ) ; + inline void set_ony ( float to ) ; + inline void set_onz ( float to ) ; // original normal + inline void set_dx ( float to ) ; + inline void set_dy ( float to ) ; + inline void set_dz ( float to ) ; // current change in position + inline void set_odx ( float to ) ; + inline void set_ody ( float to ) ; + inline void set_odz ( float to ) ; // last change of position (for momentum, + inline void set_tdx ( float to ) ; + inline void set_tdy ( float to ) ; + inline void set_tdz ( float to ) ; // temporary storage for averaging gradient + inline void set_curv ( float to ) ; // curr curvature + inline void set_curvbak ( float to ) ; + inline void set_val ( float to ) ; // scalar data value (file: rh.val, sig2-rh.w) + inline void set_imag_val ( float to ) ; // imaginary part of complex data value + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_tx ( float to ) ; + inline void set_ty ( float to ) ; + inline void set_tz ( float to ) ; // tmp coordinate storage + inline void set_t2x ( float to ) ; + inline void set_t2y ( float to ) ; + inline void set_t2z ( float to ) ; // another tmp coordinate storage + inline void set_targx ( float to ) ; + inline void set_targy ( float to ) ; + inline void set_targz ( float to ) ; // target coordinates + inline void set_pialx ( float to ) ; + inline void set_pialy ( float to ) ; + inline void set_pialz ( float to ) ; // pial surface coordinates + inline void set_whitex ( float to ) ; + inline void set_whitey ( float to ) ; + inline void set_whitez ( float to ) ; // white surface coordinates + inline void set_l4x ( float to ) ; + inline void set_l4y ( float to ) ; + inline void set_l4z ( float to ) ; // layerIV surface coordinates + inline void set_infx ( float to ) ; + inline void set_infy ( float to ) ; + inline void set_infz ( float to ) ; // inflated coordinates + inline void set_fx ( float to ) ; + inline void set_fy ( float to ) ; + inline void set_fz ( float to ) ; // flattened coordinates + inline void set_px ( int to ) ; + inline void set_qx ( int to ) ; + inline void set_py ( int to ) ; + inline void set_qy ( int to ) ; + inline void set_pz ( int to ) ; + inline void set_qz ( int to ) ; // rational coordinates for exact calculations + inline void set_e1x ( float to ) ; + inline void set_e1y ( float to ) ; + inline void set_e1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_e2x ( float to ) ; + inline void set_e2y ( float to ) ; + inline void set_e2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_pe1x ( float to ) ; + inline void set_pe1y ( float to ) ; + inline void set_pe1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_pe2x ( float to ) ; + inline void set_pe2y ( float to ) ; + inline void set_pe2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_nc ( float to ) ; // curr length normal comp + inline void set_val2 ( float to ) ; // complex comp data value (file: sig3-rh.w) + inline void set_valbak ( float to ) ; // scalar data stack + inline void set_val2bak ( float to ) ; // complex comp data stack + inline void set_stat ( float to ) ; // statistic + // + inline void set_undefval ( int to ) ; // [previously dist=0] + inline void set_old_undefval ( int to ) ; // for smooth_val_sparse + inline void set_fixedval ( int to ) ; // [previously val=0] + // + inline void set_fieldsign ( float to ) ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline void set_fsmask ( float to ) ; // significance mask (file: rh.fm) + inline void set_d ( float to ) ; // for distance calculations + inline void set_annotation ( int to ) ; // area label (defunct--now from label file name!) + inline void set_oripflag ( char to ) ; + inline void set_origripflag ( char to ) ; // cuts flags + inline void set_vp ( p_void to ) ; // to store user's information + inline void set_theta ( float to ) ; + inline void set_phi ( float to ) ; // parameterization + inline void set_origarea ( float to ) ; + inline void set_group_avg_area ( float to ) ; + inline void set_K ( float to ) ; // Gaussian curvature + inline void set_H ( float to ) ; // mean curvature + inline void set_k1 ( float to ) ; + inline void set_k2 ( float to ) ; // the principal curvatures + inline void set_mean ( float to ) ; + inline void set_mean_imag ( float to ) ; // imaginary part of complex statistic + inline void set_std_error ( float to ) ; + inline void set_flags ( uint to ) ; + inline void set_fno ( int to ) ; // face that this vertex is in + inline void set_cropped ( int to ) ; + inline void set_marked ( short to ) ; // for a variety of uses + inline void set_marked2 ( short to ) ; + inline void set_marked3 ( short to ) ; + inline void set_neg ( char to ) ; // 1 if the normal vector is inverted + inline void set_border ( char to ) ; // flag + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef Distort::Face Face; + typedef Distort::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); @@ -75,40 +303,134 @@ inline Surface ( AllM::Surface const & src ); // Fields being maintained by specialist functions - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline Vertex vertices ( size_t i ) const ; - inline Face faces ( size_t i ) const ; - inline float xctr ( ) const ; - inline float yctr ( ) const ; - inline float zctr ( ) const ; - inline float xlo ( ) const ; - inline float ylo ( ) const ; - inline float zlo ( ) const ; - inline float xhi ( ) const ; - inline float yhi ( ) const ; - inline float zhi ( ) const ; - inline float total_area ( ) const ; - inline double avg_vertex_area ( ) const ; - inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist - inline double std_vertex_dist ( ) const ; - inline float neg_area ( ) const ; - inline float neg_orig_area ( ) const ; // amount of original surface in folds - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline STRIP strips ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float x0 ( ) const ; // center of spherical expansion + inline float y0 ( ) const ; + inline float z0 ( ) const ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + // + inline float max_curv ( ) const ; + inline float min_curv ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline int zeros ( ) const ; + inline int hemisphere ( ) const ; // which hemisphere + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline float Hmin ( ) const ; // min mean curvature + inline float Hmax ( ) const ; // max mean curvature + inline float Kmin ( ) const ; // min Gaussian curvature + inline float Kmax ( ) const ; // max Gaussian curvature + inline double Ktotal ( ) const ; // total Gaussian curvature + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int nlabels ( ) const ; + inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) + inline p_void vp ( ) const ; // for misc. use + inline float alpha ( ) const ; // rotation around z-axis + inline float beta ( ) const ; // rotation around y-axis + inline float gamma ( ) const ; // rotation around x-axis + inline float da ( ) const ; + inline float db ( ) const ; + inline float dg ( ) const ; // old deltas + inline int type ( ) const ; // what type of surface was this initially + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; - inline void set_xctr ( float to ) ; - inline void set_yctr ( float to ) ; - inline void set_zctr ( float to ) ; - inline void set_xlo ( float to ) ; - inline void set_ylo ( float to ) ; - inline void set_zlo ( float to ) ; - inline void set_xhi ( float to ) ; - inline void set_yhi ( float to ) ; - inline void set_zhi ( float to ) ; - inline void set_total_area ( float to ) ; - inline void set_avg_vertex_area ( double to ) ; - }; + inline void set_strips ( size_t i, STRIP to ) ; + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_x0 ( float to ) ; // center of spherical expansion + inline void set_y0 ( float to ) ; + inline void set_z0 ( float to ) ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + // + inline void set_max_curv ( float to ) ; + inline void set_min_curv ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + inline void set_zeros ( int to ) ; + inline void set_hemisphere ( int to ) ; // which hemisphere + inline void set_Hmin ( float to ) ; // min mean curvature + inline void set_Hmax ( float to ) ; // max mean curvature + inline void set_Kmin ( float to ) ; // min Gaussian curvature + inline void set_Kmax ( float to ) ; // max Gaussian curvature + inline void set_Ktotal ( double to ) ; // total Gaussian curvature + inline void set_nlabels ( int to ) ; + inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) + inline void set_vp ( p_void to ) ; // for misc. use + inline void set_alpha ( float to ) ; // rotation around z-axis + inline void set_beta ( float to ) ; // rotation around y-axis + inline void set_gamma ( float to ) ; // rotation around x-axis + inline void set_da ( float to ) ; + inline void set_db ( float to ) ; + inline void set_dg ( float to ) ; // old deltas + inline void set_type ( int to ) ; // what type of surface was this initially + }; // Surface } // namespace Distort diff --git a/include/mrisurf_SurfaceFromMRISPV_generated_DistortM.h b/include/mrisurf_SurfaceFromMRISPV_generated_DistortM.h index db9fc946f37..e23ac5a6adc 100644 --- a/include/mrisurf_SurfaceFromMRISPV_generated_DistortM.h +++ b/include/mrisurf_SurfaceFromMRISPV_generated_DistortM.h @@ -1,21 +1,32 @@ namespace DistortM { struct Face : public Repr_Elt { + typedef DistortM::Surface Surface; + typedef DistortM::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline float area ( ) const ; - inline angles_per_triangle_t angle ( ) const ; - inline char ripflag ( ) const ; - inline PDMATRIX norm ( ) const ; + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; + inline PDMATRIX norm ( ) const ; + inline A3PDMATRIX gradNorm ( ) const ; - inline void set_ripflag ( char to ) ; - }; + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef DistortM::Surface Surface; + typedef DistortM::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -24,85 +35,397 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline uchar num ( ) const ; // number of neighboring faces + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces // managed by MRISfreeDists[_orig] and MRISmakeDists[_orig] - inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz - inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements // - inline float x ( ) const ; // current coordinates - inline float y ( ) const ; // use MRISsetXYZ() to set - inline float z ( ) const ; + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; // + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set // - inline float nx ( ) const ; - inline float ny ( ) const ; - inline float nz ( ) const ; // curr normal + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float pnx ( ) const ; + inline float pny ( ) const ; + inline float pnz ( ) const ; // pial normal // + inline float wnx ( ) const ; + inline float wny ( ) const ; + inline float wnz ( ) const ; // white normal + inline float onx ( ) const ; + inline float ony ( ) const ; + inline float onz ( ) const ; // original normal + inline float dx ( ) const ; + inline float dy ( ) const ; + inline float dz ( ) const ; // current change in position + inline float odx ( ) const ; + inline float ody ( ) const ; + inline float odz ( ) const ; // last change of position (for momentum, + inline float tdx ( ) const ; + inline float tdy ( ) const ; + inline float tdz ( ) const ; // temporary storage for averaging gradient + inline float curv ( ) const ; // curr curvature + inline float curvbak ( ) const ; + inline float val ( ) const ; // scalar data value (file: rh.val, sig2-rh.w) + inline float imag_val ( ) const ; // imaginary part of complex data value + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float tx ( ) const ; + inline float ty ( ) const ; + inline float tz ( ) const ; // tmp coordinate storage + inline float t2x ( ) const ; + inline float t2y ( ) const ; + inline float t2z ( ) const ; // another tmp coordinate storage + inline float targx ( ) const ; + inline float targy ( ) const ; + inline float targz ( ) const ; // target coordinates + inline float pialx ( ) const ; + inline float pialy ( ) const ; + inline float pialz ( ) const ; // pial surface coordinates + inline float whitex ( ) const ; + inline float whitey ( ) const ; + inline float whitez ( ) const ; // white surface coordinates + inline float l4x ( ) const ; + inline float l4y ( ) const ; + inline float l4z ( ) const ; // layerIV surface coordinates + inline float infx ( ) const ; + inline float infy ( ) const ; + inline float infz ( ) const ; // inflated coordinates + inline float fx ( ) const ; + inline float fy ( ) const ; + inline float fz ( ) const ; // flattened coordinates + inline int px ( ) const ; + inline int qx ( ) const ; + inline int py ( ) const ; + inline int qy ( ) const ; + inline int pz ( ) const ; + inline int qz ( ) const ; // rational coordinates for exact calculations + inline float e1x ( ) const ; + inline float e1y ( ) const ; + inline float e1z ( ) const ; // 1st basis vector for the local tangent plane + inline float e2x ( ) const ; + inline float e2y ( ) const ; + inline float e2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float pe1x ( ) const ; + inline float pe1y ( ) const ; + inline float pe1z ( ) const ; // 1st basis vector for the local tangent plane + inline float pe2x ( ) const ; + inline float pe2y ( ) const ; + inline float pe2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float nc ( ) const ; // curr length normal comp + inline float val2 ( ) const ; // complex comp data value (file: sig3-rh.w) + inline float valbak ( ) const ; // scalar data stack + inline float val2bak ( ) const ; // complex comp data stack + inline float stat ( ) const ; // statistic // + inline int undefval ( ) const ; // [previously dist=0] + inline int old_undefval ( ) const ; // for smooth_val_sparse + inline int fixedval ( ) const ; // [previously val=0] // - inline float area ( ) const ; - inline float origarea ( ) const ; - inline char neg ( ) const ; // 1 if the normal vector is inverted - inline char border ( ) const ; // flag - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache - inline void which_coords (int which, float *x, float *y, float *z) const ; + inline float fieldsign ( ) const ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline float fsmask ( ) const ; // significance mask (file: rh.fm) + inline float d ( ) const ; // for distance calculations + inline int annotation ( ) const ; // area label (defunct--now from label file name!) + inline char oripflag ( ) const ; + inline char origripflag ( ) const ; // cuts flags + inline p_void vp ( ) const ; // to store user's information + inline float theta ( ) const ; + inline float phi ( ) const ; // parameterization + inline float area ( ) const ; + inline float origarea ( ) const ; + inline float group_avg_area ( ) const ; + inline float K ( ) const ; // Gaussian curvature + inline float H ( ) const ; // mean curvature + inline float k1 ( ) const ; + inline float k2 ( ) const ; // the principal curvatures + inline float mean ( ) const ; + inline float mean_imag ( ) const ; // imaginary part of complex statistic + inline float std_error ( ) const ; + inline uint flags ( ) const ; + inline int fno ( ) const ; // face that this vertex is in + inline int cropped ( ) const ; + inline short marked ( ) const ; // for a variety of uses + inline short marked2 ( ) const ; + inline short marked3 ( ) const ; + inline char neg ( ) const ; // 1 if the normal vector is inverted + inline char border ( ) const ; // flag + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices // + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_pnx ( float to ) ; + inline void set_pny ( float to ) ; + inline void set_pnz ( float to ) ; // pial normal // - inline void set_nx ( float to ) ; - inline void set_ny ( float to ) ; - inline void set_nz ( float to ) ; // curr normal - inline void set_origarea ( float to ) ; - inline void set_neg ( char to ) ; // 1 if the normal vector is inverted - inline void set_border ( char to ) ; // flag - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_wnx ( float to ) ; + inline void set_wny ( float to ) ; + inline void set_wnz ( float to ) ; // white normal + inline void set_onx ( float to ) ; + inline void set_ony ( float to ) ; + inline void set_onz ( float to ) ; // original normal + inline void set_dx ( float to ) ; + inline void set_dy ( float to ) ; + inline void set_dz ( float to ) ; // current change in position + inline void set_odx ( float to ) ; + inline void set_ody ( float to ) ; + inline void set_odz ( float to ) ; // last change of position (for momentum, + inline void set_tdx ( float to ) ; + inline void set_tdy ( float to ) ; + inline void set_tdz ( float to ) ; // temporary storage for averaging gradient + inline void set_curv ( float to ) ; // curr curvature + inline void set_curvbak ( float to ) ; + inline void set_val ( float to ) ; // scalar data value (file: rh.val, sig2-rh.w) + inline void set_imag_val ( float to ) ; // imaginary part of complex data value + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_tx ( float to ) ; + inline void set_ty ( float to ) ; + inline void set_tz ( float to ) ; // tmp coordinate storage + inline void set_t2x ( float to ) ; + inline void set_t2y ( float to ) ; + inline void set_t2z ( float to ) ; // another tmp coordinate storage + inline void set_targx ( float to ) ; + inline void set_targy ( float to ) ; + inline void set_targz ( float to ) ; // target coordinates + inline void set_pialx ( float to ) ; + inline void set_pialy ( float to ) ; + inline void set_pialz ( float to ) ; // pial surface coordinates + inline void set_whitex ( float to ) ; + inline void set_whitey ( float to ) ; + inline void set_whitez ( float to ) ; // white surface coordinates + inline void set_l4x ( float to ) ; + inline void set_l4y ( float to ) ; + inline void set_l4z ( float to ) ; // layerIV surface coordinates + inline void set_infx ( float to ) ; + inline void set_infy ( float to ) ; + inline void set_infz ( float to ) ; // inflated coordinates + inline void set_fx ( float to ) ; + inline void set_fy ( float to ) ; + inline void set_fz ( float to ) ; // flattened coordinates + inline void set_px ( int to ) ; + inline void set_qx ( int to ) ; + inline void set_py ( int to ) ; + inline void set_qy ( int to ) ; + inline void set_pz ( int to ) ; + inline void set_qz ( int to ) ; // rational coordinates for exact calculations + inline void set_e1x ( float to ) ; + inline void set_e1y ( float to ) ; + inline void set_e1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_e2x ( float to ) ; + inline void set_e2y ( float to ) ; + inline void set_e2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_pe1x ( float to ) ; + inline void set_pe1y ( float to ) ; + inline void set_pe1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_pe2x ( float to ) ; + inline void set_pe2y ( float to ) ; + inline void set_pe2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_nc ( float to ) ; // curr length normal comp + inline void set_val2 ( float to ) ; // complex comp data value (file: sig3-rh.w) + inline void set_valbak ( float to ) ; // scalar data stack + inline void set_val2bak ( float to ) ; // complex comp data stack + inline void set_stat ( float to ) ; // statistic + // + inline void set_undefval ( int to ) ; // [previously dist=0] + inline void set_old_undefval ( int to ) ; // for smooth_val_sparse + inline void set_fixedval ( int to ) ; // [previously val=0] + // + inline void set_fieldsign ( float to ) ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline void set_fsmask ( float to ) ; // significance mask (file: rh.fm) + inline void set_d ( float to ) ; // for distance calculations + inline void set_annotation ( int to ) ; // area label (defunct--now from label file name!) + inline void set_oripflag ( char to ) ; + inline void set_origripflag ( char to ) ; // cuts flags + inline void set_vp ( p_void to ) ; // to store user's information + inline void set_theta ( float to ) ; + inline void set_phi ( float to ) ; // parameterization + inline void set_origarea ( float to ) ; + inline void set_group_avg_area ( float to ) ; + inline void set_K ( float to ) ; // Gaussian curvature + inline void set_H ( float to ) ; // mean curvature + inline void set_k1 ( float to ) ; + inline void set_k2 ( float to ) ; // the principal curvatures + inline void set_mean ( float to ) ; + inline void set_mean_imag ( float to ) ; // imaginary part of complex statistic + inline void set_std_error ( float to ) ; + inline void set_flags ( uint to ) ; + inline void set_fno ( int to ) ; // face that this vertex is in + inline void set_cropped ( int to ) ; + inline void set_marked ( short to ) ; // for a variety of uses + inline void set_marked2 ( short to ) ; + inline void set_marked3 ( short to ) ; + inline void set_neg ( char to ) ; // 1 if the normal vector is inverted + inline void set_border ( char to ) ; // flag + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { - inline Surface ( ); - inline Surface ( Surface const & src ); - inline Surface ( Representation* representation ); - inline Surface ( AllM::Surface const & src ); + typedef DistortM::Face Face; + typedef DistortM::Vertex Vertex; + inline Surface ( ); + inline Surface ( Surface const & src ); + inline Surface ( Representation* representation ); + inline Surface ( AllM::Surface const & src ); + void freeDistsButNotOrig() { MRISfreeDistsButNotOrig(repr); } // Fields being maintained by specialist functions - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline Vertex vertices ( size_t i ) const ; - inline Face faces ( size_t i ) const ; - inline float xctr ( ) const ; - inline float yctr ( ) const ; - inline float zctr ( ) const ; - inline float xlo ( ) const ; - inline float ylo ( ) const ; - inline float zlo ( ) const ; - inline float xhi ( ) const ; - inline float yhi ( ) const ; - inline float zhi ( ) const ; - inline float total_area ( ) const ; - inline double avg_vertex_area ( ) const ; - inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist - inline double std_vertex_dist ( ) const ; - inline float neg_area ( ) const ; - inline float neg_orig_area ( ) const ; // amount of original surface in folds - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline STRIP strips ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float x0 ( ) const ; // center of spherical expansion + inline float y0 ( ) const ; + inline float z0 ( ) const ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + // + inline float max_curv ( ) const ; + inline float min_curv ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline int zeros ( ) const ; + inline int hemisphere ( ) const ; // which hemisphere + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline float Hmin ( ) const ; // min mean curvature + inline float Hmax ( ) const ; // max mean curvature + inline float Kmin ( ) const ; // min Gaussian curvature + inline float Kmax ( ) const ; // max Gaussian curvature + inline double Ktotal ( ) const ; // total Gaussian curvature + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int nlabels ( ) const ; + inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) + inline p_void vp ( ) const ; // for misc. use + inline float alpha ( ) const ; // rotation around z-axis + inline float beta ( ) const ; // rotation around y-axis + inline float gamma ( ) const ; // rotation around x-axis + inline float da ( ) const ; + inline float db ( ) const ; + inline float dg ( ) const ; // old deltas + inline int type ( ) const ; // what type of surface was this initially + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; - inline void set_xctr ( float to ) ; - inline void set_yctr ( float to ) ; - inline void set_zctr ( float to ) ; - inline void set_xlo ( float to ) ; - inline void set_ylo ( float to ) ; - inline void set_zlo ( float to ) ; - inline void set_xhi ( float to ) ; - inline void set_yhi ( float to ) ; - inline void set_zhi ( float to ) ; - inline void set_total_area ( float to ) ; - inline void set_avg_vertex_area ( double to ) ; - }; + inline void set_strips ( size_t i, STRIP to ) ; + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_x0 ( float to ) ; // center of spherical expansion + inline void set_y0 ( float to ) ; + inline void set_z0 ( float to ) ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + // + inline void set_max_curv ( float to ) ; + inline void set_min_curv ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + inline void set_zeros ( int to ) ; + inline void set_hemisphere ( int to ) ; // which hemisphere + inline void set_Hmin ( float to ) ; // min mean curvature + inline void set_Hmax ( float to ) ; // max mean curvature + inline void set_Kmin ( float to ) ; // min Gaussian curvature + inline void set_Kmax ( float to ) ; // max Gaussian curvature + inline void set_Ktotal ( double to ) ; // total Gaussian curvature + inline void set_nlabels ( int to ) ; + inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) + inline void set_vp ( p_void to ) ; // for misc. use + inline void set_alpha ( float to ) ; // rotation around z-axis + inline void set_beta ( float to ) ; // rotation around y-axis + inline void set_gamma ( float to ) ; // rotation around x-axis + inline void set_da ( float to ) ; + inline void set_db ( float to ) ; + inline void set_dg ( float to ) ; // old deltas + inline void set_type ( int to ) ; // what type of surface was this initially + }; // Surface } // namespace DistortM diff --git a/include/mrisurf_SurfaceFromMRISPV_generated_Existence.h b/include/mrisurf_SurfaceFromMRISPV_generated_Existence.h index 8be8fd2c4cb..ac183f076d8 100644 --- a/include/mrisurf_SurfaceFromMRISPV_generated_Existence.h +++ b/include/mrisurf_SurfaceFromMRISPV_generated_Existence.h @@ -1,5 +1,7 @@ namespace Existence { struct Face : public Repr_Elt { + typedef Existence::Surface Surface; + typedef Existence::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); @@ -16,12 +18,18 @@ inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline char ripflag ( ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; - inline void set_ripflag ( char to ) ; - }; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef Existence::Surface Surface; + typedef Existence::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -38,13 +46,15 @@ inline Vertex ( AllM::Vertex const & src ); int vno () const { return idx; } - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache inline void which_coords (int which, float *x, float *y, float *z) const ; - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef Existence::Face Face; + typedef Existence::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); @@ -60,9 +70,40 @@ inline Surface ( Analysis::Surface const & src ); inline Surface ( AllM::Surface const & src ); - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - }; + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; + }; // Surface } // namespace Existence diff --git a/include/mrisurf_SurfaceFromMRISPV_generated_ExistenceM.h b/include/mrisurf_SurfaceFromMRISPV_generated_ExistenceM.h index 4204190ccd5..85e2528e9cb 100644 --- a/include/mrisurf_SurfaceFromMRISPV_generated_ExistenceM.h +++ b/include/mrisurf_SurfaceFromMRISPV_generated_ExistenceM.h @@ -1,41 +1,84 @@ namespace ExistenceM { struct Face : public Repr_Elt { + typedef ExistenceM::Surface Surface; + typedef ExistenceM::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline char ripflag ( ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; - inline void set_ripflag ( char to ) ; - }; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef ExistenceM::Surface Surface; + typedef ExistenceM::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); inline Vertex ( AllM::Vertex const & src ); int vno () const { return idx; } - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache inline void which_coords (int which, float *x, float *y, float *z) const ; - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef ExistenceM::Face Face; + typedef ExistenceM::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); inline Surface ( AllM::Surface const & src ); - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; - inline void set_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) - inline void set_origxyz_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - }; + inline void set_fname ( MRIS_fname_t to ) ; // file it was originally loaded from + inline void set_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) + inline void set_origxyz_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline void set_patch ( int to ) ; // if a patch of the surface + }; // Surface } // namespace ExistenceM diff --git a/include/mrisurf_SurfaceFromMRISPV_generated_Topology.h b/include/mrisurf_SurfaceFromMRISPV_generated_Topology.h index 905688e4335..faeac330e67 100644 --- a/include/mrisurf_SurfaceFromMRISPV_generated_Topology.h +++ b/include/mrisurf_SurfaceFromMRISPV_generated_Topology.h @@ -1,5 +1,7 @@ namespace Topology { struct Face : public Repr_Elt { + typedef Topology::Surface Surface; + typedef Topology::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); @@ -14,13 +16,19 @@ inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline char ripflag ( ) const ; + inline Vertex v ( size_t i ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; - inline void set_ripflag ( char to ) ; - }; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef Topology::Surface Surface; + typedef Topology::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -37,18 +45,32 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline uchar num ( ) const ; // number of neighboring faces - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache - inline void which_coords (int which, float *x, float *y, float *z) const ; + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef Topology::Face Face; + typedef Topology::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); @@ -63,13 +85,56 @@ inline Surface ( AllM::Surface const & src ); // Fields being maintained by specialist functions - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline Vertex vertices ( size_t i ) const ; - inline Face faces ( size_t i ) const ; - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - }; + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; + }; // Surface } // namespace Topology diff --git a/include/mrisurf_SurfaceFromMRISPV_generated_TopologyM.h b/include/mrisurf_SurfaceFromMRISPV_generated_TopologyM.h index 4c21ac2767b..716bf16f83c 100644 --- a/include/mrisurf_SurfaceFromMRISPV_generated_TopologyM.h +++ b/include/mrisurf_SurfaceFromMRISPV_generated_TopologyM.h @@ -1,19 +1,27 @@ namespace TopologyM { struct Face : public Repr_Elt { + typedef TopologyM::Surface Surface; + typedef TopologyM::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline char ripflag ( ) const ; + inline Vertex v ( size_t i ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; - inline void set_v ( size_t i, Vertex to ) ; - inline void set_ripflag ( char to ) ; - }; + inline void set_v ( size_t i, Vertex to ) ; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef TopologyM::Surface Surface; + typedef TopologyM::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -22,32 +30,97 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline uchar num ( ) const ; // number of neighboring faces - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache - inline void which_coords (int which, float *x, float *y, float *z) const ; + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces - inline void set_num ( uchar to ) ; // number of neighboring faces - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices + inline void set_v ( size_t i, Vertex to ) ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline void set_vnum ( short to ) ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline void set_v2num ( short to ) ; // number of 1, or 2-hop neighbors + inline void set_v3num ( short to ) ; // number of 1,2,or 3-hop neighbors + inline void set_vtotal ( short to ) ; // total # of neighbors. copy of vnum.nsizeCur + inline void set_nsizeMaxClock ( short to ) ; // copy of mris->nsizeMaxClock when v#num + inline void set_nsizeMax ( uchar to ) ; // the max nsize that was used to fill in vnum etc + inline void set_nsizeCur ( uchar to ) ; // index of the current v#num in vtotal + inline void set_num ( uchar to ) ; // number of neighboring faces + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef TopologyM::Face Face; + typedef TopologyM::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); inline Surface ( AllM::Surface const & src ); // Fields being maintained by specialist functions - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline Vertex vertices ( size_t i ) const ; - inline Face faces ( size_t i ) const ; - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - }; + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; + }; // Surface } // namespace TopologyM diff --git a/include/mrisurf_SurfaceFromMRISPV_generated_XYZPosition.h b/include/mrisurf_SurfaceFromMRISPV_generated_XYZPosition.h index 8ccace25ff2..6ff8d4d95c4 100644 --- a/include/mrisurf_SurfaceFromMRISPV_generated_XYZPosition.h +++ b/include/mrisurf_SurfaceFromMRISPV_generated_XYZPosition.h @@ -1,5 +1,7 @@ namespace XYZPosition { struct Face : public Repr_Elt { + typedef XYZPosition::Surface Surface; + typedef XYZPosition::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); @@ -12,13 +14,19 @@ inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline char ripflag ( ) const ; + inline Vertex v ( size_t i ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; - inline void set_ripflag ( char to ) ; - }; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef XYZPosition::Surface Surface; + typedef XYZPosition::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -33,25 +41,51 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline uchar num ( ) const ; // number of neighboring faces + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces // managed by MRISfreeDists[_orig] and MRISmakeDists[_orig] - inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz - inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements // - inline float x ( ) const ; // current coordinates - inline float y ( ) const ; // use MRISsetXYZ() to set - inline float z ( ) const ; - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache - inline void which_coords (int which, float *x, float *y, float *z) const ; + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; + // + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef XYZPosition::Face Face; + typedef XYZPosition::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); @@ -64,13 +98,73 @@ inline Surface ( AllM::Surface const & src ); // Fields being maintained by specialist functions - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline Vertex vertices ( size_t i ) const ; - inline Face faces ( size_t i ) const ; - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - }; + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline p_void vp ( ) const ; // for misc. use + inline float alpha ( ) const ; // rotation around z-axis + inline float beta ( ) const ; // rotation around y-axis + inline float gamma ( ) const ; // rotation around x-axis + inline float da ( ) const ; + inline float db ( ) const ; + inline float dg ( ) const ; // old deltas + inline int type ( ) const ; // what type of surface was this initially + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; + + inline void set_vp ( p_void to ) ; // for misc. use + inline void set_alpha ( float to ) ; // rotation around z-axis + inline void set_beta ( float to ) ; // rotation around y-axis + inline void set_gamma ( float to ) ; // rotation around x-axis + inline void set_da ( float to ) ; + inline void set_db ( float to ) ; + inline void set_dg ( float to ) ; // old deltas + inline void set_type ( int to ) ; // what type of surface was this initially + }; // Surface } // namespace XYZPosition diff --git a/include/mrisurf_SurfaceFromMRISPV_generated_XYZPositionConsequences.h b/include/mrisurf_SurfaceFromMRISPV_generated_XYZPositionConsequences.h index 89ea7a81a1c..1245df5fb63 100644 --- a/include/mrisurf_SurfaceFromMRISPV_generated_XYZPositionConsequences.h +++ b/include/mrisurf_SurfaceFromMRISPV_generated_XYZPositionConsequences.h @@ -1,5 +1,7 @@ namespace XYZPositionConsequences { struct Face : public Repr_Elt { + typedef XYZPositionConsequences::Surface Surface; + typedef XYZPositionConsequences::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); @@ -10,16 +12,25 @@ inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline float area ( ) const ; - inline angles_per_triangle_t angle ( ) const ; - inline char ripflag ( ) const ; - inline PDMATRIX norm ( ) const ; + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; + inline PDMATRIX norm ( ) const ; + inline A3PDMATRIX gradNorm ( ) const ; - inline void set_ripflag ( char to ) ; - }; + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef XYZPositionConsequences::Surface Surface; + typedef XYZPositionConsequences::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -32,39 +43,60 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline uchar num ( ) const ; // number of neighboring faces + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces // managed by MRISfreeDists[_orig] and MRISmakeDists[_orig] - inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz - inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements // - inline float x ( ) const ; // current coordinates - inline float y ( ) const ; // use MRISsetXYZ() to set - inline float z ( ) const ; + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; // + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set // - inline float nx ( ) const ; - inline float ny ( ) const ; - inline float nz ( ) const ; // curr normal - // - // - // - inline float area ( ) const ; - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache - inline void which_coords (int which, float *x, float *y, float *z) const ; + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float area ( ) const ; + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices // - // - inline void set_nx ( float to ) ; - inline void set_ny ( float to ) ; - inline void set_nz ( float to ) ; // curr normal - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef XYZPositionConsequences::Face Face; + typedef XYZPositionConsequences::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); @@ -75,40 +107,134 @@ inline Surface ( AllM::Surface const & src ); // Fields being maintained by specialist functions - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline Vertex vertices ( size_t i ) const ; - inline Face faces ( size_t i ) const ; - inline float xctr ( ) const ; - inline float yctr ( ) const ; - inline float zctr ( ) const ; - inline float xlo ( ) const ; - inline float ylo ( ) const ; - inline float zlo ( ) const ; - inline float xhi ( ) const ; - inline float yhi ( ) const ; - inline float zhi ( ) const ; - inline float total_area ( ) const ; - inline double avg_vertex_area ( ) const ; - inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist - inline double std_vertex_dist ( ) const ; - inline float neg_area ( ) const ; - inline float neg_orig_area ( ) const ; // amount of original surface in folds - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline STRIP strips ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float x0 ( ) const ; // center of spherical expansion + inline float y0 ( ) const ; + inline float z0 ( ) const ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + // + inline float max_curv ( ) const ; + inline float min_curv ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline int zeros ( ) const ; + inline int hemisphere ( ) const ; // which hemisphere + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline float Hmin ( ) const ; // min mean curvature + inline float Hmax ( ) const ; // max mean curvature + inline float Kmin ( ) const ; // min Gaussian curvature + inline float Kmax ( ) const ; // max Gaussian curvature + inline double Ktotal ( ) const ; // total Gaussian curvature + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int nlabels ( ) const ; + inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) + inline p_void vp ( ) const ; // for misc. use + inline float alpha ( ) const ; // rotation around z-axis + inline float beta ( ) const ; // rotation around y-axis + inline float gamma ( ) const ; // rotation around x-axis + inline float da ( ) const ; + inline float db ( ) const ; + inline float dg ( ) const ; // old deltas + inline int type ( ) const ; // what type of surface was this initially + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; - inline void set_xctr ( float to ) ; - inline void set_yctr ( float to ) ; - inline void set_zctr ( float to ) ; - inline void set_xlo ( float to ) ; - inline void set_ylo ( float to ) ; - inline void set_zlo ( float to ) ; - inline void set_xhi ( float to ) ; - inline void set_yhi ( float to ) ; - inline void set_zhi ( float to ) ; - inline void set_total_area ( float to ) ; - inline void set_avg_vertex_area ( double to ) ; - }; + inline void set_strips ( size_t i, STRIP to ) ; + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_x0 ( float to ) ; // center of spherical expansion + inline void set_y0 ( float to ) ; + inline void set_z0 ( float to ) ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + // + inline void set_max_curv ( float to ) ; + inline void set_min_curv ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + inline void set_zeros ( int to ) ; + inline void set_hemisphere ( int to ) ; // which hemisphere + inline void set_Hmin ( float to ) ; // min mean curvature + inline void set_Hmax ( float to ) ; // max mean curvature + inline void set_Kmin ( float to ) ; // min Gaussian curvature + inline void set_Kmax ( float to ) ; // max Gaussian curvature + inline void set_Ktotal ( double to ) ; // total Gaussian curvature + inline void set_nlabels ( int to ) ; + inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) + inline void set_vp ( p_void to ) ; // for misc. use + inline void set_alpha ( float to ) ; // rotation around z-axis + inline void set_beta ( float to ) ; // rotation around y-axis + inline void set_gamma ( float to ) ; // rotation around x-axis + inline void set_da ( float to ) ; + inline void set_db ( float to ) ; + inline void set_dg ( float to ) ; // old deltas + inline void set_type ( int to ) ; // what type of surface was this initially + }; // Surface } // namespace XYZPositionConsequences diff --git a/include/mrisurf_SurfaceFromMRISPV_generated_XYZPositionConsequencesM.h b/include/mrisurf_SurfaceFromMRISPV_generated_XYZPositionConsequencesM.h index a3238699525..93d70ee58c6 100644 --- a/include/mrisurf_SurfaceFromMRISPV_generated_XYZPositionConsequencesM.h +++ b/include/mrisurf_SurfaceFromMRISPV_generated_XYZPositionConsequencesM.h @@ -1,24 +1,36 @@ namespace XYZPositionConsequencesM { struct Face : public Repr_Elt { + typedef XYZPositionConsequencesM::Surface Surface; + typedef XYZPositionConsequencesM::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline float area ( ) const ; - inline angles_per_triangle_t angle ( ) const ; - inline char ripflag ( ) const ; - inline PDMATRIX norm ( ) const ; + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; + inline PDMATRIX norm ( ) const ; + inline A3PDMATRIX gradNorm ( ) const ; - inline void set_area ( float to ) ; - inline void set_angle ( angles_per_triangle_t to ) ; - inline void set_ripflag ( char to ) ; - inline void set_norm ( PDMATRIX to ) ; - }; + inline void set_area ( float to ) ; + inline void set_angle ( angles_per_triangle_t to ) ; + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + inline void set_norm ( PDMATRIX to ) ; + inline void set_gradNorm ( A3PDMATRIX to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef XYZPositionConsequencesM::Surface Surface; + typedef XYZPositionConsequencesM::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -27,87 +39,200 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline uchar num ( ) const ; // number of neighboring faces + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces // managed by MRISfreeDists[_orig] and MRISmakeDists[_orig] - inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz - inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements // - inline float x ( ) const ; // current coordinates - inline float y ( ) const ; // use MRISsetXYZ() to set - inline float z ( ) const ; + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; // + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set // - inline float nx ( ) const ; - inline float ny ( ) const ; - inline float nz ( ) const ; // curr normal - // - // - // - inline float area ( ) const ; - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache - inline void which_coords (int which, float *x, float *y, float *z) const ; + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float area ( ) const ; + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces - // - // - inline void set_nx ( float to ) ; - inline void set_ny ( float to ) ; - inline void set_nz ( float to ) ; // curr normal + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices // - // - // - inline void set_area ( float to ) ; - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_area ( float to ) ; + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef XYZPositionConsequencesM::Face Face; + typedef XYZPositionConsequencesM::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); inline Surface ( AllM::Surface const & src ); // Fields being maintained by specialist functions - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline Vertex vertices ( size_t i ) const ; - inline Face faces ( size_t i ) const ; - inline float xctr ( ) const ; - inline float yctr ( ) const ; - inline float zctr ( ) const ; - inline float xlo ( ) const ; - inline float ylo ( ) const ; - inline float zlo ( ) const ; - inline float xhi ( ) const ; - inline float yhi ( ) const ; - inline float zhi ( ) const ; - inline float total_area ( ) const ; - inline double avg_vertex_area ( ) const ; - inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist - inline double std_vertex_dist ( ) const ; - inline float neg_area ( ) const ; - inline float neg_orig_area ( ) const ; // amount of original surface in folds - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline STRIP strips ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float x0 ( ) const ; // center of spherical expansion + inline float y0 ( ) const ; + inline float z0 ( ) const ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + // + inline float max_curv ( ) const ; + inline float min_curv ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline int zeros ( ) const ; + inline int hemisphere ( ) const ; // which hemisphere + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline float Hmin ( ) const ; // min mean curvature + inline float Hmax ( ) const ; // max mean curvature + inline float Kmin ( ) const ; // min Gaussian curvature + inline float Kmax ( ) const ; // max Gaussian curvature + inline double Ktotal ( ) const ; // total Gaussian curvature + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int nlabels ( ) const ; + inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) + inline p_void vp ( ) const ; // for misc. use + inline float alpha ( ) const ; // rotation around z-axis + inline float beta ( ) const ; // rotation around y-axis + inline float gamma ( ) const ; // rotation around x-axis + inline float da ( ) const ; + inline float db ( ) const ; + inline float dg ( ) const ; // old deltas + inline int type ( ) const ; // what type of surface was this initially + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; - inline void set_xctr ( float to ) ; - inline void set_yctr ( float to ) ; - inline void set_zctr ( float to ) ; - inline void set_xlo ( float to ) ; - inline void set_ylo ( float to ) ; - inline void set_zlo ( float to ) ; - inline void set_xhi ( float to ) ; - inline void set_yhi ( float to ) ; - inline void set_zhi ( float to ) ; - inline void set_total_area ( float to ) ; - inline void set_avg_vertex_area ( double to ) ; - inline void set_avg_vertex_dist ( double to ) ; // set by MRIScomputeAvgInterVertexDist - inline void set_std_vertex_dist ( double to ) ; - inline void set_neg_area ( float to ) ; - inline void set_neg_orig_area ( float to ) ; // amount of original surface in folds - }; + inline void set_strips ( size_t i, STRIP to ) ; + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_x0 ( float to ) ; // center of spherical expansion + inline void set_y0 ( float to ) ; + inline void set_z0 ( float to ) ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + // + inline void set_max_curv ( float to ) ; + inline void set_min_curv ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + inline void set_avg_vertex_dist ( double to ) ; // set by MRIScomputeAvgInterVertexDist + inline void set_std_vertex_dist ( double to ) ; + inline void set_orig_area ( float to ) ; + inline void set_neg_area ( float to ) ; + inline void set_neg_orig_area ( float to ) ; // amount of original surface in folds + inline void set_zeros ( int to ) ; + inline void set_hemisphere ( int to ) ; // which hemisphere + inline void set_Hmin ( float to ) ; // min mean curvature + inline void set_Hmax ( float to ) ; // max mean curvature + inline void set_Kmin ( float to ) ; // min Gaussian curvature + inline void set_Kmax ( float to ) ; // max Gaussian curvature + inline void set_Ktotal ( double to ) ; // total Gaussian curvature + inline void set_nlabels ( int to ) ; + inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) + inline void set_vp ( p_void to ) ; // for misc. use + inline void set_alpha ( float to ) ; // rotation around z-axis + inline void set_beta ( float to ) ; // rotation around y-axis + inline void set_gamma ( float to ) ; // rotation around x-axis + inline void set_da ( float to ) ; + inline void set_db ( float to ) ; + inline void set_dg ( float to ) ; // old deltas + inline void set_type ( int to ) ; // what type of surface was this initially + }; // Surface } // namespace XYZPositionConsequencesM diff --git a/include/mrisurf_SurfaceFromMRISPV_generated_XYZPositionM.h b/include/mrisurf_SurfaceFromMRISPV_generated_XYZPositionM.h index 1b6af4ba731..ee272fd77f1 100644 --- a/include/mrisurf_SurfaceFromMRISPV_generated_XYZPositionM.h +++ b/include/mrisurf_SurfaceFromMRISPV_generated_XYZPositionM.h @@ -1,18 +1,26 @@ namespace XYZPositionM { struct Face : public Repr_Elt { + typedef XYZPositionM::Surface Surface; + typedef XYZPositionM::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline char ripflag ( ) const ; + inline Vertex v ( size_t i ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; - inline void set_ripflag ( char to ) ; - }; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef XYZPositionM::Surface Surface; + typedef XYZPositionM::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -21,42 +29,129 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline uchar num ( ) const ; // number of neighboring faces + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces // managed by MRISfreeDists[_orig] and MRISmakeDists[_orig] - inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz - inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements // - inline float x ( ) const ; // current coordinates - inline float y ( ) const ; // use MRISsetXYZ() to set - inline float z ( ) const ; - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache - inline void which_coords (int which, float *x, float *y, float *z) const ; + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; + // + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices // - inline void set_x ( float to ) ; // current coordinates - inline void set_y ( float to ) ; // use MRISsetXYZ() to set - inline void set_z ( float to ) ; - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_x ( float to ) ; // current coordinates + inline void set_y ( float to ) ; // use MRISsetXYZ() to set + inline void set_z ( float to ) ; + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { - inline Surface ( ); - inline Surface ( Surface const & src ); - inline Surface ( Representation* representation ); - inline Surface ( AllM::Surface const & src ); + typedef XYZPositionM::Face Face; + typedef XYZPositionM::Vertex Vertex; + inline Surface ( ); + inline Surface ( Surface const & src ); + inline Surface ( Representation* representation ); + inline Surface ( AllM::Surface const & src ); + void freeDistsButNotOrig() { MRISfreeDistsButNotOrig(repr); } // Fields being maintained by specialist functions - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline Vertex vertices ( size_t i ) const ; - inline Face faces ( size_t i ) const ; - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - }; + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline p_void vp ( ) const ; // for misc. use + inline float alpha ( ) const ; // rotation around z-axis + inline float beta ( ) const ; // rotation around y-axis + inline float gamma ( ) const ; // rotation around x-axis + inline float da ( ) const ; + inline float db ( ) const ; + inline float dg ( ) const ; // old deltas + inline int type ( ) const ; // what type of surface was this initially + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; + + inline void set_vp ( p_void to ) ; // for misc. use + inline void set_alpha ( float to ) ; // rotation around z-axis + inline void set_beta ( float to ) ; // rotation around y-axis + inline void set_gamma ( float to ) ; // rotation around x-axis + inline void set_da ( float to ) ; + inline void set_db ( float to ) ; + inline void set_dg ( float to ) ; // old deltas + inline void set_type ( int to ) ; // what type of surface was this initially + }; // Surface } // namespace XYZPositionM diff --git a/include/mrisurf_SurfaceFromMRISPV_generated_prefix.h b/include/mrisurf_SurfaceFromMRISPV_generated_prefix.h index b24e1e99105..e04981e6916 100644 --- a/include/mrisurf_SurfaceFromMRISPV_generated_prefix.h +++ b/include/mrisurf_SurfaceFromMRISPV_generated_prefix.h @@ -1,7 +1,9 @@ +#pragma once // GENERATED SOURCE - DO NOT DIRECTLY EDIT // // ======================================= +#include "mrisurf_aaa.h" namespace SurfaceFromMRISPV { typedef MRISPV Representation; diff --git a/include/mrisurf_SurfaceFromMRISPV_generated_suffix.h b/include/mrisurf_SurfaceFromMRISPV_generated_suffix.h index 05b51369e1c..1f26facb7bb 100644 --- a/include/mrisurf_SurfaceFromMRISPV_generated_suffix.h +++ b/include/mrisurf_SurfaceFromMRISPV_generated_suffix.h @@ -1,7 +1,9 @@ +#pragma once // GENERATED SOURCE - DO NOT DIRECTLY EDIT // // ======================================= +#include "mrisurf_aaa.h" namespace SurfaceFromMRISPV { typedef MRISPV Representation; @@ -25,10 +27,22 @@ namespace SurfaceFromMRISPV { char Face::ripflag() const { return repr->f_ripflag[idx]; } + char Face::oripflag() const { + return repr->f_oripflag[idx]; + } + int Face::marked() const { + return repr->f_marked[idx]; + } void Face::set_ripflag(char to) { repr->f_ripflag[idx] = to; } + void Face::set_oripflag(char to) { + repr->f_oripflag[idx] = to; + } + void Face::set_marked(int to) { + repr->f_marked[idx] = to; + } Vertex::Vertex ( ) {} @@ -86,15 +100,108 @@ namespace SurfaceFromMRISPV { Surface::Surface ( Analysis::Surface const & src ) : Repr_Elt(src) {} Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + int Surface::initialized() const { + return repr->initialized; + } + PLTA Surface::lta() const { + return repr->lta; + } + PMATRIX Surface::SRASToTalSRAS_() const { + return repr->SRASToTalSRAS_; + } + PMATRIX Surface::TalSRASToSRAS_() const { + return repr->TalSRASToSRAS_; + } + int Surface::free_transform() const { + return repr->free_transform; + } double Surface::radius() const { // radius (if status==MRIS_SPHERE) return repr->radius; } + float Surface::a() const { + return repr->a; + } + float Surface::b() const { + return repr->b; + } + float Surface::c() const { // ellipsoid parameters + return repr->c; + } + MRIS_fname_t Surface::fname() const { // file it was originally loaded from + return repr->fname; + } MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) return repr->status; } MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from return repr->origxyz_status; } + int Surface::patch() const { // if a patch of the surface + return repr->patch; + } + int Surface::max_vertices() const { // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + return repr->max_vertices; + } + int Surface::max_faces() const { // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + return repr->max_faces; + } + MRIS_subject_name_t Surface::subject_name() const { // name of the subject + return repr->subject_name; + } + float Surface::canon_area() const { + return repr->canon_area; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->noscale; + } + float Surface::dx2(size_t i) const { // an extra set of gradient (not always alloced) + return repr->dx2[i]; + } + float Surface::dy2(size_t i) const { + return repr->dy2[i]; + } + float Surface::dz2(size_t i) const { + return repr->dz2[i]; + } + PCOLOR_TABLE Surface::ct() const { + return repr->ct; + } + int Surface::useRealRAS() const { // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + return repr->useRealRAS; + } + VOL_GEOM Surface::vg() const { // volume info from which this surface is created. valid iff vg.valid = 1 + return repr->vg; + } + MRIS_cmdlines_t Surface::cmdlines() const { + return repr->cmdlines; + } + int Surface::ncmds() const { + return repr->ncmds; + } + float Surface::group_avg_surface_area() const { // average of total surface area for group + return repr->group_avg_surface_area; + } + int Surface::group_avg_vtxarea_loaded() const { // average vertex area for group at each vertex + return repr->group_avg_vtxarea_loaded; + } + int Surface::triangle_links_removed() const { // for quad surfaces + return repr->triangle_links_removed; + } + p_void Surface::user_parms() const { // for whatever the user wants to hang here + return repr->user_parms; + } + PMATRIX Surface::m_sras2vox() const { // for converting surface ras to voxel + return repr->m_sras2vox; + } + PMRI Surface::mri_sras2vox() const { // volume that the above matrix is for + return repr->mri_sras2vox; + } + p_void Surface::mht() const { + return repr->mht; + } + p_void Surface::temps() const { + return repr->temps; + } } // namespace Existence @@ -120,10 +227,22 @@ namespace SurfaceFromMRISPV { char Face::ripflag() const { return repr->f_ripflag[idx]; } + char Face::oripflag() const { + return repr->f_oripflag[idx]; + } + int Face::marked() const { + return repr->f_marked[idx]; + } void Face::set_ripflag(char to) { repr->f_ripflag[idx] = to; } + void Face::set_oripflag(char to) { + repr->f_oripflag[idx] = to; + } + void Face::set_marked(int to) { + repr->f_marked[idx] = to; + } Vertex::Vertex ( ) {} @@ -140,7 +259,37 @@ namespace SurfaceFromMRISPV { Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} Face Vertex::f(size_t i) const { // size() is num. array[v->num] the fno's of the neighboring faces - return Face(repr,repr->v_f[idx][i]); + return Face(repr, repr->v_f[idx][i]); + } + size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex + return repr->v_n[idx][i]; + } + int Vertex::e(size_t i) const { // edge state for neighboring vertices + return repr->v_e[idx][i]; + } + Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + return Vertex(repr,repr->v_v[idx][i]); + } + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) + return repr->v_vnum[idx]; + } + short Vertex::v2num() const { // number of 1, or 2-hop neighbors + return repr->v_v2num[idx]; + } + short Vertex::v3num() const { // number of 1,2,or 3-hop neighbors + return repr->v_v3num[idx]; + } + short Vertex::vtotal() const { // total # of neighbors. copy of vnum.nsizeCur + return repr->v_vtotal[idx]; + } + short Vertex::nsizeMaxClock() const { // copy of mris->nsizeMaxClock when v#num + return repr->v_nsizeMaxClock[idx]; + } + uchar Vertex::nsizeMax() const { // the max nsize that was used to fill in vnum etc + return repr->v_nsizeMax[idx]; + } + uchar Vertex::nsizeCur() const { // index of the current v#num in vtotal + return repr->v_nsizeCur[idx]; } uchar Vertex::num() const { // number of neighboring faces return repr->v_num[idx]; @@ -168,6 +317,12 @@ namespace SurfaceFromMRISPV { void Vertex::set_f(size_t i, Face to) { // size() is num. array[v->num] the fno's of the neighboring faces cheapAssert(repr == to.repr); repr->v_f[idx][i] = to.idx; } + void Vertex::set_n(size_t i, size_t to) { // size() is num. array[v->num] the face.v[*] index for this vertex + repr->v_n[idx][i] = uchar(to); + } + void Vertex::set_e(size_t i, int to) { // edge state for neighboring vertices + repr->v_e[idx][i] = to; + } void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache repr->v_ripflag[idx] = to; } @@ -186,27 +341,156 @@ namespace SurfaceFromMRISPV { Surface::Surface ( Analysis::Surface const & src ) : Repr_Elt(src) {} Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + int Surface::nverticesFrozen() const { // # of vertices on surface is frozen + return repr->nverticesFrozen; + } int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al return repr->nvertices; } int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al return repr->nfaces; } + bool Surface::faceAttachmentDeferred() const { // defer connecting faces to vertices for performance reasons + return repr->faceAttachmentDeferred; + } + int Surface::nedges() const { // # of edges on surface + return repr->nedges; + } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } + int Surface::nstrips() const { + return repr->nstrips; + } Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + return Vertex(repr, i); + } + p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + return repr->dist_storage; + } + p_p_void Surface::dist_orig_storage() const { // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + return repr->dist_orig_storage; + } + int Surface::tempsAssigned() const { // State of various temp fields that can be borrowed if not already in use + return repr->tempsAssigned; } Face Surface::faces(size_t i) const { - return Face(repr,i); + return Face(repr, i); + } + MRI_EDGE Surface::edges(size_t i) const { + return repr->edges[i]; + } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + int Surface::initialized() const { + return repr->initialized; + } + PLTA Surface::lta() const { + return repr->lta; + } + PMATRIX Surface::SRASToTalSRAS_() const { + return repr->SRASToTalSRAS_; + } + PMATRIX Surface::TalSRASToSRAS_() const { + return repr->TalSRASToSRAS_; + } + int Surface::free_transform() const { + return repr->free_transform; } double Surface::radius() const { // radius (if status==MRIS_SPHERE) return repr->radius; } + float Surface::a() const { + return repr->a; + } + float Surface::b() const { + return repr->b; + } + float Surface::c() const { // ellipsoid parameters + return repr->c; + } + MRIS_fname_t Surface::fname() const { // file it was originally loaded from + return repr->fname; + } MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) return repr->status; } MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from return repr->origxyz_status; } + int Surface::patch() const { // if a patch of the surface + return repr->patch; + } + int Surface::max_vertices() const { // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + return repr->max_vertices; + } + int Surface::max_faces() const { // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + return repr->max_faces; + } + MRIS_subject_name_t Surface::subject_name() const { // name of the subject + return repr->subject_name; + } + float Surface::canon_area() const { + return repr->canon_area; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->noscale; + } + float Surface::dx2(size_t i) const { // an extra set of gradient (not always alloced) + return repr->dx2[i]; + } + float Surface::dy2(size_t i) const { + return repr->dy2[i]; + } + float Surface::dz2(size_t i) const { + return repr->dz2[i]; + } + PCOLOR_TABLE Surface::ct() const { + return repr->ct; + } + int Surface::useRealRAS() const { // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + return repr->useRealRAS; + } + VOL_GEOM Surface::vg() const { // volume info from which this surface is created. valid iff vg.valid = 1 + return repr->vg; + } + MRIS_cmdlines_t Surface::cmdlines() const { + return repr->cmdlines; + } + int Surface::ncmds() const { + return repr->ncmds; + } + float Surface::group_avg_surface_area() const { // average of total surface area for group + return repr->group_avg_surface_area; + } + int Surface::group_avg_vtxarea_loaded() const { // average vertex area for group at each vertex + return repr->group_avg_vtxarea_loaded; + } + int Surface::triangle_links_removed() const { // for quad surfaces + return repr->triangle_links_removed; + } + p_void Surface::user_parms() const { // for whatever the user wants to hang here + return repr->user_parms; + } + PMATRIX Surface::m_sras2vox() const { // for converting surface ras to voxel + return repr->m_sras2vox; + } + PMRI Surface::mri_sras2vox() const { // volume that the above matrix is for + return repr->mri_sras2vox; + } + p_void Surface::mht() const { + return repr->mht; + } + p_void Surface::temps() const { + return repr->temps; + } } // namespace Topology @@ -230,10 +514,22 @@ namespace SurfaceFromMRISPV { char Face::ripflag() const { return repr->f_ripflag[idx]; } + char Face::oripflag() const { + return repr->f_oripflag[idx]; + } + int Face::marked() const { + return repr->f_marked[idx]; + } void Face::set_ripflag(char to) { repr->f_ripflag[idx] = to; } + void Face::set_oripflag(char to) { + repr->f_oripflag[idx] = to; + } + void Face::set_marked(int to) { + repr->f_marked[idx] = to; + } Vertex::Vertex ( ) {} @@ -248,7 +544,37 @@ namespace SurfaceFromMRISPV { Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} Face Vertex::f(size_t i) const { // size() is num. array[v->num] the fno's of the neighboring faces - return Face(repr,repr->v_f[idx][i]); + return Face(repr, repr->v_f[idx][i]); + } + size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex + return repr->v_n[idx][i]; + } + int Vertex::e(size_t i) const { // edge state for neighboring vertices + return repr->v_e[idx][i]; + } + Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + return Vertex(repr,repr->v_v[idx][i]); + } + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) + return repr->v_vnum[idx]; + } + short Vertex::v2num() const { // number of 1, or 2-hop neighbors + return repr->v_v2num[idx]; + } + short Vertex::v3num() const { // number of 1,2,or 3-hop neighbors + return repr->v_v3num[idx]; + } + short Vertex::vtotal() const { // total # of neighbors. copy of vnum.nsizeCur + return repr->v_vtotal[idx]; + } + short Vertex::nsizeMaxClock() const { // copy of mris->nsizeMaxClock when v#num + return repr->v_nsizeMaxClock[idx]; + } + uchar Vertex::nsizeMax() const { // the max nsize that was used to fill in vnum etc + return repr->v_nsizeMax[idx]; + } + uchar Vertex::nsizeCur() const { // index of the current v#num in vtotal + return repr->v_nsizeCur[idx]; } uchar Vertex::num() const { // number of neighboring faces return repr->v_num[idx]; @@ -256,9 +582,15 @@ namespace SurfaceFromMRISPV { float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz return repr->v_dist[idx][i]; } + float Vertex::dist_orig(size_t i) const { // size() is vtotal. distance to neighboring vertices based on origxyz + return repr->v_dist_orig[idx][i]; + } int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements return repr->v_dist_capacity[idx]; } + int Vertex::dist_orig_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_orig_capacity[idx]; + } float Vertex::x() const { // current coordinates return repr->v_x[idx]; } @@ -268,6 +600,24 @@ namespace SurfaceFromMRISPV { float Vertex::z() const { return repr->v_z[idx]; } + float Vertex::origx() const { // original coordinates, see also MRIS::origxyz_status + return repr->v_origx[idx]; + } + float Vertex::origy() const { // use MRISsetOriginalXYZ(, + return repr->v_origy[idx]; + } + float Vertex::origz() const { // or MRISsetOriginalXYZfromXYZ to set + return repr->v_origz[idx]; + } + float Vertex::cx() const { + return repr->v_cx[idx]; + } + float Vertex::cy() const { + return repr->v_cy[idx]; + } + float Vertex::cz() const { // coordinates in canonical coordinate system + return repr->v_cz[idx]; + } char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache return repr->v_ripflag[idx]; } @@ -280,6 +630,8 @@ namespace SurfaceFromMRISPV { switch (which) { CASE(CURRENT_VERTICES,) + CASE(ORIGINAL_VERTICES,orig) + CASE(CANONICAL_VERTICES,c) default: *x = *y = *z = 0.0; ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); @@ -292,6 +644,21 @@ namespace SurfaceFromMRISPV { void Vertex::set_f(size_t i, Face to) { // size() is num. array[v->num] the fno's of the neighboring faces cheapAssert(repr == to.repr); repr->v_f[idx][i] = to.idx; } + void Vertex::set_n(size_t i, size_t to) { // size() is num. array[v->num] the face.v[*] index for this vertex + repr->v_n[idx][i] = uchar(to); + } + void Vertex::set_e(size_t i, int to) { // edge state for neighboring vertices + repr->v_e[idx][i] = to; + } + void Vertex::set_cx(float to) { + repr->v_cx[idx] = to; + } + void Vertex::set_cy(float to) { + repr->v_cy[idx] = to; + } + void Vertex::set_cz(float to) { // coordinates in canonical coordinate system + repr->v_cz[idx] = to; + } void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache repr->v_ripflag[idx] = to; } @@ -308,27 +675,205 @@ namespace SurfaceFromMRISPV { Surface::Surface ( Analysis::Surface const & src ) : Repr_Elt(src) {} Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + int Surface::nverticesFrozen() const { // # of vertices on surface is frozen + return repr->nverticesFrozen; + } int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al return repr->nvertices; } int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al return repr->nfaces; } + bool Surface::faceAttachmentDeferred() const { // defer connecting faces to vertices for performance reasons + return repr->faceAttachmentDeferred; + } + int Surface::nedges() const { // # of edges on surface + return repr->nedges; + } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } + int Surface::nstrips() const { + return repr->nstrips; + } Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + return Vertex(repr, i); + } + p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + return repr->dist_storage; + } + p_p_void Surface::dist_orig_storage() const { // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + return repr->dist_orig_storage; + } + int Surface::tempsAssigned() const { // State of various temp fields that can be borrowed if not already in use + return repr->tempsAssigned; } Face Surface::faces(size_t i) const { - return Face(repr,i); + return Face(repr, i); + } + MRI_EDGE Surface::edges(size_t i) const { + return repr->edges[i]; + } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + int Surface::initialized() const { + return repr->initialized; + } + PLTA Surface::lta() const { + return repr->lta; + } + PMATRIX Surface::SRASToTalSRAS_() const { + return repr->SRASToTalSRAS_; + } + PMATRIX Surface::TalSRASToSRAS_() const { + return repr->TalSRASToSRAS_; + } + int Surface::free_transform() const { + return repr->free_transform; } double Surface::radius() const { // radius (if status==MRIS_SPHERE) return repr->radius; } + float Surface::a() const { + return repr->a; + } + float Surface::b() const { + return repr->b; + } + float Surface::c() const { // ellipsoid parameters + return repr->c; + } + MRIS_fname_t Surface::fname() const { // file it was originally loaded from + return repr->fname; + } MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) return repr->status; } MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from return repr->origxyz_status; } + int Surface::patch() const { // if a patch of the surface + return repr->patch; + } + p_void Surface::vp() const { // for misc. use + return repr->vp; + } + float Surface::alpha() const { // rotation around z-axis + return repr->alpha; + } + float Surface::beta() const { // rotation around y-axis + return repr->beta; + } + float Surface::gamma() const { // rotation around x-axis + return repr->gamma; + } + float Surface::da() const { + return repr->da; + } + float Surface::db() const { + return repr->db; + } + float Surface::dg() const { // old deltas + return repr->dg; + } + int Surface::type() const { // what type of surface was this initially + return repr->type; + } + int Surface::max_vertices() const { // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + return repr->max_vertices; + } + int Surface::max_faces() const { // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + return repr->max_faces; + } + MRIS_subject_name_t Surface::subject_name() const { // name of the subject + return repr->subject_name; + } + float Surface::canon_area() const { + return repr->canon_area; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->noscale; + } + float Surface::dx2(size_t i) const { // an extra set of gradient (not always alloced) + return repr->dx2[i]; + } + float Surface::dy2(size_t i) const { + return repr->dy2[i]; + } + float Surface::dz2(size_t i) const { + return repr->dz2[i]; + } + PCOLOR_TABLE Surface::ct() const { + return repr->ct; + } + int Surface::useRealRAS() const { // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + return repr->useRealRAS; + } + VOL_GEOM Surface::vg() const { // volume info from which this surface is created. valid iff vg.valid = 1 + return repr->vg; + } + MRIS_cmdlines_t Surface::cmdlines() const { + return repr->cmdlines; + } + int Surface::ncmds() const { + return repr->ncmds; + } + float Surface::group_avg_surface_area() const { // average of total surface area for group + return repr->group_avg_surface_area; + } + int Surface::group_avg_vtxarea_loaded() const { // average vertex area for group at each vertex + return repr->group_avg_vtxarea_loaded; + } + int Surface::triangle_links_removed() const { // for quad surfaces + return repr->triangle_links_removed; + } + p_void Surface::user_parms() const { // for whatever the user wants to hang here + return repr->user_parms; + } + PMATRIX Surface::m_sras2vox() const { // for converting surface ras to voxel + return repr->m_sras2vox; + } + PMRI Surface::mri_sras2vox() const { // volume that the above matrix is for + return repr->mri_sras2vox; + } + p_void Surface::mht() const { + return repr->mht; + } + p_void Surface::temps() const { + return repr->temps; + } + + void Surface::set_vp(p_void to) { // for misc. use + repr->vp = to; + } + void Surface::set_alpha(float to) { // rotation around z-axis + repr->alpha = to; + } + void Surface::set_beta(float to) { // rotation around y-axis + repr->beta = to; + } + void Surface::set_gamma(float to) { // rotation around x-axis + repr->gamma = to; + } + void Surface::set_da(float to) { + repr->da = to; + } + void Surface::set_db(float to) { + repr->db = to; + } + void Surface::set_dg(float to) { // old deltas + repr->dg = to; + } + void Surface::set_type(int to) { // what type of surface was this initially + repr->type = to; + } } // namespace XYZPosition @@ -353,16 +898,37 @@ namespace SurfaceFromMRISPV { angles_per_triangle_t Face::angle() const { return repr->f_angle[idx]; } + angles_per_triangle_t Face::orig_angle() const { + return repr->f_orig_angle[idx]; + } char Face::ripflag() const { return repr->f_ripflag[idx]; } + char Face::oripflag() const { + return repr->f_oripflag[idx]; + } + int Face::marked() const { + return repr->f_marked[idx]; + } PDMATRIX Face::norm() const { return repr->f_norm[idx]; } + A3PDMATRIX Face::gradNorm() const { + return repr->f_gradNorm[idx]; + } + void Face::set_orig_angle(angles_per_triangle_t to) { + repr->f_orig_angle[idx] = to; + } void Face::set_ripflag(char to) { repr->f_ripflag[idx] = to; } + void Face::set_oripflag(char to) { + repr->f_oripflag[idx] = to; + } + void Face::set_marked(int to) { + repr->f_marked[idx] = to; + } Vertex::Vertex ( ) {} @@ -375,7 +941,37 @@ namespace SurfaceFromMRISPV { Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} Face Vertex::f(size_t i) const { // size() is num. array[v->num] the fno's of the neighboring faces - return Face(repr,repr->v_f[idx][i]); + return Face(repr, repr->v_f[idx][i]); + } + size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex + return repr->v_n[idx][i]; + } + int Vertex::e(size_t i) const { // edge state for neighboring vertices + return repr->v_e[idx][i]; + } + Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + return Vertex(repr,repr->v_v[idx][i]); + } + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) + return repr->v_vnum[idx]; + } + short Vertex::v2num() const { // number of 1, or 2-hop neighbors + return repr->v_v2num[idx]; + } + short Vertex::v3num() const { // number of 1,2,or 3-hop neighbors + return repr->v_v3num[idx]; + } + short Vertex::vtotal() const { // total # of neighbors. copy of vnum.nsizeCur + return repr->v_vtotal[idx]; + } + short Vertex::nsizeMaxClock() const { // copy of mris->nsizeMaxClock when v#num + return repr->v_nsizeMaxClock[idx]; + } + uchar Vertex::nsizeMax() const { // the max nsize that was used to fill in vnum etc + return repr->v_nsizeMax[idx]; + } + uchar Vertex::nsizeCur() const { // index of the current v#num in vtotal + return repr->v_nsizeCur[idx]; } uchar Vertex::num() const { // number of neighboring faces return repr->v_num[idx]; @@ -383,9 +979,15 @@ namespace SurfaceFromMRISPV { float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz return repr->v_dist[idx][i]; } + float Vertex::dist_orig(size_t i) const { // size() is vtotal. distance to neighboring vertices based on origxyz + return repr->v_dist_orig[idx][i]; + } int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements return repr->v_dist_capacity[idx]; } + int Vertex::dist_orig_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_orig_capacity[idx]; + } float Vertex::x() const { // current coordinates return repr->v_x[idx]; } @@ -395,6 +997,15 @@ namespace SurfaceFromMRISPV { float Vertex::z() const { return repr->v_z[idx]; } + float Vertex::origx() const { // original coordinates, see also MRIS::origxyz_status + return repr->v_origx[idx]; + } + float Vertex::origy() const { // use MRISsetOriginalXYZ(, + return repr->v_origy[idx]; + } + float Vertex::origz() const { // or MRISsetOriginalXYZfromXYZ to set + return repr->v_origz[idx]; + } float Vertex::nx() const { return repr->v_nx[idx]; } @@ -404,6 +1015,15 @@ namespace SurfaceFromMRISPV { float Vertex::nz() const { // curr normal return repr->v_nz[idx]; } + float Vertex::cx() const { + return repr->v_cx[idx]; + } + float Vertex::cy() const { + return repr->v_cy[idx]; + } + float Vertex::cz() const { // coordinates in canonical coordinate system + return repr->v_cz[idx]; + } float Vertex::area() const { return repr->v_area[idx]; } @@ -419,7 +1039,9 @@ namespace SurfaceFromMRISPV { switch (which) { CASE(CURRENT_VERTICES,) + CASE(ORIGINAL_VERTICES,orig) CASE(VERTEX_NORMALS,n) + CASE(CANONICAL_VERTICES,c) default: *x = *y = *z = 0.0; ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); @@ -432,6 +1054,12 @@ namespace SurfaceFromMRISPV { void Vertex::set_f(size_t i, Face to) { // size() is num. array[v->num] the fno's of the neighboring faces cheapAssert(repr == to.repr); repr->v_f[idx][i] = to.idx; } + void Vertex::set_n(size_t i, size_t to) { // size() is num. array[v->num] the face.v[*] index for this vertex + repr->v_n[idx][i] = uchar(to); + } + void Vertex::set_e(size_t i, int to) { // edge state for neighboring vertices + repr->v_e[idx][i] = to; + } void Vertex::set_nx(float to) { repr->v_nx[idx] = to; } @@ -441,6 +1069,15 @@ namespace SurfaceFromMRISPV { void Vertex::set_nz(float to) { // curr normal repr->v_nz[idx] = to; } + void Vertex::set_cx(float to) { + repr->v_cx[idx] = to; + } + void Vertex::set_cy(float to) { + repr->v_cy[idx] = to; + } + void Vertex::set_cz(float to) { // coordinates in canonical coordinate system + repr->v_cz[idx] = to; + } void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache repr->v_ripflag[idx] = to; } @@ -455,17 +1092,56 @@ namespace SurfaceFromMRISPV { Surface::Surface ( Analysis::Surface const & src ) : Repr_Elt(src) {} Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + int Surface::nverticesFrozen() const { // # of vertices on surface is frozen + return repr->nverticesFrozen; + } int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al return repr->nvertices; } int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al return repr->nfaces; } + bool Surface::faceAttachmentDeferred() const { // defer connecting faces to vertices for performance reasons + return repr->faceAttachmentDeferred; + } + int Surface::nedges() const { // # of edges on surface + return repr->nedges; + } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } + int Surface::nstrips() const { + return repr->nstrips; + } Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + return Vertex(repr, i); + } + p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + return repr->dist_storage; + } + p_p_void Surface::dist_orig_storage() const { // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + return repr->dist_orig_storage; + } + int Surface::tempsAssigned() const { // State of various temp fields that can be borrowed if not already in use + return repr->tempsAssigned; } Face Surface::faces(size_t i) const { - return Face(repr,i); + return Face(repr, i); + } + MRI_EDGE Surface::edges(size_t i) const { + return repr->edges[i]; + } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + STRIP Surface::strips(size_t i) const { + return repr->strips[i]; } float Surface::xctr() const { return repr->xctr; @@ -494,6 +1170,21 @@ namespace SurfaceFromMRISPV { float Surface::zhi() const { return repr->zhi; } + float Surface::x0() const { // center of spherical expansion + return repr->x0; + } + float Surface::y0() const { + return repr->y0; + } + float Surface::z0() const { + return repr->z0; + } + float Surface::max_curv() const { + return repr->max_curv; + } + float Surface::min_curv() const { + return repr->min_curv; + } float Surface::total_area() const { return repr->total_area; } @@ -506,35 +1197,185 @@ namespace SurfaceFromMRISPV { double Surface::std_vertex_dist() const { return repr->std_vertex_dist; } + float Surface::orig_area() const { + return repr->orig_area; + } float Surface::neg_area() const { return repr->neg_area; } float Surface::neg_orig_area() const { // amount of original surface in folds return repr->neg_orig_area; } + int Surface::zeros() const { + return repr->zeros; + } + int Surface::hemisphere() const { // which hemisphere + return repr->hemisphere; + } + int Surface::initialized() const { + return repr->initialized; + } + PLTA Surface::lta() const { + return repr->lta; + } + PMATRIX Surface::SRASToTalSRAS_() const { + return repr->SRASToTalSRAS_; + } + PMATRIX Surface::TalSRASToSRAS_() const { + return repr->TalSRASToSRAS_; + } + int Surface::free_transform() const { + return repr->free_transform; + } double Surface::radius() const { // radius (if status==MRIS_SPHERE) return repr->radius; } + float Surface::a() const { + return repr->a; + } + float Surface::b() const { + return repr->b; + } + float Surface::c() const { // ellipsoid parameters + return repr->c; + } + MRIS_fname_t Surface::fname() const { // file it was originally loaded from + return repr->fname; + } + float Surface::Hmin() const { // min mean curvature + return repr->Hmin; + } + float Surface::Hmax() const { // max mean curvature + return repr->Hmax; + } + float Surface::Kmin() const { // min Gaussian curvature + return repr->Kmin; + } + float Surface::Kmax() const { // max Gaussian curvature + return repr->Kmax; + } + double Surface::Ktotal() const { // total Gaussian curvature + return repr->Ktotal; + } MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) return repr->status; } MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from return repr->origxyz_status; } - - void Surface::set_xctr(float to) { - repr->xctr = to; + int Surface::patch() const { // if a patch of the surface + return repr->patch; } - void Surface::set_yctr(float to) { - repr->yctr = to; + int Surface::nlabels() const { + return repr->nlabels; } - void Surface::set_zctr(float to) { - repr->zctr = to; + PMRIS_AREA_LABEL Surface::labels() const { // nlabels of these (may be null) + return repr->labels; } - void Surface::set_xlo(float to) { - repr->xlo = to; + p_void Surface::vp() const { // for misc. use + return repr->vp; } - void Surface::set_ylo(float to) { + float Surface::alpha() const { // rotation around z-axis + return repr->alpha; + } + float Surface::beta() const { // rotation around y-axis + return repr->beta; + } + float Surface::gamma() const { // rotation around x-axis + return repr->gamma; + } + float Surface::da() const { + return repr->da; + } + float Surface::db() const { + return repr->db; + } + float Surface::dg() const { // old deltas + return repr->dg; + } + int Surface::type() const { // what type of surface was this initially + return repr->type; + } + int Surface::max_vertices() const { // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + return repr->max_vertices; + } + int Surface::max_faces() const { // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + return repr->max_faces; + } + MRIS_subject_name_t Surface::subject_name() const { // name of the subject + return repr->subject_name; + } + float Surface::canon_area() const { + return repr->canon_area; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->noscale; + } + float Surface::dx2(size_t i) const { // an extra set of gradient (not always alloced) + return repr->dx2[i]; + } + float Surface::dy2(size_t i) const { + return repr->dy2[i]; + } + float Surface::dz2(size_t i) const { + return repr->dz2[i]; + } + PCOLOR_TABLE Surface::ct() const { + return repr->ct; + } + int Surface::useRealRAS() const { // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + return repr->useRealRAS; + } + VOL_GEOM Surface::vg() const { // volume info from which this surface is created. valid iff vg.valid = 1 + return repr->vg; + } + MRIS_cmdlines_t Surface::cmdlines() const { + return repr->cmdlines; + } + int Surface::ncmds() const { + return repr->ncmds; + } + float Surface::group_avg_surface_area() const { // average of total surface area for group + return repr->group_avg_surface_area; + } + int Surface::group_avg_vtxarea_loaded() const { // average vertex area for group at each vertex + return repr->group_avg_vtxarea_loaded; + } + int Surface::triangle_links_removed() const { // for quad surfaces + return repr->triangle_links_removed; + } + p_void Surface::user_parms() const { // for whatever the user wants to hang here + return repr->user_parms; + } + PMATRIX Surface::m_sras2vox() const { // for converting surface ras to voxel + return repr->m_sras2vox; + } + PMRI Surface::mri_sras2vox() const { // volume that the above matrix is for + return repr->mri_sras2vox; + } + p_void Surface::mht() const { + return repr->mht; + } + p_void Surface::temps() const { + return repr->temps; + } + + void Surface::set_strips(size_t i, STRIP to) { + repr->strips[i] = to; + } + void Surface::set_xctr(float to) { + repr->xctr = to; + } + void Surface::set_yctr(float to) { + repr->yctr = to; + } + void Surface::set_zctr(float to) { + repr->zctr = to; + } + void Surface::set_xlo(float to) { + repr->xlo = to; + } + void Surface::set_ylo(float to) { repr->ylo = to; } void Surface::set_zlo(float to) { @@ -549,12 +1390,78 @@ namespace SurfaceFromMRISPV { void Surface::set_zhi(float to) { repr->zhi = to; } + void Surface::set_x0(float to) { // center of spherical expansion + repr->x0 = to; + } + void Surface::set_y0(float to) { + repr->y0 = to; + } + void Surface::set_z0(float to) { + repr->z0 = to; + } + void Surface::set_max_curv(float to) { + repr->max_curv = to; + } + void Surface::set_min_curv(float to) { + repr->min_curv = to; + } void Surface::set_total_area(float to) { repr->total_area = to; } void Surface::set_avg_vertex_area(double to) { repr->avg_vertex_area = to; } + void Surface::set_zeros(int to) { + repr->zeros = to; + } + void Surface::set_hemisphere(int to) { // which hemisphere + repr->hemisphere = to; + } + void Surface::set_Hmin(float to) { // min mean curvature + repr->Hmin = to; + } + void Surface::set_Hmax(float to) { // max mean curvature + repr->Hmax = to; + } + void Surface::set_Kmin(float to) { // min Gaussian curvature + repr->Kmin = to; + } + void Surface::set_Kmax(float to) { // max Gaussian curvature + repr->Kmax = to; + } + void Surface::set_Ktotal(double to) { // total Gaussian curvature + repr->Ktotal = to; + } + void Surface::set_nlabels(int to) { + repr->nlabels = to; + } + void Surface::set_labels(PMRIS_AREA_LABEL to) { // nlabels of these (may be null) + repr->labels = to; + } + void Surface::set_vp(p_void to) { // for misc. use + repr->vp = to; + } + void Surface::set_alpha(float to) { // rotation around z-axis + repr->alpha = to; + } + void Surface::set_beta(float to) { // rotation around y-axis + repr->beta = to; + } + void Surface::set_gamma(float to) { // rotation around x-axis + repr->gamma = to; + } + void Surface::set_da(float to) { + repr->da = to; + } + void Surface::set_db(float to) { + repr->db = to; + } + void Surface::set_dg(float to) { // old deltas + repr->dg = to; + } + void Surface::set_type(int to) { // what type of surface was this initially + repr->type = to; + } } // namespace XYZPositionConsequences @@ -577,16 +1484,37 @@ namespace SurfaceFromMRISPV { angles_per_triangle_t Face::angle() const { return repr->f_angle[idx]; } + angles_per_triangle_t Face::orig_angle() const { + return repr->f_orig_angle[idx]; + } char Face::ripflag() const { return repr->f_ripflag[idx]; } + char Face::oripflag() const { + return repr->f_oripflag[idx]; + } + int Face::marked() const { + return repr->f_marked[idx]; + } PDMATRIX Face::norm() const { return repr->f_norm[idx]; } + A3PDMATRIX Face::gradNorm() const { + return repr->f_gradNorm[idx]; + } + void Face::set_orig_angle(angles_per_triangle_t to) { + repr->f_orig_angle[idx] = to; + } void Face::set_ripflag(char to) { repr->f_ripflag[idx] = to; } + void Face::set_oripflag(char to) { + repr->f_oripflag[idx] = to; + } + void Face::set_marked(int to) { + repr->f_marked[idx] = to; + } Vertex::Vertex ( ) {} @@ -597,7 +1525,37 @@ namespace SurfaceFromMRISPV { Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} Face Vertex::f(size_t i) const { // size() is num. array[v->num] the fno's of the neighboring faces - return Face(repr,repr->v_f[idx][i]); + return Face(repr, repr->v_f[idx][i]); + } + size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex + return repr->v_n[idx][i]; + } + int Vertex::e(size_t i) const { // edge state for neighboring vertices + return repr->v_e[idx][i]; + } + Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + return Vertex(repr,repr->v_v[idx][i]); + } + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) + return repr->v_vnum[idx]; + } + short Vertex::v2num() const { // number of 1, or 2-hop neighbors + return repr->v_v2num[idx]; + } + short Vertex::v3num() const { // number of 1,2,or 3-hop neighbors + return repr->v_v3num[idx]; + } + short Vertex::vtotal() const { // total # of neighbors. copy of vnum.nsizeCur + return repr->v_vtotal[idx]; + } + short Vertex::nsizeMaxClock() const { // copy of mris->nsizeMaxClock when v#num + return repr->v_nsizeMaxClock[idx]; + } + uchar Vertex::nsizeMax() const { // the max nsize that was used to fill in vnum etc + return repr->v_nsizeMax[idx]; + } + uchar Vertex::nsizeCur() const { // index of the current v#num in vtotal + return repr->v_nsizeCur[idx]; } uchar Vertex::num() const { // number of neighboring faces return repr->v_num[idx]; @@ -605,9 +1563,15 @@ namespace SurfaceFromMRISPV { float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz return repr->v_dist[idx][i]; } + float Vertex::dist_orig(size_t i) const { // size() is vtotal. distance to neighboring vertices based on origxyz + return repr->v_dist_orig[idx][i]; + } int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements return repr->v_dist_capacity[idx]; } + int Vertex::dist_orig_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_orig_capacity[idx]; + } float Vertex::x() const { // current coordinates return repr->v_x[idx]; } @@ -617,6 +1581,15 @@ namespace SurfaceFromMRISPV { float Vertex::z() const { return repr->v_z[idx]; } + float Vertex::origx() const { // original coordinates, see also MRIS::origxyz_status + return repr->v_origx[idx]; + } + float Vertex::origy() const { // use MRISsetOriginalXYZ(, + return repr->v_origy[idx]; + } + float Vertex::origz() const { // or MRISsetOriginalXYZfromXYZ to set + return repr->v_origz[idx]; + } float Vertex::nx() const { return repr->v_nx[idx]; } @@ -626,12 +1599,306 @@ namespace SurfaceFromMRISPV { float Vertex::nz() const { // curr normal return repr->v_nz[idx]; } + float Vertex::pnx() const { + return repr->v_pnx[idx]; + } + float Vertex::pny() const { + return repr->v_pny[idx]; + } + float Vertex::pnz() const { // pial normal + return repr->v_pnz[idx]; + } + float Vertex::wnx() const { + return repr->v_wnx[idx]; + } + float Vertex::wny() const { + return repr->v_wny[idx]; + } + float Vertex::wnz() const { // white normal + return repr->v_wnz[idx]; + } + float Vertex::onx() const { + return repr->v_onx[idx]; + } + float Vertex::ony() const { + return repr->v_ony[idx]; + } + float Vertex::onz() const { // original normal + return repr->v_onz[idx]; + } + float Vertex::dx() const { + return repr->v_dx[idx]; + } + float Vertex::dy() const { + return repr->v_dy[idx]; + } + float Vertex::dz() const { // current change in position + return repr->v_dz[idx]; + } + float Vertex::odx() const { + return repr->v_odx[idx]; + } + float Vertex::ody() const { + return repr->v_ody[idx]; + } + float Vertex::odz() const { // last change of position (for momentum, + return repr->v_odz[idx]; + } + float Vertex::tdx() const { + return repr->v_tdx[idx]; + } + float Vertex::tdy() const { + return repr->v_tdy[idx]; + } + float Vertex::tdz() const { // temporary storage for averaging gradient + return repr->v_tdz[idx]; + } + float Vertex::curv() const { // curr curvature + return repr->v_curv[idx]; + } + float Vertex::curvbak() const { + return repr->v_curvbak[idx]; + } + float Vertex::val() const { // scalar data value (file: rh.val, sig2-rh.w) + return repr->v_val[idx]; + } + float Vertex::imag_val() const { // imaginary part of complex data value + return repr->v_imag_val[idx]; + } + float Vertex::cx() const { + return repr->v_cx[idx]; + } + float Vertex::cy() const { + return repr->v_cy[idx]; + } + float Vertex::cz() const { // coordinates in canonical coordinate system + return repr->v_cz[idx]; + } + float Vertex::tx() const { + return repr->v_tx[idx]; + } + float Vertex::ty() const { + return repr->v_ty[idx]; + } + float Vertex::tz() const { // tmp coordinate storage + return repr->v_tz[idx]; + } + float Vertex::t2x() const { + return repr->v_t2x[idx]; + } + float Vertex::t2y() const { + return repr->v_t2y[idx]; + } + float Vertex::t2z() const { // another tmp coordinate storage + return repr->v_t2z[idx]; + } + float Vertex::targx() const { + return repr->v_targx[idx]; + } + float Vertex::targy() const { + return repr->v_targy[idx]; + } + float Vertex::targz() const { // target coordinates + return repr->v_targz[idx]; + } + float Vertex::pialx() const { + return repr->v_pialx[idx]; + } + float Vertex::pialy() const { + return repr->v_pialy[idx]; + } + float Vertex::pialz() const { // pial surface coordinates + return repr->v_pialz[idx]; + } + float Vertex::whitex() const { + return repr->v_whitex[idx]; + } + float Vertex::whitey() const { + return repr->v_whitey[idx]; + } + float Vertex::whitez() const { // white surface coordinates + return repr->v_whitez[idx]; + } + float Vertex::l4x() const { + return repr->v_l4x[idx]; + } + float Vertex::l4y() const { + return repr->v_l4y[idx]; + } + float Vertex::l4z() const { // layerIV surface coordinates + return repr->v_l4z[idx]; + } + float Vertex::infx() const { + return repr->v_infx[idx]; + } + float Vertex::infy() const { + return repr->v_infy[idx]; + } + float Vertex::infz() const { // inflated coordinates + return repr->v_infz[idx]; + } + float Vertex::fx() const { + return repr->v_fx[idx]; + } + float Vertex::fy() const { + return repr->v_fy[idx]; + } + float Vertex::fz() const { // flattened coordinates + return repr->v_fz[idx]; + } + int Vertex::px() const { + return repr->v_px[idx]; + } + int Vertex::qx() const { + return repr->v_qx[idx]; + } + int Vertex::py() const { + return repr->v_py[idx]; + } + int Vertex::qy() const { + return repr->v_qy[idx]; + } + int Vertex::pz() const { + return repr->v_pz[idx]; + } + int Vertex::qz() const { // rational coordinates for exact calculations + return repr->v_qz[idx]; + } + float Vertex::e1x() const { + return repr->v_e1x[idx]; + } + float Vertex::e1y() const { + return repr->v_e1y[idx]; + } + float Vertex::e1z() const { // 1st basis vector for the local tangent plane + return repr->v_e1z[idx]; + } + float Vertex::e2x() const { + return repr->v_e2x[idx]; + } + float Vertex::e2y() const { + return repr->v_e2y[idx]; + } + float Vertex::e2z() const { // 2nd basis vector for the local tangent plane + return repr->v_e2z[idx]; + } + float Vertex::pe1x() const { + return repr->v_pe1x[idx]; + } + float Vertex::pe1y() const { + return repr->v_pe1y[idx]; + } + float Vertex::pe1z() const { // 1st basis vector for the local tangent plane + return repr->v_pe1z[idx]; + } + float Vertex::pe2x() const { + return repr->v_pe2x[idx]; + } + float Vertex::pe2y() const { + return repr->v_pe2y[idx]; + } + float Vertex::pe2z() const { // 2nd basis vector for the local tangent plane + return repr->v_pe2z[idx]; + } + float Vertex::nc() const { // curr length normal comp + return repr->v_nc[idx]; + } + float Vertex::val2() const { // complex comp data value (file: sig3-rh.w) + return repr->v_val2[idx]; + } + float Vertex::valbak() const { // scalar data stack + return repr->v_valbak[idx]; + } + float Vertex::val2bak() const { // complex comp data stack + return repr->v_val2bak[idx]; + } + float Vertex::stat() const { // statistic + return repr->v_stat[idx]; + } + int Vertex::undefval() const { // [previously dist=0] + return repr->v_undefval[idx]; + } + int Vertex::old_undefval() const { // for smooth_val_sparse + return repr->v_old_undefval[idx]; + } + int Vertex::fixedval() const { // [previously val=0] + return repr->v_fixedval[idx]; + } + float Vertex::fieldsign() const { // fieldsign--final: -1, "0", "1" (file: rh.fs) + return repr->v_fieldsign[idx]; + } + float Vertex::fsmask() const { // significance mask (file: rh.fm) + return repr->v_fsmask[idx]; + } + float Vertex::d() const { // for distance calculations + return repr->v_d[idx]; + } + int Vertex::annotation() const { // area label (defunct--now from label file name!) + return repr->v_annotation[idx]; + } + char Vertex::oripflag() const { + return repr->v_oripflag[idx]; + } + char Vertex::origripflag() const { // cuts flags + return repr->v_origripflag[idx]; + } + p_void Vertex::vp() const { // to store user's information + return repr->v_vp[idx]; + } + float Vertex::theta() const { + return repr->v_theta[idx]; + } + float Vertex::phi() const { // parameterization + return repr->v_phi[idx]; + } float Vertex::area() const { return repr->v_area[idx]; } float Vertex::origarea() const { return repr->v_origarea[idx]; } + float Vertex::group_avg_area() const { + return repr->v_group_avg_area[idx]; + } + float Vertex::K() const { // Gaussian curvature + return repr->v_K[idx]; + } + float Vertex::H() const { // mean curvature + return repr->v_H[idx]; + } + float Vertex::k1() const { + return repr->v_k1[idx]; + } + float Vertex::k2() const { // the principal curvatures + return repr->v_k2[idx]; + } + float Vertex::mean() const { + return repr->v_mean[idx]; + } + float Vertex::mean_imag() const { // imaginary part of complex statistic + return repr->v_mean_imag[idx]; + } + float Vertex::std_error() const { + return repr->v_std_error[idx]; + } + uint Vertex::flags() const { + return repr->v_flags[idx]; + } + int Vertex::fno() const { // face that this vertex is in + return repr->v_fno[idx]; + } + int Vertex::cropped() const { + return repr->v_cropped[idx]; + } + short Vertex::marked() const { // for a variety of uses + return repr->v_marked[idx]; + } + short Vertex::marked2() const { + return repr->v_marked2[idx]; + } + short Vertex::marked3() const { + return repr->v_marked3[idx]; + } char Vertex::neg() const { // 1 if the normal vector is inverted return repr->v_neg[idx]; } @@ -650,7 +1917,17 @@ namespace SurfaceFromMRISPV { switch (which) { CASE(CURRENT_VERTICES,) + CASE(ORIGINAL_VERTICES,orig) CASE(VERTEX_NORMALS,n) + CASE(PIAL_NORMALS,pn) + CASE(WHITE_NORMALS,wn) + CASE(CANONICAL_VERTICES,c) + CASE(TMP_VERTICES,t) + CASE(TMP2_VERTICES,t2) + CASE(PIAL_VERTICES,pial) + CASE(WHITE_VERTICES,white) + CASE(INFLATED_VERTICES,inf) + CASE(FLATTENED_VERTICES,f) default: *x = *y = *z = 0.0; ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); @@ -663,6 +1940,12 @@ namespace SurfaceFromMRISPV { void Vertex::set_f(size_t i, Face to) { // size() is num. array[v->num] the fno's of the neighboring faces cheapAssert(repr == to.repr); repr->v_f[idx][i] = to.idx; } + void Vertex::set_n(size_t i, size_t to) { // size() is num. array[v->num] the face.v[*] index for this vertex + repr->v_n[idx][i] = uchar(to); + } + void Vertex::set_e(size_t i, int to) { // edge state for neighboring vertices + repr->v_e[idx][i] = to; + } void Vertex::set_nx(float to) { repr->v_nx[idx] = to; } @@ -672,243 +1955,303 @@ namespace SurfaceFromMRISPV { void Vertex::set_nz(float to) { // curr normal repr->v_nz[idx] = to; } - void Vertex::set_origarea(float to) { - repr->v_origarea[idx] = to; + void Vertex::set_pnx(float to) { + repr->v_pnx[idx] = to; } - void Vertex::set_neg(char to) { // 1 if the normal vector is inverted - repr->v_neg[idx] = to; + void Vertex::set_pny(float to) { + repr->v_pny[idx] = to; } - void Vertex::set_border(char to) { // flag - repr->v_border[idx] = to; + void Vertex::set_pnz(float to) { // pial normal + repr->v_pnz[idx] = to; } - void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache - repr->v_ripflag[idx] = to; + void Vertex::set_wnx(float to) { + repr->v_wnx[idx] = to; } - - - Surface::Surface ( ) {} - Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} - Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} - Surface::Surface ( AnalysisM::Surface const & src ) : Repr_Elt(src) {} - Surface::Surface ( Analysis::Surface const & src ) : Repr_Elt(src) {} - Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} - - int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - return repr->nvertices; + void Vertex::set_wny(float to) { + repr->v_wny[idx] = to; } - int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - return repr->nfaces; + void Vertex::set_wnz(float to) { // white normal + repr->v_wnz[idx] = to; } - Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + void Vertex::set_onx(float to) { + repr->v_onx[idx] = to; } - Face Surface::faces(size_t i) const { - return Face(repr,i); + void Vertex::set_ony(float to) { + repr->v_ony[idx] = to; } - float Surface::xctr() const { - return repr->xctr; + void Vertex::set_onz(float to) { // original normal + repr->v_onz[idx] = to; } - float Surface::yctr() const { - return repr->yctr; + void Vertex::set_dx(float to) { + repr->v_dx[idx] = to; } - float Surface::zctr() const { - return repr->zctr; + void Vertex::set_dy(float to) { + repr->v_dy[idx] = to; } - float Surface::xlo() const { - return repr->xlo; + void Vertex::set_dz(float to) { // current change in position + repr->v_dz[idx] = to; } - float Surface::ylo() const { - return repr->ylo; + void Vertex::set_odx(float to) { + repr->v_odx[idx] = to; } - float Surface::zlo() const { - return repr->zlo; + void Vertex::set_ody(float to) { + repr->v_ody[idx] = to; } - float Surface::xhi() const { - return repr->xhi; + void Vertex::set_odz(float to) { // last change of position (for momentum, + repr->v_odz[idx] = to; } - float Surface::yhi() const { - return repr->yhi; + void Vertex::set_tdx(float to) { + repr->v_tdx[idx] = to; } - float Surface::zhi() const { - return repr->zhi; + void Vertex::set_tdy(float to) { + repr->v_tdy[idx] = to; } - float Surface::total_area() const { - return repr->total_area; + void Vertex::set_tdz(float to) { // temporary storage for averaging gradient + repr->v_tdz[idx] = to; } - double Surface::avg_vertex_area() const { - return repr->avg_vertex_area; + void Vertex::set_curv(float to) { // curr curvature + repr->v_curv[idx] = to; } - double Surface::avg_vertex_dist() const { // set by MRIScomputeAvgInterVertexDist - return repr->avg_vertex_dist; + void Vertex::set_curvbak(float to) { + repr->v_curvbak[idx] = to; } - double Surface::std_vertex_dist() const { - return repr->std_vertex_dist; + void Vertex::set_val(float to) { // scalar data value (file: rh.val, sig2-rh.w) + repr->v_val[idx] = to; } - float Surface::neg_area() const { - return repr->neg_area; + void Vertex::set_imag_val(float to) { // imaginary part of complex data value + repr->v_imag_val[idx] = to; } - float Surface::neg_orig_area() const { // amount of original surface in folds - return repr->neg_orig_area; + void Vertex::set_cx(float to) { + repr->v_cx[idx] = to; } - double Surface::radius() const { // radius (if status==MRIS_SPHERE) - return repr->radius; + void Vertex::set_cy(float to) { + repr->v_cy[idx] = to; } - MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) - return repr->status; + void Vertex::set_cz(float to) { // coordinates in canonical coordinate system + repr->v_cz[idx] = to; } - MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from - return repr->origxyz_status; + void Vertex::set_tx(float to) { + repr->v_tx[idx] = to; } - - void Surface::set_xctr(float to) { - repr->xctr = to; + void Vertex::set_ty(float to) { + repr->v_ty[idx] = to; } - void Surface::set_yctr(float to) { - repr->yctr = to; + void Vertex::set_tz(float to) { // tmp coordinate storage + repr->v_tz[idx] = to; } - void Surface::set_zctr(float to) { - repr->zctr = to; + void Vertex::set_t2x(float to) { + repr->v_t2x[idx] = to; } - void Surface::set_xlo(float to) { - repr->xlo = to; + void Vertex::set_t2y(float to) { + repr->v_t2y[idx] = to; } - void Surface::set_ylo(float to) { - repr->ylo = to; + void Vertex::set_t2z(float to) { // another tmp coordinate storage + repr->v_t2z[idx] = to; } - void Surface::set_zlo(float to) { - repr->zlo = to; + void Vertex::set_targx(float to) { + repr->v_targx[idx] = to; } - void Surface::set_xhi(float to) { - repr->xhi = to; + void Vertex::set_targy(float to) { + repr->v_targy[idx] = to; } - void Surface::set_yhi(float to) { - repr->yhi = to; + void Vertex::set_targz(float to) { // target coordinates + repr->v_targz[idx] = to; } - void Surface::set_zhi(float to) { - repr->zhi = to; + void Vertex::set_pialx(float to) { + repr->v_pialx[idx] = to; } - void Surface::set_total_area(float to) { - repr->total_area = to; + void Vertex::set_pialy(float to) { + repr->v_pialy[idx] = to; } - void Surface::set_avg_vertex_area(double to) { - repr->avg_vertex_area = to; + void Vertex::set_pialz(float to) { // pial surface coordinates + repr->v_pialz[idx] = to; } - - - } // namespace Distort - - - namespace Analysis { - Face::Face ( ) {} - Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} - Face::Face ( Face const & src ) : Repr_Elt(src) {} - Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} - - Vertex Face::v(size_t i) const { - return Vertex(repr,repr->f_v[idx][i]); + void Vertex::set_whitex(float to) { + repr->v_whitex[idx] = to; } - float Face::area() const { - return repr->f_area[idx]; + void Vertex::set_whitey(float to) { + repr->v_whitey[idx] = to; } - angles_per_triangle_t Face::angle() const { - return repr->f_angle[idx]; + void Vertex::set_whitez(float to) { // white surface coordinates + repr->v_whitez[idx] = to; } - char Face::ripflag() const { - return repr->f_ripflag[idx]; + void Vertex::set_l4x(float to) { + repr->v_l4x[idx] = to; } - PDMATRIX Face::norm() const { - return repr->f_norm[idx]; + void Vertex::set_l4y(float to) { + repr->v_l4y[idx] = to; } - - void Face::set_ripflag(char to) { - repr->f_ripflag[idx] = to; + void Vertex::set_l4z(float to) { // layerIV surface coordinates + repr->v_l4z[idx] = to; } - - - Vertex::Vertex ( ) {} - Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} - Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} - Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} - - Face Vertex::f(size_t i) const { // size() is num. array[v->num] the fno's of the neighboring faces - return Face(repr,repr->v_f[idx][i]); + void Vertex::set_infx(float to) { + repr->v_infx[idx] = to; } - uchar Vertex::num() const { // number of neighboring faces - return repr->v_num[idx]; + void Vertex::set_infy(float to) { + repr->v_infy[idx] = to; } - float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz - return repr->v_dist[idx][i]; + void Vertex::set_infz(float to) { // inflated coordinates + repr->v_infz[idx] = to; } - int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements - return repr->v_dist_capacity[idx]; + void Vertex::set_fx(float to) { + repr->v_fx[idx] = to; } - float Vertex::x() const { // current coordinates - return repr->v_x[idx]; + void Vertex::set_fy(float to) { + repr->v_fy[idx] = to; } - float Vertex::y() const { // use MRISsetXYZ() to set - return repr->v_y[idx]; + void Vertex::set_fz(float to) { // flattened coordinates + repr->v_fz[idx] = to; } - float Vertex::z() const { - return repr->v_z[idx]; + void Vertex::set_px(int to) { + repr->v_px[idx] = to; } - float Vertex::nx() const { - return repr->v_nx[idx]; + void Vertex::set_qx(int to) { + repr->v_qx[idx] = to; } - float Vertex::ny() const { - return repr->v_ny[idx]; + void Vertex::set_py(int to) { + repr->v_py[idx] = to; } - float Vertex::nz() const { // curr normal - return repr->v_nz[idx]; + void Vertex::set_qy(int to) { + repr->v_qy[idx] = to; } - float Vertex::area() const { - return repr->v_area[idx]; + void Vertex::set_pz(int to) { + repr->v_pz[idx] = to; } - float Vertex::origarea() const { - return repr->v_origarea[idx]; + void Vertex::set_qz(int to) { // rational coordinates for exact calculations + repr->v_qz[idx] = to; } - char Vertex::neg() const { // 1 if the normal vector is inverted - return repr->v_neg[idx]; + void Vertex::set_e1x(float to) { + repr->v_e1x[idx] = to; } - char Vertex::border() const { // flag - return repr->v_border[idx]; + void Vertex::set_e1y(float to) { + repr->v_e1y[idx] = to; } - char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache - return repr->v_ripflag[idx]; + void Vertex::set_e1z(float to) { // 1st basis vector for the local tangent plane + repr->v_e1z[idx] = to; } - void Vertex::which_coords(int which, float *x, float *y, float *z) const { - - #define CASE(WHICH, FIELD) \ - case WHICH: \ - *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ - break; - - switch (which) { - CASE(CURRENT_VERTICES,) - CASE(VERTEX_NORMALS,n) - default: - *x = *y = *z = 0.0; - ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); - break; - } - - #undef CASE + void Vertex::set_e2x(float to) { + repr->v_e2x[idx] = to; } - - void Vertex::set_f(size_t i, Face to) { // size() is num. array[v->num] the fno's of the neighboring faces - cheapAssert(repr == to.repr); repr->v_f[idx][i] = to.idx; + void Vertex::set_e2y(float to) { + repr->v_e2y[idx] = to; } - void Vertex::set_nx(float to) { - repr->v_nx[idx] = to; + void Vertex::set_e2z(float to) { // 2nd basis vector for the local tangent plane + repr->v_e2z[idx] = to; } - void Vertex::set_ny(float to) { - repr->v_ny[idx] = to; + void Vertex::set_pe1x(float to) { + repr->v_pe1x[idx] = to; } - void Vertex::set_nz(float to) { // curr normal - repr->v_nz[idx] = to; + void Vertex::set_pe1y(float to) { + repr->v_pe1y[idx] = to; + } + void Vertex::set_pe1z(float to) { // 1st basis vector for the local tangent plane + repr->v_pe1z[idx] = to; + } + void Vertex::set_pe2x(float to) { + repr->v_pe2x[idx] = to; + } + void Vertex::set_pe2y(float to) { + repr->v_pe2y[idx] = to; + } + void Vertex::set_pe2z(float to) { // 2nd basis vector for the local tangent plane + repr->v_pe2z[idx] = to; + } + void Vertex::set_nc(float to) { // curr length normal comp + repr->v_nc[idx] = to; + } + void Vertex::set_val2(float to) { // complex comp data value (file: sig3-rh.w) + repr->v_val2[idx] = to; + } + void Vertex::set_valbak(float to) { // scalar data stack + repr->v_valbak[idx] = to; + } + void Vertex::set_val2bak(float to) { // complex comp data stack + repr->v_val2bak[idx] = to; + } + void Vertex::set_stat(float to) { // statistic + repr->v_stat[idx] = to; + } + void Vertex::set_undefval(int to) { // [previously dist=0] + repr->v_undefval[idx] = to; + } + void Vertex::set_old_undefval(int to) { // for smooth_val_sparse + repr->v_old_undefval[idx] = to; + } + void Vertex::set_fixedval(int to) { // [previously val=0] + repr->v_fixedval[idx] = to; + } + void Vertex::set_fieldsign(float to) { // fieldsign--final: -1, "0", "1" (file: rh.fs) + repr->v_fieldsign[idx] = to; + } + void Vertex::set_fsmask(float to) { // significance mask (file: rh.fm) + repr->v_fsmask[idx] = to; + } + void Vertex::set_d(float to) { // for distance calculations + repr->v_d[idx] = to; + } + void Vertex::set_annotation(int to) { // area label (defunct--now from label file name!) + repr->v_annotation[idx] = to; + } + void Vertex::set_oripflag(char to) { + repr->v_oripflag[idx] = to; + } + void Vertex::set_origripflag(char to) { // cuts flags + repr->v_origripflag[idx] = to; + } + void Vertex::set_vp(p_void to) { // to store user's information + repr->v_vp[idx] = to; + } + void Vertex::set_theta(float to) { + repr->v_theta[idx] = to; + } + void Vertex::set_phi(float to) { // parameterization + repr->v_phi[idx] = to; } void Vertex::set_origarea(float to) { repr->v_origarea[idx] = to; } + void Vertex::set_group_avg_area(float to) { + repr->v_group_avg_area[idx] = to; + } + void Vertex::set_K(float to) { // Gaussian curvature + repr->v_K[idx] = to; + } + void Vertex::set_H(float to) { // mean curvature + repr->v_H[idx] = to; + } + void Vertex::set_k1(float to) { + repr->v_k1[idx] = to; + } + void Vertex::set_k2(float to) { // the principal curvatures + repr->v_k2[idx] = to; + } + void Vertex::set_mean(float to) { + repr->v_mean[idx] = to; + } + void Vertex::set_mean_imag(float to) { // imaginary part of complex statistic + repr->v_mean_imag[idx] = to; + } + void Vertex::set_std_error(float to) { + repr->v_std_error[idx] = to; + } + void Vertex::set_flags(uint to) { + repr->v_flags[idx] = to; + } + void Vertex::set_fno(int to) { // face that this vertex is in + repr->v_fno[idx] = to; + } + void Vertex::set_cropped(int to) { + repr->v_cropped[idx] = to; + } + void Vertex::set_marked(short to) { // for a variety of uses + repr->v_marked[idx] = to; + } + void Vertex::set_marked2(short to) { + repr->v_marked2[idx] = to; + } + void Vertex::set_marked3(short to) { + repr->v_marked3[idx] = to; + } void Vertex::set_neg(char to) { // 1 if the normal vector is inverted repr->v_neg[idx] = to; } @@ -923,19 +2266,60 @@ namespace SurfaceFromMRISPV { Surface::Surface ( ) {} Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AnalysisM::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( Analysis::Surface const & src ) : Repr_Elt(src) {} Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + int Surface::nverticesFrozen() const { // # of vertices on surface is frozen + return repr->nverticesFrozen; + } int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al return repr->nvertices; } int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al return repr->nfaces; } + bool Surface::faceAttachmentDeferred() const { // defer connecting faces to vertices for performance reasons + return repr->faceAttachmentDeferred; + } + int Surface::nedges() const { // # of edges on surface + return repr->nedges; + } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } + int Surface::nstrips() const { + return repr->nstrips; + } Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + return Vertex(repr, i); + } + p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + return repr->dist_storage; + } + p_p_void Surface::dist_orig_storage() const { // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + return repr->dist_orig_storage; + } + int Surface::tempsAssigned() const { // State of various temp fields that can be borrowed if not already in use + return repr->tempsAssigned; } Face Surface::faces(size_t i) const { - return Face(repr,i); + return Face(repr, i); + } + MRI_EDGE Surface::edges(size_t i) const { + return repr->edges[i]; + } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + STRIP Surface::strips(size_t i) const { + return repr->strips[i]; } float Surface::xctr() const { return repr->xctr; @@ -964,6 +2348,21 @@ namespace SurfaceFromMRISPV { float Surface::zhi() const { return repr->zhi; } + float Surface::x0() const { // center of spherical expansion + return repr->x0; + } + float Surface::y0() const { + return repr->y0; + } + float Surface::z0() const { + return repr->z0; + } + float Surface::max_curv() const { + return repr->max_curv; + } + float Surface::min_curv() const { + return repr->min_curv; + } float Surface::total_area() const { return repr->total_area; } @@ -976,22 +2375,172 @@ namespace SurfaceFromMRISPV { double Surface::std_vertex_dist() const { return repr->std_vertex_dist; } + float Surface::orig_area() const { + return repr->orig_area; + } float Surface::neg_area() const { return repr->neg_area; } float Surface::neg_orig_area() const { // amount of original surface in folds return repr->neg_orig_area; } + int Surface::zeros() const { + return repr->zeros; + } + int Surface::hemisphere() const { // which hemisphere + return repr->hemisphere; + } + int Surface::initialized() const { + return repr->initialized; + } + PLTA Surface::lta() const { + return repr->lta; + } + PMATRIX Surface::SRASToTalSRAS_() const { + return repr->SRASToTalSRAS_; + } + PMATRIX Surface::TalSRASToSRAS_() const { + return repr->TalSRASToSRAS_; + } + int Surface::free_transform() const { + return repr->free_transform; + } double Surface::radius() const { // radius (if status==MRIS_SPHERE) return repr->radius; } + float Surface::a() const { + return repr->a; + } + float Surface::b() const { + return repr->b; + } + float Surface::c() const { // ellipsoid parameters + return repr->c; + } + MRIS_fname_t Surface::fname() const { // file it was originally loaded from + return repr->fname; + } + float Surface::Hmin() const { // min mean curvature + return repr->Hmin; + } + float Surface::Hmax() const { // max mean curvature + return repr->Hmax; + } + float Surface::Kmin() const { // min Gaussian curvature + return repr->Kmin; + } + float Surface::Kmax() const { // max Gaussian curvature + return repr->Kmax; + } + double Surface::Ktotal() const { // total Gaussian curvature + return repr->Ktotal; + } MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) return repr->status; } MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from return repr->origxyz_status; } + int Surface::patch() const { // if a patch of the surface + return repr->patch; + } + int Surface::nlabels() const { + return repr->nlabels; + } + PMRIS_AREA_LABEL Surface::labels() const { // nlabels of these (may be null) + return repr->labels; + } + p_void Surface::vp() const { // for misc. use + return repr->vp; + } + float Surface::alpha() const { // rotation around z-axis + return repr->alpha; + } + float Surface::beta() const { // rotation around y-axis + return repr->beta; + } + float Surface::gamma() const { // rotation around x-axis + return repr->gamma; + } + float Surface::da() const { + return repr->da; + } + float Surface::db() const { + return repr->db; + } + float Surface::dg() const { // old deltas + return repr->dg; + } + int Surface::type() const { // what type of surface was this initially + return repr->type; + } + int Surface::max_vertices() const { // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + return repr->max_vertices; + } + int Surface::max_faces() const { // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + return repr->max_faces; + } + MRIS_subject_name_t Surface::subject_name() const { // name of the subject + return repr->subject_name; + } + float Surface::canon_area() const { + return repr->canon_area; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->noscale; + } + float Surface::dx2(size_t i) const { // an extra set of gradient (not always alloced) + return repr->dx2[i]; + } + float Surface::dy2(size_t i) const { + return repr->dy2[i]; + } + float Surface::dz2(size_t i) const { + return repr->dz2[i]; + } + PCOLOR_TABLE Surface::ct() const { + return repr->ct; + } + int Surface::useRealRAS() const { // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + return repr->useRealRAS; + } + VOL_GEOM Surface::vg() const { // volume info from which this surface is created. valid iff vg.valid = 1 + return repr->vg; + } + MRIS_cmdlines_t Surface::cmdlines() const { + return repr->cmdlines; + } + int Surface::ncmds() const { + return repr->ncmds; + } + float Surface::group_avg_surface_area() const { // average of total surface area for group + return repr->group_avg_surface_area; + } + int Surface::group_avg_vtxarea_loaded() const { // average vertex area for group at each vertex + return repr->group_avg_vtxarea_loaded; + } + int Surface::triangle_links_removed() const { // for quad surfaces + return repr->triangle_links_removed; + } + p_void Surface::user_parms() const { // for whatever the user wants to hang here + return repr->user_parms; + } + PMATRIX Surface::m_sras2vox() const { // for converting surface ras to voxel + return repr->m_sras2vox; + } + PMRI Surface::mri_sras2vox() const { // volume that the above matrix is for + return repr->mri_sras2vox; + } + p_void Surface::mht() const { + return repr->mht; + } + p_void Surface::temps() const { + return repr->temps; + } + void Surface::set_strips(size_t i, STRIP to) { + repr->strips[i] = to; + } void Surface::set_xctr(float to) { repr->xctr = to; } @@ -1019,30 +2568,129 @@ namespace SurfaceFromMRISPV { void Surface::set_zhi(float to) { repr->zhi = to; } + void Surface::set_x0(float to) { // center of spherical expansion + repr->x0 = to; + } + void Surface::set_y0(float to) { + repr->y0 = to; + } + void Surface::set_z0(float to) { + repr->z0 = to; + } + void Surface::set_max_curv(float to) { + repr->max_curv = to; + } + void Surface::set_min_curv(float to) { + repr->min_curv = to; + } void Surface::set_total_area(float to) { repr->total_area = to; } void Surface::set_avg_vertex_area(double to) { repr->avg_vertex_area = to; } + void Surface::set_zeros(int to) { + repr->zeros = to; + } + void Surface::set_hemisphere(int to) { // which hemisphere + repr->hemisphere = to; + } + void Surface::set_Hmin(float to) { // min mean curvature + repr->Hmin = to; + } + void Surface::set_Hmax(float to) { // max mean curvature + repr->Hmax = to; + } + void Surface::set_Kmin(float to) { // min Gaussian curvature + repr->Kmin = to; + } + void Surface::set_Kmax(float to) { // max Gaussian curvature + repr->Kmax = to; + } + void Surface::set_Ktotal(double to) { // total Gaussian curvature + repr->Ktotal = to; + } + void Surface::set_nlabels(int to) { + repr->nlabels = to; + } + void Surface::set_labels(PMRIS_AREA_LABEL to) { // nlabels of these (may be null) + repr->labels = to; + } + void Surface::set_vp(p_void to) { // for misc. use + repr->vp = to; + } + void Surface::set_alpha(float to) { // rotation around z-axis + repr->alpha = to; + } + void Surface::set_beta(float to) { // rotation around y-axis + repr->beta = to; + } + void Surface::set_gamma(float to) { // rotation around x-axis + repr->gamma = to; + } + void Surface::set_da(float to) { + repr->da = to; + } + void Surface::set_db(float to) { + repr->db = to; + } + void Surface::set_dg(float to) { // old deltas + repr->dg = to; + } + void Surface::set_type(int to) { // what type of surface was this initially + repr->type = to; + } - } // namespace Analysis + } // namespace Distort - namespace ExistenceM { + namespace Analysis { Face::Face ( ) {} Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} Face::Face ( Face const & src ) : Repr_Elt(src) {} Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} + Vertex Face::v(size_t i) const { + return Vertex(repr,repr->f_v[idx][i]); + } + float Face::area() const { + return repr->f_area[idx]; + } + angles_per_triangle_t Face::angle() const { + return repr->f_angle[idx]; + } + angles_per_triangle_t Face::orig_angle() const { + return repr->f_orig_angle[idx]; + } char Face::ripflag() const { return repr->f_ripflag[idx]; } + char Face::oripflag() const { + return repr->f_oripflag[idx]; + } + int Face::marked() const { + return repr->f_marked[idx]; + } + PDMATRIX Face::norm() const { + return repr->f_norm[idx]; + } + A3PDMATRIX Face::gradNorm() const { + return repr->f_gradNorm[idx]; + } + void Face::set_orig_angle(angles_per_triangle_t to) { + repr->f_orig_angle[idx] = to; + } void Face::set_ripflag(char to) { repr->f_ripflag[idx] = to; } + void Face::set_oripflag(char to) { + repr->f_oripflag[idx] = to; + } + void Face::set_marked(int to) { + repr->f_marked[idx] = to; + } Vertex::Vertex ( ) {} @@ -1050,17 +2698,410 @@ namespace SurfaceFromMRISPV { Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} - char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache - return repr->v_ripflag[idx]; + Face Vertex::f(size_t i) const { // size() is num. array[v->num] the fno's of the neighboring faces + return Face(repr, repr->v_f[idx][i]); } - void Vertex::which_coords(int which, float *x, float *y, float *z) const { - - #define CASE(WHICH, FIELD) \ - case WHICH: \ + size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex + return repr->v_n[idx][i]; + } + int Vertex::e(size_t i) const { // edge state for neighboring vertices + return repr->v_e[idx][i]; + } + Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + return Vertex(repr,repr->v_v[idx][i]); + } + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) + return repr->v_vnum[idx]; + } + short Vertex::v2num() const { // number of 1, or 2-hop neighbors + return repr->v_v2num[idx]; + } + short Vertex::v3num() const { // number of 1,2,or 3-hop neighbors + return repr->v_v3num[idx]; + } + short Vertex::vtotal() const { // total # of neighbors. copy of vnum.nsizeCur + return repr->v_vtotal[idx]; + } + short Vertex::nsizeMaxClock() const { // copy of mris->nsizeMaxClock when v#num + return repr->v_nsizeMaxClock[idx]; + } + uchar Vertex::nsizeMax() const { // the max nsize that was used to fill in vnum etc + return repr->v_nsizeMax[idx]; + } + uchar Vertex::nsizeCur() const { // index of the current v#num in vtotal + return repr->v_nsizeCur[idx]; + } + uchar Vertex::num() const { // number of neighboring faces + return repr->v_num[idx]; + } + float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz + return repr->v_dist[idx][i]; + } + float Vertex::dist_orig(size_t i) const { // size() is vtotal. distance to neighboring vertices based on origxyz + return repr->v_dist_orig[idx][i]; + } + int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_capacity[idx]; + } + int Vertex::dist_orig_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_orig_capacity[idx]; + } + float Vertex::x() const { // current coordinates + return repr->v_x[idx]; + } + float Vertex::y() const { // use MRISsetXYZ() to set + return repr->v_y[idx]; + } + float Vertex::z() const { + return repr->v_z[idx]; + } + float Vertex::origx() const { // original coordinates, see also MRIS::origxyz_status + return repr->v_origx[idx]; + } + float Vertex::origy() const { // use MRISsetOriginalXYZ(, + return repr->v_origy[idx]; + } + float Vertex::origz() const { // or MRISsetOriginalXYZfromXYZ to set + return repr->v_origz[idx]; + } + float Vertex::nx() const { + return repr->v_nx[idx]; + } + float Vertex::ny() const { + return repr->v_ny[idx]; + } + float Vertex::nz() const { // curr normal + return repr->v_nz[idx]; + } + float Vertex::pnx() const { + return repr->v_pnx[idx]; + } + float Vertex::pny() const { + return repr->v_pny[idx]; + } + float Vertex::pnz() const { // pial normal + return repr->v_pnz[idx]; + } + float Vertex::wnx() const { + return repr->v_wnx[idx]; + } + float Vertex::wny() const { + return repr->v_wny[idx]; + } + float Vertex::wnz() const { // white normal + return repr->v_wnz[idx]; + } + float Vertex::onx() const { + return repr->v_onx[idx]; + } + float Vertex::ony() const { + return repr->v_ony[idx]; + } + float Vertex::onz() const { // original normal + return repr->v_onz[idx]; + } + float Vertex::dx() const { + return repr->v_dx[idx]; + } + float Vertex::dy() const { + return repr->v_dy[idx]; + } + float Vertex::dz() const { // current change in position + return repr->v_dz[idx]; + } + float Vertex::odx() const { + return repr->v_odx[idx]; + } + float Vertex::ody() const { + return repr->v_ody[idx]; + } + float Vertex::odz() const { // last change of position (for momentum, + return repr->v_odz[idx]; + } + float Vertex::tdx() const { + return repr->v_tdx[idx]; + } + float Vertex::tdy() const { + return repr->v_tdy[idx]; + } + float Vertex::tdz() const { // temporary storage for averaging gradient + return repr->v_tdz[idx]; + } + float Vertex::curv() const { // curr curvature + return repr->v_curv[idx]; + } + float Vertex::curvbak() const { + return repr->v_curvbak[idx]; + } + float Vertex::val() const { // scalar data value (file: rh.val, sig2-rh.w) + return repr->v_val[idx]; + } + float Vertex::imag_val() const { // imaginary part of complex data value + return repr->v_imag_val[idx]; + } + float Vertex::cx() const { + return repr->v_cx[idx]; + } + float Vertex::cy() const { + return repr->v_cy[idx]; + } + float Vertex::cz() const { // coordinates in canonical coordinate system + return repr->v_cz[idx]; + } + float Vertex::tx() const { + return repr->v_tx[idx]; + } + float Vertex::ty() const { + return repr->v_ty[idx]; + } + float Vertex::tz() const { // tmp coordinate storage + return repr->v_tz[idx]; + } + float Vertex::t2x() const { + return repr->v_t2x[idx]; + } + float Vertex::t2y() const { + return repr->v_t2y[idx]; + } + float Vertex::t2z() const { // another tmp coordinate storage + return repr->v_t2z[idx]; + } + float Vertex::targx() const { + return repr->v_targx[idx]; + } + float Vertex::targy() const { + return repr->v_targy[idx]; + } + float Vertex::targz() const { // target coordinates + return repr->v_targz[idx]; + } + float Vertex::pialx() const { + return repr->v_pialx[idx]; + } + float Vertex::pialy() const { + return repr->v_pialy[idx]; + } + float Vertex::pialz() const { // pial surface coordinates + return repr->v_pialz[idx]; + } + float Vertex::whitex() const { + return repr->v_whitex[idx]; + } + float Vertex::whitey() const { + return repr->v_whitey[idx]; + } + float Vertex::whitez() const { // white surface coordinates + return repr->v_whitez[idx]; + } + float Vertex::l4x() const { + return repr->v_l4x[idx]; + } + float Vertex::l4y() const { + return repr->v_l4y[idx]; + } + float Vertex::l4z() const { // layerIV surface coordinates + return repr->v_l4z[idx]; + } + float Vertex::infx() const { + return repr->v_infx[idx]; + } + float Vertex::infy() const { + return repr->v_infy[idx]; + } + float Vertex::infz() const { // inflated coordinates + return repr->v_infz[idx]; + } + float Vertex::fx() const { + return repr->v_fx[idx]; + } + float Vertex::fy() const { + return repr->v_fy[idx]; + } + float Vertex::fz() const { // flattened coordinates + return repr->v_fz[idx]; + } + int Vertex::px() const { + return repr->v_px[idx]; + } + int Vertex::qx() const { + return repr->v_qx[idx]; + } + int Vertex::py() const { + return repr->v_py[idx]; + } + int Vertex::qy() const { + return repr->v_qy[idx]; + } + int Vertex::pz() const { + return repr->v_pz[idx]; + } + int Vertex::qz() const { // rational coordinates for exact calculations + return repr->v_qz[idx]; + } + float Vertex::e1x() const { + return repr->v_e1x[idx]; + } + float Vertex::e1y() const { + return repr->v_e1y[idx]; + } + float Vertex::e1z() const { // 1st basis vector for the local tangent plane + return repr->v_e1z[idx]; + } + float Vertex::e2x() const { + return repr->v_e2x[idx]; + } + float Vertex::e2y() const { + return repr->v_e2y[idx]; + } + float Vertex::e2z() const { // 2nd basis vector for the local tangent plane + return repr->v_e2z[idx]; + } + float Vertex::pe1x() const { + return repr->v_pe1x[idx]; + } + float Vertex::pe1y() const { + return repr->v_pe1y[idx]; + } + float Vertex::pe1z() const { // 1st basis vector for the local tangent plane + return repr->v_pe1z[idx]; + } + float Vertex::pe2x() const { + return repr->v_pe2x[idx]; + } + float Vertex::pe2y() const { + return repr->v_pe2y[idx]; + } + float Vertex::pe2z() const { // 2nd basis vector for the local tangent plane + return repr->v_pe2z[idx]; + } + float Vertex::nc() const { // curr length normal comp + return repr->v_nc[idx]; + } + float Vertex::val2() const { // complex comp data value (file: sig3-rh.w) + return repr->v_val2[idx]; + } + float Vertex::valbak() const { // scalar data stack + return repr->v_valbak[idx]; + } + float Vertex::val2bak() const { // complex comp data stack + return repr->v_val2bak[idx]; + } + float Vertex::stat() const { // statistic + return repr->v_stat[idx]; + } + int Vertex::undefval() const { // [previously dist=0] + return repr->v_undefval[idx]; + } + int Vertex::old_undefval() const { // for smooth_val_sparse + return repr->v_old_undefval[idx]; + } + int Vertex::fixedval() const { // [previously val=0] + return repr->v_fixedval[idx]; + } + float Vertex::fieldsign() const { // fieldsign--final: -1, "0", "1" (file: rh.fs) + return repr->v_fieldsign[idx]; + } + float Vertex::fsmask() const { // significance mask (file: rh.fm) + return repr->v_fsmask[idx]; + } + float Vertex::d() const { // for distance calculations + return repr->v_d[idx]; + } + int Vertex::annotation() const { // area label (defunct--now from label file name!) + return repr->v_annotation[idx]; + } + char Vertex::oripflag() const { + return repr->v_oripflag[idx]; + } + char Vertex::origripflag() const { // cuts flags + return repr->v_origripflag[idx]; + } + p_void Vertex::vp() const { // to store user's information + return repr->v_vp[idx]; + } + float Vertex::theta() const { + return repr->v_theta[idx]; + } + float Vertex::phi() const { // parameterization + return repr->v_phi[idx]; + } + float Vertex::area() const { + return repr->v_area[idx]; + } + float Vertex::origarea() const { + return repr->v_origarea[idx]; + } + float Vertex::group_avg_area() const { + return repr->v_group_avg_area[idx]; + } + float Vertex::K() const { // Gaussian curvature + return repr->v_K[idx]; + } + float Vertex::H() const { // mean curvature + return repr->v_H[idx]; + } + float Vertex::k1() const { + return repr->v_k1[idx]; + } + float Vertex::k2() const { // the principal curvatures + return repr->v_k2[idx]; + } + float Vertex::mean() const { + return repr->v_mean[idx]; + } + float Vertex::mean_imag() const { // imaginary part of complex statistic + return repr->v_mean_imag[idx]; + } + float Vertex::std_error() const { + return repr->v_std_error[idx]; + } + uint Vertex::flags() const { + return repr->v_flags[idx]; + } + int Vertex::fno() const { // face that this vertex is in + return repr->v_fno[idx]; + } + int Vertex::cropped() const { + return repr->v_cropped[idx]; + } + short Vertex::marked() const { // for a variety of uses + return repr->v_marked[idx]; + } + short Vertex::marked2() const { + return repr->v_marked2[idx]; + } + short Vertex::marked3() const { + return repr->v_marked3[idx]; + } + char Vertex::neg() const { // 1 if the normal vector is inverted + return repr->v_neg[idx]; + } + char Vertex::border() const { // flag + return repr->v_border[idx]; + } + char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache + return repr->v_ripflag[idx]; + } + void Vertex::which_coords(int which, float *x, float *y, float *z) const { + + #define CASE(WHICH, FIELD) \ + case WHICH: \ *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ break; switch (which) { + CASE(CURRENT_VERTICES,) + CASE(ORIGINAL_VERTICES,orig) + CASE(VERTEX_NORMALS,n) + CASE(PIAL_NORMALS,pn) + CASE(WHITE_NORMALS,wn) + CASE(CANONICAL_VERTICES,c) + CASE(TMP_VERTICES,t) + CASE(TMP2_VERTICES,t2) + CASE(PIAL_VERTICES,pial) + CASE(WHITE_VERTICES,white) + CASE(INFLATED_VERTICES,inf) + CASE(FLATTENED_VERTICES,f) default: *x = *y = *z = 0.0; ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); @@ -1069,69 +3110,3775 @@ namespace SurfaceFromMRISPV { #undef CASE } - - void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache - repr->v_ripflag[idx] = to; + + void Vertex::set_f(size_t i, Face to) { // size() is num. array[v->num] the fno's of the neighboring faces + cheapAssert(repr == to.repr); repr->v_f[idx][i] = to.idx; + } + void Vertex::set_n(size_t i, size_t to) { // size() is num. array[v->num] the face.v[*] index for this vertex + repr->v_n[idx][i] = uchar(to); + } + void Vertex::set_e(size_t i, int to) { // edge state for neighboring vertices + repr->v_e[idx][i] = to; + } + void Vertex::set_nx(float to) { + repr->v_nx[idx] = to; + } + void Vertex::set_ny(float to) { + repr->v_ny[idx] = to; + } + void Vertex::set_nz(float to) { // curr normal + repr->v_nz[idx] = to; + } + void Vertex::set_pnx(float to) { + repr->v_pnx[idx] = to; + } + void Vertex::set_pny(float to) { + repr->v_pny[idx] = to; + } + void Vertex::set_pnz(float to) { // pial normal + repr->v_pnz[idx] = to; + } + void Vertex::set_wnx(float to) { + repr->v_wnx[idx] = to; + } + void Vertex::set_wny(float to) { + repr->v_wny[idx] = to; + } + void Vertex::set_wnz(float to) { // white normal + repr->v_wnz[idx] = to; + } + void Vertex::set_onx(float to) { + repr->v_onx[idx] = to; + } + void Vertex::set_ony(float to) { + repr->v_ony[idx] = to; + } + void Vertex::set_onz(float to) { // original normal + repr->v_onz[idx] = to; + } + void Vertex::set_dx(float to) { + repr->v_dx[idx] = to; + } + void Vertex::set_dy(float to) { + repr->v_dy[idx] = to; + } + void Vertex::set_dz(float to) { // current change in position + repr->v_dz[idx] = to; + } + void Vertex::set_odx(float to) { + repr->v_odx[idx] = to; + } + void Vertex::set_ody(float to) { + repr->v_ody[idx] = to; + } + void Vertex::set_odz(float to) { // last change of position (for momentum, + repr->v_odz[idx] = to; + } + void Vertex::set_tdx(float to) { + repr->v_tdx[idx] = to; + } + void Vertex::set_tdy(float to) { + repr->v_tdy[idx] = to; + } + void Vertex::set_tdz(float to) { // temporary storage for averaging gradient + repr->v_tdz[idx] = to; + } + void Vertex::set_curv(float to) { // curr curvature + repr->v_curv[idx] = to; + } + void Vertex::set_curvbak(float to) { + repr->v_curvbak[idx] = to; + } + void Vertex::set_val(float to) { // scalar data value (file: rh.val, sig2-rh.w) + repr->v_val[idx] = to; + } + void Vertex::set_imag_val(float to) { // imaginary part of complex data value + repr->v_imag_val[idx] = to; + } + void Vertex::set_cx(float to) { + repr->v_cx[idx] = to; + } + void Vertex::set_cy(float to) { + repr->v_cy[idx] = to; + } + void Vertex::set_cz(float to) { // coordinates in canonical coordinate system + repr->v_cz[idx] = to; + } + void Vertex::set_tx(float to) { + repr->v_tx[idx] = to; + } + void Vertex::set_ty(float to) { + repr->v_ty[idx] = to; + } + void Vertex::set_tz(float to) { // tmp coordinate storage + repr->v_tz[idx] = to; + } + void Vertex::set_t2x(float to) { + repr->v_t2x[idx] = to; + } + void Vertex::set_t2y(float to) { + repr->v_t2y[idx] = to; + } + void Vertex::set_t2z(float to) { // another tmp coordinate storage + repr->v_t2z[idx] = to; + } + void Vertex::set_targx(float to) { + repr->v_targx[idx] = to; + } + void Vertex::set_targy(float to) { + repr->v_targy[idx] = to; + } + void Vertex::set_targz(float to) { // target coordinates + repr->v_targz[idx] = to; + } + void Vertex::set_pialx(float to) { + repr->v_pialx[idx] = to; + } + void Vertex::set_pialy(float to) { + repr->v_pialy[idx] = to; + } + void Vertex::set_pialz(float to) { // pial surface coordinates + repr->v_pialz[idx] = to; + } + void Vertex::set_whitex(float to) { + repr->v_whitex[idx] = to; + } + void Vertex::set_whitey(float to) { + repr->v_whitey[idx] = to; + } + void Vertex::set_whitez(float to) { // white surface coordinates + repr->v_whitez[idx] = to; + } + void Vertex::set_l4x(float to) { + repr->v_l4x[idx] = to; + } + void Vertex::set_l4y(float to) { + repr->v_l4y[idx] = to; + } + void Vertex::set_l4z(float to) { // layerIV surface coordinates + repr->v_l4z[idx] = to; + } + void Vertex::set_infx(float to) { + repr->v_infx[idx] = to; + } + void Vertex::set_infy(float to) { + repr->v_infy[idx] = to; + } + void Vertex::set_infz(float to) { // inflated coordinates + repr->v_infz[idx] = to; + } + void Vertex::set_fx(float to) { + repr->v_fx[idx] = to; + } + void Vertex::set_fy(float to) { + repr->v_fy[idx] = to; + } + void Vertex::set_fz(float to) { // flattened coordinates + repr->v_fz[idx] = to; + } + void Vertex::set_px(int to) { + repr->v_px[idx] = to; + } + void Vertex::set_qx(int to) { + repr->v_qx[idx] = to; + } + void Vertex::set_py(int to) { + repr->v_py[idx] = to; + } + void Vertex::set_qy(int to) { + repr->v_qy[idx] = to; + } + void Vertex::set_pz(int to) { + repr->v_pz[idx] = to; + } + void Vertex::set_qz(int to) { // rational coordinates for exact calculations + repr->v_qz[idx] = to; + } + void Vertex::set_e1x(float to) { + repr->v_e1x[idx] = to; + } + void Vertex::set_e1y(float to) { + repr->v_e1y[idx] = to; + } + void Vertex::set_e1z(float to) { // 1st basis vector for the local tangent plane + repr->v_e1z[idx] = to; + } + void Vertex::set_e2x(float to) { + repr->v_e2x[idx] = to; + } + void Vertex::set_e2y(float to) { + repr->v_e2y[idx] = to; + } + void Vertex::set_e2z(float to) { // 2nd basis vector for the local tangent plane + repr->v_e2z[idx] = to; + } + void Vertex::set_pe1x(float to) { + repr->v_pe1x[idx] = to; + } + void Vertex::set_pe1y(float to) { + repr->v_pe1y[idx] = to; + } + void Vertex::set_pe1z(float to) { // 1st basis vector for the local tangent plane + repr->v_pe1z[idx] = to; + } + void Vertex::set_pe2x(float to) { + repr->v_pe2x[idx] = to; + } + void Vertex::set_pe2y(float to) { + repr->v_pe2y[idx] = to; + } + void Vertex::set_pe2z(float to) { // 2nd basis vector for the local tangent plane + repr->v_pe2z[idx] = to; + } + void Vertex::set_nc(float to) { // curr length normal comp + repr->v_nc[idx] = to; + } + void Vertex::set_val2(float to) { // complex comp data value (file: sig3-rh.w) + repr->v_val2[idx] = to; + } + void Vertex::set_valbak(float to) { // scalar data stack + repr->v_valbak[idx] = to; + } + void Vertex::set_val2bak(float to) { // complex comp data stack + repr->v_val2bak[idx] = to; + } + void Vertex::set_stat(float to) { // statistic + repr->v_stat[idx] = to; + } + void Vertex::set_undefval(int to) { // [previously dist=0] + repr->v_undefval[idx] = to; + } + void Vertex::set_old_undefval(int to) { // for smooth_val_sparse + repr->v_old_undefval[idx] = to; + } + void Vertex::set_fixedval(int to) { // [previously val=0] + repr->v_fixedval[idx] = to; + } + void Vertex::set_fieldsign(float to) { // fieldsign--final: -1, "0", "1" (file: rh.fs) + repr->v_fieldsign[idx] = to; + } + void Vertex::set_fsmask(float to) { // significance mask (file: rh.fm) + repr->v_fsmask[idx] = to; + } + void Vertex::set_d(float to) { // for distance calculations + repr->v_d[idx] = to; + } + void Vertex::set_annotation(int to) { // area label (defunct--now from label file name!) + repr->v_annotation[idx] = to; + } + void Vertex::set_oripflag(char to) { + repr->v_oripflag[idx] = to; + } + void Vertex::set_origripflag(char to) { // cuts flags + repr->v_origripflag[idx] = to; + } + void Vertex::set_vp(p_void to) { // to store user's information + repr->v_vp[idx] = to; + } + void Vertex::set_theta(float to) { + repr->v_theta[idx] = to; + } + void Vertex::set_phi(float to) { // parameterization + repr->v_phi[idx] = to; + } + void Vertex::set_origarea(float to) { + repr->v_origarea[idx] = to; + } + void Vertex::set_group_avg_area(float to) { + repr->v_group_avg_area[idx] = to; + } + void Vertex::set_K(float to) { // Gaussian curvature + repr->v_K[idx] = to; + } + void Vertex::set_H(float to) { // mean curvature + repr->v_H[idx] = to; + } + void Vertex::set_k1(float to) { + repr->v_k1[idx] = to; + } + void Vertex::set_k2(float to) { // the principal curvatures + repr->v_k2[idx] = to; + } + void Vertex::set_mean(float to) { + repr->v_mean[idx] = to; + } + void Vertex::set_mean_imag(float to) { // imaginary part of complex statistic + repr->v_mean_imag[idx] = to; + } + void Vertex::set_std_error(float to) { + repr->v_std_error[idx] = to; + } + void Vertex::set_flags(uint to) { + repr->v_flags[idx] = to; + } + void Vertex::set_fno(int to) { // face that this vertex is in + repr->v_fno[idx] = to; + } + void Vertex::set_cropped(int to) { + repr->v_cropped[idx] = to; + } + void Vertex::set_marked(short to) { // for a variety of uses + repr->v_marked[idx] = to; + } + void Vertex::set_marked2(short to) { + repr->v_marked2[idx] = to; + } + void Vertex::set_marked3(short to) { + repr->v_marked3[idx] = to; + } + void Vertex::set_neg(char to) { // 1 if the normal vector is inverted + repr->v_neg[idx] = to; + } + void Vertex::set_border(char to) { // flag + repr->v_border[idx] = to; + } + void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache + repr->v_ripflag[idx] = to; + } + + + Surface::Surface ( ) {} + Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} + Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + + int Surface::nverticesFrozen() const { // # of vertices on surface is frozen + return repr->nverticesFrozen; + } + int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nvertices; + } + int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nfaces; + } + bool Surface::faceAttachmentDeferred() const { // defer connecting faces to vertices for performance reasons + return repr->faceAttachmentDeferred; + } + int Surface::nedges() const { // # of edges on surface + return repr->nedges; + } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } + int Surface::nstrips() const { + return repr->nstrips; + } + Vertex Surface::vertices(size_t i) const { + return Vertex(repr, i); + } + p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + return repr->dist_storage; + } + p_p_void Surface::dist_orig_storage() const { // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + return repr->dist_orig_storage; + } + int Surface::tempsAssigned() const { // State of various temp fields that can be borrowed if not already in use + return repr->tempsAssigned; + } + Face Surface::faces(size_t i) const { + return Face(repr, i); + } + MRI_EDGE Surface::edges(size_t i) const { + return repr->edges[i]; + } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + STRIP Surface::strips(size_t i) const { + return repr->strips[i]; + } + float Surface::xctr() const { + return repr->xctr; + } + float Surface::yctr() const { + return repr->yctr; + } + float Surface::zctr() const { + return repr->zctr; + } + float Surface::xlo() const { + return repr->xlo; + } + float Surface::ylo() const { + return repr->ylo; + } + float Surface::zlo() const { + return repr->zlo; + } + float Surface::xhi() const { + return repr->xhi; + } + float Surface::yhi() const { + return repr->yhi; + } + float Surface::zhi() const { + return repr->zhi; + } + float Surface::x0() const { // center of spherical expansion + return repr->x0; + } + float Surface::y0() const { + return repr->y0; + } + float Surface::z0() const { + return repr->z0; + } + float Surface::max_curv() const { + return repr->max_curv; + } + float Surface::min_curv() const { + return repr->min_curv; + } + float Surface::total_area() const { + return repr->total_area; + } + double Surface::avg_vertex_area() const { + return repr->avg_vertex_area; + } + double Surface::avg_vertex_dist() const { // set by MRIScomputeAvgInterVertexDist + return repr->avg_vertex_dist; + } + double Surface::std_vertex_dist() const { + return repr->std_vertex_dist; + } + float Surface::orig_area() const { + return repr->orig_area; + } + float Surface::neg_area() const { + return repr->neg_area; + } + float Surface::neg_orig_area() const { // amount of original surface in folds + return repr->neg_orig_area; + } + int Surface::zeros() const { + return repr->zeros; + } + int Surface::hemisphere() const { // which hemisphere + return repr->hemisphere; + } + int Surface::initialized() const { + return repr->initialized; + } + PLTA Surface::lta() const { + return repr->lta; + } + PMATRIX Surface::SRASToTalSRAS_() const { + return repr->SRASToTalSRAS_; + } + PMATRIX Surface::TalSRASToSRAS_() const { + return repr->TalSRASToSRAS_; + } + int Surface::free_transform() const { + return repr->free_transform; + } + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; + } + float Surface::a() const { + return repr->a; + } + float Surface::b() const { + return repr->b; + } + float Surface::c() const { // ellipsoid parameters + return repr->c; + } + MRIS_fname_t Surface::fname() const { // file it was originally loaded from + return repr->fname; + } + float Surface::Hmin() const { // min mean curvature + return repr->Hmin; + } + float Surface::Hmax() const { // max mean curvature + return repr->Hmax; + } + float Surface::Kmin() const { // min Gaussian curvature + return repr->Kmin; + } + float Surface::Kmax() const { // max Gaussian curvature + return repr->Kmax; + } + double Surface::Ktotal() const { // total Gaussian curvature + return repr->Ktotal; + } + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->status; + } + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; + } + int Surface::patch() const { // if a patch of the surface + return repr->patch; + } + int Surface::nlabels() const { + return repr->nlabels; + } + PMRIS_AREA_LABEL Surface::labels() const { // nlabels of these (may be null) + return repr->labels; + } + p_void Surface::vp() const { // for misc. use + return repr->vp; + } + float Surface::alpha() const { // rotation around z-axis + return repr->alpha; + } + float Surface::beta() const { // rotation around y-axis + return repr->beta; + } + float Surface::gamma() const { // rotation around x-axis + return repr->gamma; + } + float Surface::da() const { + return repr->da; + } + float Surface::db() const { + return repr->db; + } + float Surface::dg() const { // old deltas + return repr->dg; + } + int Surface::type() const { // what type of surface was this initially + return repr->type; + } + int Surface::max_vertices() const { // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + return repr->max_vertices; + } + int Surface::max_faces() const { // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + return repr->max_faces; + } + MRIS_subject_name_t Surface::subject_name() const { // name of the subject + return repr->subject_name; + } + float Surface::canon_area() const { + return repr->canon_area; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->noscale; + } + float Surface::dx2(size_t i) const { // an extra set of gradient (not always alloced) + return repr->dx2[i]; + } + float Surface::dy2(size_t i) const { + return repr->dy2[i]; + } + float Surface::dz2(size_t i) const { + return repr->dz2[i]; + } + PCOLOR_TABLE Surface::ct() const { + return repr->ct; + } + int Surface::useRealRAS() const { // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + return repr->useRealRAS; + } + VOL_GEOM Surface::vg() const { // volume info from which this surface is created. valid iff vg.valid = 1 + return repr->vg; + } + MRIS_cmdlines_t Surface::cmdlines() const { + return repr->cmdlines; + } + int Surface::ncmds() const { + return repr->ncmds; + } + float Surface::group_avg_surface_area() const { // average of total surface area for group + return repr->group_avg_surface_area; + } + int Surface::group_avg_vtxarea_loaded() const { // average vertex area for group at each vertex + return repr->group_avg_vtxarea_loaded; + } + int Surface::triangle_links_removed() const { // for quad surfaces + return repr->triangle_links_removed; + } + p_void Surface::user_parms() const { // for whatever the user wants to hang here + return repr->user_parms; + } + PMATRIX Surface::m_sras2vox() const { // for converting surface ras to voxel + return repr->m_sras2vox; + } + PMRI Surface::mri_sras2vox() const { // volume that the above matrix is for + return repr->mri_sras2vox; + } + p_void Surface::mht() const { + return repr->mht; + } + p_void Surface::temps() const { + return repr->temps; + } + + void Surface::set_strips(size_t i, STRIP to) { + repr->strips[i] = to; + } + void Surface::set_xctr(float to) { + repr->xctr = to; + } + void Surface::set_yctr(float to) { + repr->yctr = to; + } + void Surface::set_zctr(float to) { + repr->zctr = to; + } + void Surface::set_xlo(float to) { + repr->xlo = to; + } + void Surface::set_ylo(float to) { + repr->ylo = to; + } + void Surface::set_zlo(float to) { + repr->zlo = to; + } + void Surface::set_xhi(float to) { + repr->xhi = to; + } + void Surface::set_yhi(float to) { + repr->yhi = to; + } + void Surface::set_zhi(float to) { + repr->zhi = to; + } + void Surface::set_x0(float to) { // center of spherical expansion + repr->x0 = to; + } + void Surface::set_y0(float to) { + repr->y0 = to; + } + void Surface::set_z0(float to) { + repr->z0 = to; + } + void Surface::set_max_curv(float to) { + repr->max_curv = to; + } + void Surface::set_min_curv(float to) { + repr->min_curv = to; + } + void Surface::set_total_area(float to) { + repr->total_area = to; + } + void Surface::set_avg_vertex_area(double to) { + repr->avg_vertex_area = to; + } + void Surface::set_zeros(int to) { + repr->zeros = to; + } + void Surface::set_hemisphere(int to) { // which hemisphere + repr->hemisphere = to; + } + void Surface::set_Hmin(float to) { // min mean curvature + repr->Hmin = to; + } + void Surface::set_Hmax(float to) { // max mean curvature + repr->Hmax = to; + } + void Surface::set_Kmin(float to) { // min Gaussian curvature + repr->Kmin = to; + } + void Surface::set_Kmax(float to) { // max Gaussian curvature + repr->Kmax = to; + } + void Surface::set_Ktotal(double to) { // total Gaussian curvature + repr->Ktotal = to; + } + void Surface::set_nlabels(int to) { + repr->nlabels = to; + } + void Surface::set_labels(PMRIS_AREA_LABEL to) { // nlabels of these (may be null) + repr->labels = to; + } + void Surface::set_vp(p_void to) { // for misc. use + repr->vp = to; + } + void Surface::set_alpha(float to) { // rotation around z-axis + repr->alpha = to; + } + void Surface::set_beta(float to) { // rotation around y-axis + repr->beta = to; + } + void Surface::set_gamma(float to) { // rotation around x-axis + repr->gamma = to; + } + void Surface::set_da(float to) { + repr->da = to; + } + void Surface::set_db(float to) { + repr->db = to; + } + void Surface::set_dg(float to) { // old deltas + repr->dg = to; + } + void Surface::set_type(int to) { // what type of surface was this initially + repr->type = to; + } + + + } // namespace Analysis + + + namespace ExistenceM { + Face::Face ( ) {} + Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Face::Face ( Face const & src ) : Repr_Elt(src) {} + Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} + + char Face::ripflag() const { + return repr->f_ripflag[idx]; + } + char Face::oripflag() const { + return repr->f_oripflag[idx]; + } + int Face::marked() const { + return repr->f_marked[idx]; + } + + void Face::set_ripflag(char to) { + repr->f_ripflag[idx] = to; + } + void Face::set_oripflag(char to) { + repr->f_oripflag[idx] = to; + } + void Face::set_marked(int to) { + repr->f_marked[idx] = to; + } + + + Vertex::Vertex ( ) {} + Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} + + char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache + return repr->v_ripflag[idx]; + } + void Vertex::which_coords(int which, float *x, float *y, float *z) const { + + #define CASE(WHICH, FIELD) \ + case WHICH: \ + *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ + break; + + switch (which) { + default: + *x = *y = *z = 0.0; + ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); + break; + } + + #undef CASE + } + + void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache + repr->v_ripflag[idx] = to; + } + + + Surface::Surface ( ) {} + Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} + Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + + int Surface::initialized() const { + return repr->initialized; + } + PLTA Surface::lta() const { + return repr->lta; + } + PMATRIX Surface::SRASToTalSRAS_() const { + return repr->SRASToTalSRAS_; + } + PMATRIX Surface::TalSRASToSRAS_() const { + return repr->TalSRASToSRAS_; + } + int Surface::free_transform() const { + return repr->free_transform; + } + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; + } + float Surface::a() const { + return repr->a; + } + float Surface::b() const { + return repr->b; + } + float Surface::c() const { // ellipsoid parameters + return repr->c; + } + MRIS_fname_t Surface::fname() const { // file it was originally loaded from + return repr->fname; + } + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->status; + } + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; + } + int Surface::patch() const { // if a patch of the surface + return repr->patch; + } + int Surface::max_vertices() const { // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + return repr->max_vertices; + } + int Surface::max_faces() const { // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + return repr->max_faces; + } + MRIS_subject_name_t Surface::subject_name() const { // name of the subject + return repr->subject_name; + } + float Surface::canon_area() const { + return repr->canon_area; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->noscale; + } + float Surface::dx2(size_t i) const { // an extra set of gradient (not always alloced) + return repr->dx2[i]; + } + float Surface::dy2(size_t i) const { + return repr->dy2[i]; + } + float Surface::dz2(size_t i) const { + return repr->dz2[i]; + } + PCOLOR_TABLE Surface::ct() const { + return repr->ct; + } + int Surface::useRealRAS() const { // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + return repr->useRealRAS; + } + VOL_GEOM Surface::vg() const { // volume info from which this surface is created. valid iff vg.valid = 1 + return repr->vg; + } + MRIS_cmdlines_t Surface::cmdlines() const { + return repr->cmdlines; + } + int Surface::ncmds() const { + return repr->ncmds; + } + float Surface::group_avg_surface_area() const { // average of total surface area for group + return repr->group_avg_surface_area; + } + int Surface::group_avg_vtxarea_loaded() const { // average vertex area for group at each vertex + return repr->group_avg_vtxarea_loaded; + } + int Surface::triangle_links_removed() const { // for quad surfaces + return repr->triangle_links_removed; + } + p_void Surface::user_parms() const { // for whatever the user wants to hang here + return repr->user_parms; + } + PMATRIX Surface::m_sras2vox() const { // for converting surface ras to voxel + return repr->m_sras2vox; + } + PMRI Surface::mri_sras2vox() const { // volume that the above matrix is for + return repr->mri_sras2vox; + } + p_void Surface::mht() const { + return repr->mht; + } + p_void Surface::temps() const { + return repr->temps; + } + + void Surface::set_fname(MRIS_fname_t to) { // file it was originally loaded from + repr->fname = to; + } + void Surface::set_status(MRIS_Status to) { // type of surface (e.g. sphere, plane) + repr->status = to; + } + void Surface::set_origxyz_status(MRIS_Status to) { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + repr->origxyz_status = to; + } + void Surface::set_patch(int to) { // if a patch of the surface + repr->patch = to; + } + + + } // namespace ExistenceM + + + namespace TopologyM { + Face::Face ( ) {} + Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Face::Face ( Face const & src ) : Repr_Elt(src) {} + Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} + + Vertex Face::v(size_t i) const { + return Vertex(repr,repr->f_v[idx][i]); + } + char Face::ripflag() const { + return repr->f_ripflag[idx]; + } + char Face::oripflag() const { + return repr->f_oripflag[idx]; + } + int Face::marked() const { + return repr->f_marked[idx]; + } + + void Face::set_v(size_t i, Vertex to) { + cheapAssert(repr == to.repr); repr->f_v[idx][i] = to.idx; + } + void Face::set_ripflag(char to) { + repr->f_ripflag[idx] = to; + } + void Face::set_oripflag(char to) { + repr->f_oripflag[idx] = to; + } + void Face::set_marked(int to) { + repr->f_marked[idx] = to; + } + + + Vertex::Vertex ( ) {} + Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} + + Face Vertex::f(size_t i) const { // size() is num. array[v->num] the fno's of the neighboring faces + return Face(repr, repr->v_f[idx][i]); + } + size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex + return repr->v_n[idx][i]; + } + int Vertex::e(size_t i) const { // edge state for neighboring vertices + return repr->v_e[idx][i]; + } + Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + return Vertex(repr,repr->v_v[idx][i]); + } + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) + return repr->v_vnum[idx]; + } + short Vertex::v2num() const { // number of 1, or 2-hop neighbors + return repr->v_v2num[idx]; + } + short Vertex::v3num() const { // number of 1,2,or 3-hop neighbors + return repr->v_v3num[idx]; + } + short Vertex::vtotal() const { // total # of neighbors. copy of vnum.nsizeCur + return repr->v_vtotal[idx]; + } + short Vertex::nsizeMaxClock() const { // copy of mris->nsizeMaxClock when v#num + return repr->v_nsizeMaxClock[idx]; + } + uchar Vertex::nsizeMax() const { // the max nsize that was used to fill in vnum etc + return repr->v_nsizeMax[idx]; + } + uchar Vertex::nsizeCur() const { // index of the current v#num in vtotal + return repr->v_nsizeCur[idx]; + } + uchar Vertex::num() const { // number of neighboring faces + return repr->v_num[idx]; + } + char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache + return repr->v_ripflag[idx]; + } + void Vertex::which_coords(int which, float *x, float *y, float *z) const { + + #define CASE(WHICH, FIELD) \ + case WHICH: \ + *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ + break; + + switch (which) { + default: + *x = *y = *z = 0.0; + ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); + break; + } + + #undef CASE + } + + void Vertex::set_f(size_t i, Face to) { // size() is num. array[v->num] the fno's of the neighboring faces + cheapAssert(repr == to.repr); repr->v_f[idx][i] = to.idx; + } + void Vertex::set_n(size_t i, size_t to) { // size() is num. array[v->num] the face.v[*] index for this vertex + repr->v_n[idx][i] = uchar(to); + } + void Vertex::set_e(size_t i, int to) { // edge state for neighboring vertices + repr->v_e[idx][i] = to; + } + void Vertex::set_v(size_t i, Vertex to) { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + cheapAssert(repr == to.repr); repr->v_v[idx][i] = to.idx; + } + void Vertex::set_vnum(short to) { // number of 1-hop neighbors should use [p]VERTEXvnum(i) + repr->v_vnum[idx] = to; + } + void Vertex::set_v2num(short to) { // number of 1, or 2-hop neighbors + repr->v_v2num[idx] = to; + } + void Vertex::set_v3num(short to) { // number of 1,2,or 3-hop neighbors + repr->v_v3num[idx] = to; + } + void Vertex::set_vtotal(short to) { // total # of neighbors. copy of vnum.nsizeCur + repr->v_vtotal[idx] = to; + } + void Vertex::set_nsizeMaxClock(short to) { // copy of mris->nsizeMaxClock when v#num + repr->v_nsizeMaxClock[idx] = to; + } + void Vertex::set_nsizeMax(uchar to) { // the max nsize that was used to fill in vnum etc + repr->v_nsizeMax[idx] = to; + } + void Vertex::set_nsizeCur(uchar to) { // index of the current v#num in vtotal + repr->v_nsizeCur[idx] = to; + } + void Vertex::set_num(uchar to) { // number of neighboring faces + repr->v_num[idx] = to; + } + void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache + repr->v_ripflag[idx] = to; + } + + + Surface::Surface ( ) {} + Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} + Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + + int Surface::nverticesFrozen() const { // # of vertices on surface is frozen + return repr->nverticesFrozen; + } + int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nvertices; + } + int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nfaces; + } + bool Surface::faceAttachmentDeferred() const { // defer connecting faces to vertices for performance reasons + return repr->faceAttachmentDeferred; + } + int Surface::nedges() const { // # of edges on surface + return repr->nedges; + } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } + int Surface::nstrips() const { + return repr->nstrips; + } + Vertex Surface::vertices(size_t i) const { + return Vertex(repr, i); + } + p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + return repr->dist_storage; + } + p_p_void Surface::dist_orig_storage() const { // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + return repr->dist_orig_storage; + } + int Surface::tempsAssigned() const { // State of various temp fields that can be borrowed if not already in use + return repr->tempsAssigned; + } + Face Surface::faces(size_t i) const { + return Face(repr, i); + } + MRI_EDGE Surface::edges(size_t i) const { + return repr->edges[i]; + } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + int Surface::initialized() const { + return repr->initialized; + } + PLTA Surface::lta() const { + return repr->lta; + } + PMATRIX Surface::SRASToTalSRAS_() const { + return repr->SRASToTalSRAS_; + } + PMATRIX Surface::TalSRASToSRAS_() const { + return repr->TalSRASToSRAS_; + } + int Surface::free_transform() const { + return repr->free_transform; + } + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; + } + float Surface::a() const { + return repr->a; + } + float Surface::b() const { + return repr->b; + } + float Surface::c() const { // ellipsoid parameters + return repr->c; + } + MRIS_fname_t Surface::fname() const { // file it was originally loaded from + return repr->fname; + } + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->status; + } + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; + } + int Surface::patch() const { // if a patch of the surface + return repr->patch; + } + int Surface::max_vertices() const { // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + return repr->max_vertices; + } + int Surface::max_faces() const { // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + return repr->max_faces; + } + MRIS_subject_name_t Surface::subject_name() const { // name of the subject + return repr->subject_name; + } + float Surface::canon_area() const { + return repr->canon_area; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->noscale; + } + float Surface::dx2(size_t i) const { // an extra set of gradient (not always alloced) + return repr->dx2[i]; + } + float Surface::dy2(size_t i) const { + return repr->dy2[i]; + } + float Surface::dz2(size_t i) const { + return repr->dz2[i]; + } + PCOLOR_TABLE Surface::ct() const { + return repr->ct; + } + int Surface::useRealRAS() const { // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + return repr->useRealRAS; + } + VOL_GEOM Surface::vg() const { // volume info from which this surface is created. valid iff vg.valid = 1 + return repr->vg; + } + MRIS_cmdlines_t Surface::cmdlines() const { + return repr->cmdlines; + } + int Surface::ncmds() const { + return repr->ncmds; + } + float Surface::group_avg_surface_area() const { // average of total surface area for group + return repr->group_avg_surface_area; + } + int Surface::group_avg_vtxarea_loaded() const { // average vertex area for group at each vertex + return repr->group_avg_vtxarea_loaded; + } + int Surface::triangle_links_removed() const { // for quad surfaces + return repr->triangle_links_removed; + } + p_void Surface::user_parms() const { // for whatever the user wants to hang here + return repr->user_parms; + } + PMATRIX Surface::m_sras2vox() const { // for converting surface ras to voxel + return repr->m_sras2vox; + } + PMRI Surface::mri_sras2vox() const { // volume that the above matrix is for + return repr->mri_sras2vox; + } + p_void Surface::mht() const { + return repr->mht; + } + p_void Surface::temps() const { + return repr->temps; + } + + + } // namespace TopologyM + + + namespace XYZPositionM { + Face::Face ( ) {} + Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Face::Face ( Face const & src ) : Repr_Elt(src) {} + Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} + + Vertex Face::v(size_t i) const { + return Vertex(repr,repr->f_v[idx][i]); + } + char Face::ripflag() const { + return repr->f_ripflag[idx]; + } + char Face::oripflag() const { + return repr->f_oripflag[idx]; + } + int Face::marked() const { + return repr->f_marked[idx]; + } + + void Face::set_ripflag(char to) { + repr->f_ripflag[idx] = to; + } + void Face::set_oripflag(char to) { + repr->f_oripflag[idx] = to; + } + void Face::set_marked(int to) { + repr->f_marked[idx] = to; + } + + + Vertex::Vertex ( ) {} + Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} + + Face Vertex::f(size_t i) const { // size() is num. array[v->num] the fno's of the neighboring faces + return Face(repr, repr->v_f[idx][i]); + } + size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex + return repr->v_n[idx][i]; + } + int Vertex::e(size_t i) const { // edge state for neighboring vertices + return repr->v_e[idx][i]; + } + Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + return Vertex(repr,repr->v_v[idx][i]); + } + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) + return repr->v_vnum[idx]; + } + short Vertex::v2num() const { // number of 1, or 2-hop neighbors + return repr->v_v2num[idx]; + } + short Vertex::v3num() const { // number of 1,2,or 3-hop neighbors + return repr->v_v3num[idx]; + } + short Vertex::vtotal() const { // total # of neighbors. copy of vnum.nsizeCur + return repr->v_vtotal[idx]; + } + short Vertex::nsizeMaxClock() const { // copy of mris->nsizeMaxClock when v#num + return repr->v_nsizeMaxClock[idx]; + } + uchar Vertex::nsizeMax() const { // the max nsize that was used to fill in vnum etc + return repr->v_nsizeMax[idx]; + } + uchar Vertex::nsizeCur() const { // index of the current v#num in vtotal + return repr->v_nsizeCur[idx]; + } + uchar Vertex::num() const { // number of neighboring faces + return repr->v_num[idx]; + } + float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz + return repr->v_dist[idx][i]; + } + float Vertex::dist_orig(size_t i) const { // size() is vtotal. distance to neighboring vertices based on origxyz + return repr->v_dist_orig[idx][i]; + } + int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_capacity[idx]; + } + int Vertex::dist_orig_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_orig_capacity[idx]; + } + float Vertex::x() const { // current coordinates + return repr->v_x[idx]; + } + float Vertex::y() const { // use MRISsetXYZ() to set + return repr->v_y[idx]; + } + float Vertex::z() const { + return repr->v_z[idx]; + } + float Vertex::origx() const { // original coordinates, see also MRIS::origxyz_status + return repr->v_origx[idx]; + } + float Vertex::origy() const { // use MRISsetOriginalXYZ(, + return repr->v_origy[idx]; + } + float Vertex::origz() const { // or MRISsetOriginalXYZfromXYZ to set + return repr->v_origz[idx]; + } + float Vertex::cx() const { + return repr->v_cx[idx]; + } + float Vertex::cy() const { + return repr->v_cy[idx]; + } + float Vertex::cz() const { // coordinates in canonical coordinate system + return repr->v_cz[idx]; + } + char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache + return repr->v_ripflag[idx]; + } + void Vertex::which_coords(int which, float *x, float *y, float *z) const { + + #define CASE(WHICH, FIELD) \ + case WHICH: \ + *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ + break; + + switch (which) { + CASE(CURRENT_VERTICES,) + CASE(ORIGINAL_VERTICES,orig) + CASE(CANONICAL_VERTICES,c) + default: + *x = *y = *z = 0.0; + ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); + break; + } + + #undef CASE + } + + void Vertex::set_f(size_t i, Face to) { // size() is num. array[v->num] the fno's of the neighboring faces + cheapAssert(repr == to.repr); repr->v_f[idx][i] = to.idx; + } + void Vertex::set_n(size_t i, size_t to) { // size() is num. array[v->num] the face.v[*] index for this vertex + repr->v_n[idx][i] = uchar(to); + } + void Vertex::set_e(size_t i, int to) { // edge state for neighboring vertices + repr->v_e[idx][i] = to; + } + void Vertex::set_x(float to) { // current coordinates + repr->v_x[idx] = to; + } + void Vertex::set_y(float to) { // use MRISsetXYZ() to set + repr->v_y[idx] = to; + } + void Vertex::set_z(float to) { + repr->v_z[idx] = to; + } + void Vertex::set_cx(float to) { + repr->v_cx[idx] = to; + } + void Vertex::set_cy(float to) { + repr->v_cy[idx] = to; + } + void Vertex::set_cz(float to) { // coordinates in canonical coordinate system + repr->v_cz[idx] = to; + } + void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache + repr->v_ripflag[idx] = to; + } + + + Surface::Surface ( ) {} + Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} + Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + + int Surface::nverticesFrozen() const { // # of vertices on surface is frozen + return repr->nverticesFrozen; + } + int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nvertices; + } + int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nfaces; + } + bool Surface::faceAttachmentDeferred() const { // defer connecting faces to vertices for performance reasons + return repr->faceAttachmentDeferred; + } + int Surface::nedges() const { // # of edges on surface + return repr->nedges; + } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } + int Surface::nstrips() const { + return repr->nstrips; + } + Vertex Surface::vertices(size_t i) const { + return Vertex(repr, i); + } + p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + return repr->dist_storage; + } + p_p_void Surface::dist_orig_storage() const { // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + return repr->dist_orig_storage; + } + int Surface::tempsAssigned() const { // State of various temp fields that can be borrowed if not already in use + return repr->tempsAssigned; + } + Face Surface::faces(size_t i) const { + return Face(repr, i); + } + MRI_EDGE Surface::edges(size_t i) const { + return repr->edges[i]; + } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + int Surface::initialized() const { + return repr->initialized; + } + PLTA Surface::lta() const { + return repr->lta; + } + PMATRIX Surface::SRASToTalSRAS_() const { + return repr->SRASToTalSRAS_; + } + PMATRIX Surface::TalSRASToSRAS_() const { + return repr->TalSRASToSRAS_; + } + int Surface::free_transform() const { + return repr->free_transform; + } + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; + } + float Surface::a() const { + return repr->a; + } + float Surface::b() const { + return repr->b; + } + float Surface::c() const { // ellipsoid parameters + return repr->c; + } + MRIS_fname_t Surface::fname() const { // file it was originally loaded from + return repr->fname; + } + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->status; + } + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; + } + int Surface::patch() const { // if a patch of the surface + return repr->patch; + } + p_void Surface::vp() const { // for misc. use + return repr->vp; + } + float Surface::alpha() const { // rotation around z-axis + return repr->alpha; + } + float Surface::beta() const { // rotation around y-axis + return repr->beta; + } + float Surface::gamma() const { // rotation around x-axis + return repr->gamma; + } + float Surface::da() const { + return repr->da; + } + float Surface::db() const { + return repr->db; + } + float Surface::dg() const { // old deltas + return repr->dg; + } + int Surface::type() const { // what type of surface was this initially + return repr->type; + } + int Surface::max_vertices() const { // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + return repr->max_vertices; + } + int Surface::max_faces() const { // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + return repr->max_faces; + } + MRIS_subject_name_t Surface::subject_name() const { // name of the subject + return repr->subject_name; + } + float Surface::canon_area() const { + return repr->canon_area; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->noscale; + } + float Surface::dx2(size_t i) const { // an extra set of gradient (not always alloced) + return repr->dx2[i]; + } + float Surface::dy2(size_t i) const { + return repr->dy2[i]; + } + float Surface::dz2(size_t i) const { + return repr->dz2[i]; + } + PCOLOR_TABLE Surface::ct() const { + return repr->ct; + } + int Surface::useRealRAS() const { // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + return repr->useRealRAS; + } + VOL_GEOM Surface::vg() const { // volume info from which this surface is created. valid iff vg.valid = 1 + return repr->vg; + } + MRIS_cmdlines_t Surface::cmdlines() const { + return repr->cmdlines; + } + int Surface::ncmds() const { + return repr->ncmds; + } + float Surface::group_avg_surface_area() const { // average of total surface area for group + return repr->group_avg_surface_area; + } + int Surface::group_avg_vtxarea_loaded() const { // average vertex area for group at each vertex + return repr->group_avg_vtxarea_loaded; + } + int Surface::triangle_links_removed() const { // for quad surfaces + return repr->triangle_links_removed; + } + p_void Surface::user_parms() const { // for whatever the user wants to hang here + return repr->user_parms; + } + PMATRIX Surface::m_sras2vox() const { // for converting surface ras to voxel + return repr->m_sras2vox; + } + PMRI Surface::mri_sras2vox() const { // volume that the above matrix is for + return repr->mri_sras2vox; + } + p_void Surface::mht() const { + return repr->mht; + } + p_void Surface::temps() const { + return repr->temps; + } + + void Surface::set_vp(p_void to) { // for misc. use + repr->vp = to; + } + void Surface::set_alpha(float to) { // rotation around z-axis + repr->alpha = to; + } + void Surface::set_beta(float to) { // rotation around y-axis + repr->beta = to; + } + void Surface::set_gamma(float to) { // rotation around x-axis + repr->gamma = to; + } + void Surface::set_da(float to) { + repr->da = to; + } + void Surface::set_db(float to) { + repr->db = to; + } + void Surface::set_dg(float to) { // old deltas + repr->dg = to; + } + void Surface::set_type(int to) { // what type of surface was this initially + repr->type = to; + } + + + } // namespace XYZPositionM + + + namespace XYZPositionConsequencesM { + Face::Face ( ) {} + Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Face::Face ( Face const & src ) : Repr_Elt(src) {} + Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} + + Vertex Face::v(size_t i) const { + return Vertex(repr,repr->f_v[idx][i]); + } + float Face::area() const { + return repr->f_area[idx]; + } + angles_per_triangle_t Face::angle() const { + return repr->f_angle[idx]; + } + angles_per_triangle_t Face::orig_angle() const { + return repr->f_orig_angle[idx]; + } + char Face::ripflag() const { + return repr->f_ripflag[idx]; + } + char Face::oripflag() const { + return repr->f_oripflag[idx]; + } + int Face::marked() const { + return repr->f_marked[idx]; + } + PDMATRIX Face::norm() const { + return repr->f_norm[idx]; + } + A3PDMATRIX Face::gradNorm() const { + return repr->f_gradNorm[idx]; + } + + void Face::set_area(float to) { + repr->f_area[idx] = to; + } + void Face::set_angle(angles_per_triangle_t to) { + repr->f_angle[idx] = to; + } + void Face::set_orig_angle(angles_per_triangle_t to) { + repr->f_orig_angle[idx] = to; + } + void Face::set_ripflag(char to) { + repr->f_ripflag[idx] = to; + } + void Face::set_oripflag(char to) { + repr->f_oripflag[idx] = to; + } + void Face::set_marked(int to) { + repr->f_marked[idx] = to; + } + void Face::set_norm(PDMATRIX to) { + repr->f_norm[idx] = to; + } + void Face::set_gradNorm(A3PDMATRIX to) { + repr->f_gradNorm[idx] = to; + } + + + Vertex::Vertex ( ) {} + Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} + + Face Vertex::f(size_t i) const { // size() is num. array[v->num] the fno's of the neighboring faces + return Face(repr, repr->v_f[idx][i]); + } + size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex + return repr->v_n[idx][i]; + } + int Vertex::e(size_t i) const { // edge state for neighboring vertices + return repr->v_e[idx][i]; + } + Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + return Vertex(repr,repr->v_v[idx][i]); + } + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) + return repr->v_vnum[idx]; + } + short Vertex::v2num() const { // number of 1, or 2-hop neighbors + return repr->v_v2num[idx]; + } + short Vertex::v3num() const { // number of 1,2,or 3-hop neighbors + return repr->v_v3num[idx]; + } + short Vertex::vtotal() const { // total # of neighbors. copy of vnum.nsizeCur + return repr->v_vtotal[idx]; + } + short Vertex::nsizeMaxClock() const { // copy of mris->nsizeMaxClock when v#num + return repr->v_nsizeMaxClock[idx]; + } + uchar Vertex::nsizeMax() const { // the max nsize that was used to fill in vnum etc + return repr->v_nsizeMax[idx]; + } + uchar Vertex::nsizeCur() const { // index of the current v#num in vtotal + return repr->v_nsizeCur[idx]; + } + uchar Vertex::num() const { // number of neighboring faces + return repr->v_num[idx]; + } + float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz + return repr->v_dist[idx][i]; + } + float Vertex::dist_orig(size_t i) const { // size() is vtotal. distance to neighboring vertices based on origxyz + return repr->v_dist_orig[idx][i]; + } + int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_capacity[idx]; + } + int Vertex::dist_orig_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_orig_capacity[idx]; + } + float Vertex::x() const { // current coordinates + return repr->v_x[idx]; + } + float Vertex::y() const { // use MRISsetXYZ() to set + return repr->v_y[idx]; + } + float Vertex::z() const { + return repr->v_z[idx]; + } + float Vertex::origx() const { // original coordinates, see also MRIS::origxyz_status + return repr->v_origx[idx]; + } + float Vertex::origy() const { // use MRISsetOriginalXYZ(, + return repr->v_origy[idx]; + } + float Vertex::origz() const { // or MRISsetOriginalXYZfromXYZ to set + return repr->v_origz[idx]; + } + float Vertex::nx() const { + return repr->v_nx[idx]; + } + float Vertex::ny() const { + return repr->v_ny[idx]; + } + float Vertex::nz() const { // curr normal + return repr->v_nz[idx]; + } + float Vertex::cx() const { + return repr->v_cx[idx]; + } + float Vertex::cy() const { + return repr->v_cy[idx]; + } + float Vertex::cz() const { // coordinates in canonical coordinate system + return repr->v_cz[idx]; + } + float Vertex::area() const { + return repr->v_area[idx]; + } + char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache + return repr->v_ripflag[idx]; + } + void Vertex::which_coords(int which, float *x, float *y, float *z) const { + + #define CASE(WHICH, FIELD) \ + case WHICH: \ + *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ + break; + + switch (which) { + CASE(CURRENT_VERTICES,) + CASE(ORIGINAL_VERTICES,orig) + CASE(VERTEX_NORMALS,n) + CASE(CANONICAL_VERTICES,c) + default: + *x = *y = *z = 0.0; + ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); + break; + } + + #undef CASE + } + + void Vertex::set_f(size_t i, Face to) { // size() is num. array[v->num] the fno's of the neighboring faces + cheapAssert(repr == to.repr); repr->v_f[idx][i] = to.idx; + } + void Vertex::set_n(size_t i, size_t to) { // size() is num. array[v->num] the face.v[*] index for this vertex + repr->v_n[idx][i] = uchar(to); + } + void Vertex::set_e(size_t i, int to) { // edge state for neighboring vertices + repr->v_e[idx][i] = to; + } + void Vertex::set_nx(float to) { + repr->v_nx[idx] = to; + } + void Vertex::set_ny(float to) { + repr->v_ny[idx] = to; + } + void Vertex::set_nz(float to) { // curr normal + repr->v_nz[idx] = to; + } + void Vertex::set_cx(float to) { + repr->v_cx[idx] = to; + } + void Vertex::set_cy(float to) { + repr->v_cy[idx] = to; + } + void Vertex::set_cz(float to) { // coordinates in canonical coordinate system + repr->v_cz[idx] = to; + } + void Vertex::set_area(float to) { + repr->v_area[idx] = to; + } + void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache + repr->v_ripflag[idx] = to; + } + + + Surface::Surface ( ) {} + Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} + Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + + int Surface::nverticesFrozen() const { // # of vertices on surface is frozen + return repr->nverticesFrozen; + } + int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nvertices; + } + int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nfaces; + } + bool Surface::faceAttachmentDeferred() const { // defer connecting faces to vertices for performance reasons + return repr->faceAttachmentDeferred; + } + int Surface::nedges() const { // # of edges on surface + return repr->nedges; + } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } + int Surface::nstrips() const { + return repr->nstrips; + } + Vertex Surface::vertices(size_t i) const { + return Vertex(repr, i); + } + p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + return repr->dist_storage; + } + p_p_void Surface::dist_orig_storage() const { // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + return repr->dist_orig_storage; + } + int Surface::tempsAssigned() const { // State of various temp fields that can be borrowed if not already in use + return repr->tempsAssigned; + } + Face Surface::faces(size_t i) const { + return Face(repr, i); + } + MRI_EDGE Surface::edges(size_t i) const { + return repr->edges[i]; + } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + STRIP Surface::strips(size_t i) const { + return repr->strips[i]; + } + float Surface::xctr() const { + return repr->xctr; + } + float Surface::yctr() const { + return repr->yctr; + } + float Surface::zctr() const { + return repr->zctr; + } + float Surface::xlo() const { + return repr->xlo; + } + float Surface::ylo() const { + return repr->ylo; + } + float Surface::zlo() const { + return repr->zlo; + } + float Surface::xhi() const { + return repr->xhi; + } + float Surface::yhi() const { + return repr->yhi; + } + float Surface::zhi() const { + return repr->zhi; + } + float Surface::x0() const { // center of spherical expansion + return repr->x0; + } + float Surface::y0() const { + return repr->y0; + } + float Surface::z0() const { + return repr->z0; + } + float Surface::max_curv() const { + return repr->max_curv; + } + float Surface::min_curv() const { + return repr->min_curv; + } + float Surface::total_area() const { + return repr->total_area; + } + double Surface::avg_vertex_area() const { + return repr->avg_vertex_area; + } + double Surface::avg_vertex_dist() const { // set by MRIScomputeAvgInterVertexDist + return repr->avg_vertex_dist; + } + double Surface::std_vertex_dist() const { + return repr->std_vertex_dist; + } + float Surface::orig_area() const { + return repr->orig_area; + } + float Surface::neg_area() const { + return repr->neg_area; + } + float Surface::neg_orig_area() const { // amount of original surface in folds + return repr->neg_orig_area; + } + int Surface::zeros() const { + return repr->zeros; + } + int Surface::hemisphere() const { // which hemisphere + return repr->hemisphere; + } + int Surface::initialized() const { + return repr->initialized; + } + PLTA Surface::lta() const { + return repr->lta; + } + PMATRIX Surface::SRASToTalSRAS_() const { + return repr->SRASToTalSRAS_; + } + PMATRIX Surface::TalSRASToSRAS_() const { + return repr->TalSRASToSRAS_; + } + int Surface::free_transform() const { + return repr->free_transform; + } + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; + } + float Surface::a() const { + return repr->a; + } + float Surface::b() const { + return repr->b; + } + float Surface::c() const { // ellipsoid parameters + return repr->c; + } + MRIS_fname_t Surface::fname() const { // file it was originally loaded from + return repr->fname; + } + float Surface::Hmin() const { // min mean curvature + return repr->Hmin; + } + float Surface::Hmax() const { // max mean curvature + return repr->Hmax; + } + float Surface::Kmin() const { // min Gaussian curvature + return repr->Kmin; + } + float Surface::Kmax() const { // max Gaussian curvature + return repr->Kmax; + } + double Surface::Ktotal() const { // total Gaussian curvature + return repr->Ktotal; + } + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->status; + } + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; + } + int Surface::patch() const { // if a patch of the surface + return repr->patch; + } + int Surface::nlabels() const { + return repr->nlabels; + } + PMRIS_AREA_LABEL Surface::labels() const { // nlabels of these (may be null) + return repr->labels; + } + p_void Surface::vp() const { // for misc. use + return repr->vp; + } + float Surface::alpha() const { // rotation around z-axis + return repr->alpha; + } + float Surface::beta() const { // rotation around y-axis + return repr->beta; + } + float Surface::gamma() const { // rotation around x-axis + return repr->gamma; + } + float Surface::da() const { + return repr->da; + } + float Surface::db() const { + return repr->db; + } + float Surface::dg() const { // old deltas + return repr->dg; + } + int Surface::type() const { // what type of surface was this initially + return repr->type; + } + int Surface::max_vertices() const { // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + return repr->max_vertices; + } + int Surface::max_faces() const { // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + return repr->max_faces; + } + MRIS_subject_name_t Surface::subject_name() const { // name of the subject + return repr->subject_name; + } + float Surface::canon_area() const { + return repr->canon_area; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->noscale; + } + float Surface::dx2(size_t i) const { // an extra set of gradient (not always alloced) + return repr->dx2[i]; + } + float Surface::dy2(size_t i) const { + return repr->dy2[i]; + } + float Surface::dz2(size_t i) const { + return repr->dz2[i]; + } + PCOLOR_TABLE Surface::ct() const { + return repr->ct; + } + int Surface::useRealRAS() const { // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + return repr->useRealRAS; + } + VOL_GEOM Surface::vg() const { // volume info from which this surface is created. valid iff vg.valid = 1 + return repr->vg; + } + MRIS_cmdlines_t Surface::cmdlines() const { + return repr->cmdlines; + } + int Surface::ncmds() const { + return repr->ncmds; + } + float Surface::group_avg_surface_area() const { // average of total surface area for group + return repr->group_avg_surface_area; + } + int Surface::group_avg_vtxarea_loaded() const { // average vertex area for group at each vertex + return repr->group_avg_vtxarea_loaded; + } + int Surface::triangle_links_removed() const { // for quad surfaces + return repr->triangle_links_removed; + } + p_void Surface::user_parms() const { // for whatever the user wants to hang here + return repr->user_parms; + } + PMATRIX Surface::m_sras2vox() const { // for converting surface ras to voxel + return repr->m_sras2vox; + } + PMRI Surface::mri_sras2vox() const { // volume that the above matrix is for + return repr->mri_sras2vox; + } + p_void Surface::mht() const { + return repr->mht; + } + p_void Surface::temps() const { + return repr->temps; + } + + void Surface::set_strips(size_t i, STRIP to) { + repr->strips[i] = to; + } + void Surface::set_xctr(float to) { + repr->xctr = to; + } + void Surface::set_yctr(float to) { + repr->yctr = to; + } + void Surface::set_zctr(float to) { + repr->zctr = to; + } + void Surface::set_xlo(float to) { + repr->xlo = to; + } + void Surface::set_ylo(float to) { + repr->ylo = to; + } + void Surface::set_zlo(float to) { + repr->zlo = to; + } + void Surface::set_xhi(float to) { + repr->xhi = to; + } + void Surface::set_yhi(float to) { + repr->yhi = to; + } + void Surface::set_zhi(float to) { + repr->zhi = to; + } + void Surface::set_x0(float to) { // center of spherical expansion + repr->x0 = to; + } + void Surface::set_y0(float to) { + repr->y0 = to; + } + void Surface::set_z0(float to) { + repr->z0 = to; + } + void Surface::set_max_curv(float to) { + repr->max_curv = to; + } + void Surface::set_min_curv(float to) { + repr->min_curv = to; + } + void Surface::set_total_area(float to) { + repr->total_area = to; + } + void Surface::set_avg_vertex_area(double to) { + repr->avg_vertex_area = to; + } + void Surface::set_avg_vertex_dist(double to) { // set by MRIScomputeAvgInterVertexDist + repr->avg_vertex_dist = to; + } + void Surface::set_std_vertex_dist(double to) { + repr->std_vertex_dist = to; + } + void Surface::set_orig_area(float to) { + repr->orig_area = to; + } + void Surface::set_neg_area(float to) { + repr->neg_area = to; + } + void Surface::set_neg_orig_area(float to) { // amount of original surface in folds + repr->neg_orig_area = to; + } + void Surface::set_zeros(int to) { + repr->zeros = to; + } + void Surface::set_hemisphere(int to) { // which hemisphere + repr->hemisphere = to; + } + void Surface::set_Hmin(float to) { // min mean curvature + repr->Hmin = to; + } + void Surface::set_Hmax(float to) { // max mean curvature + repr->Hmax = to; + } + void Surface::set_Kmin(float to) { // min Gaussian curvature + repr->Kmin = to; + } + void Surface::set_Kmax(float to) { // max Gaussian curvature + repr->Kmax = to; + } + void Surface::set_Ktotal(double to) { // total Gaussian curvature + repr->Ktotal = to; + } + void Surface::set_nlabels(int to) { + repr->nlabels = to; + } + void Surface::set_labels(PMRIS_AREA_LABEL to) { // nlabels of these (may be null) + repr->labels = to; + } + void Surface::set_vp(p_void to) { // for misc. use + repr->vp = to; + } + void Surface::set_alpha(float to) { // rotation around z-axis + repr->alpha = to; + } + void Surface::set_beta(float to) { // rotation around y-axis + repr->beta = to; + } + void Surface::set_gamma(float to) { // rotation around x-axis + repr->gamma = to; + } + void Surface::set_da(float to) { + repr->da = to; + } + void Surface::set_db(float to) { + repr->db = to; + } + void Surface::set_dg(float to) { // old deltas + repr->dg = to; + } + void Surface::set_type(int to) { // what type of surface was this initially + repr->type = to; + } + + + } // namespace XYZPositionConsequencesM + + + namespace DistortM { + Face::Face ( ) {} + Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Face::Face ( Face const & src ) : Repr_Elt(src) {} + Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} + + Vertex Face::v(size_t i) const { + return Vertex(repr,repr->f_v[idx][i]); + } + float Face::area() const { + return repr->f_area[idx]; + } + angles_per_triangle_t Face::angle() const { + return repr->f_angle[idx]; + } + angles_per_triangle_t Face::orig_angle() const { + return repr->f_orig_angle[idx]; + } + char Face::ripflag() const { + return repr->f_ripflag[idx]; + } + char Face::oripflag() const { + return repr->f_oripflag[idx]; + } + int Face::marked() const { + return repr->f_marked[idx]; + } + PDMATRIX Face::norm() const { + return repr->f_norm[idx]; + } + A3PDMATRIX Face::gradNorm() const { + return repr->f_gradNorm[idx]; + } + + void Face::set_orig_angle(angles_per_triangle_t to) { + repr->f_orig_angle[idx] = to; + } + void Face::set_ripflag(char to) { + repr->f_ripflag[idx] = to; + } + void Face::set_oripflag(char to) { + repr->f_oripflag[idx] = to; + } + void Face::set_marked(int to) { + repr->f_marked[idx] = to; + } + + + Vertex::Vertex ( ) {} + Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} + + Face Vertex::f(size_t i) const { // size() is num. array[v->num] the fno's of the neighboring faces + return Face(repr, repr->v_f[idx][i]); + } + size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex + return repr->v_n[idx][i]; + } + int Vertex::e(size_t i) const { // edge state for neighboring vertices + return repr->v_e[idx][i]; + } + Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + return Vertex(repr,repr->v_v[idx][i]); + } + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) + return repr->v_vnum[idx]; + } + short Vertex::v2num() const { // number of 1, or 2-hop neighbors + return repr->v_v2num[idx]; + } + short Vertex::v3num() const { // number of 1,2,or 3-hop neighbors + return repr->v_v3num[idx]; + } + short Vertex::vtotal() const { // total # of neighbors. copy of vnum.nsizeCur + return repr->v_vtotal[idx]; + } + short Vertex::nsizeMaxClock() const { // copy of mris->nsizeMaxClock when v#num + return repr->v_nsizeMaxClock[idx]; + } + uchar Vertex::nsizeMax() const { // the max nsize that was used to fill in vnum etc + return repr->v_nsizeMax[idx]; + } + uchar Vertex::nsizeCur() const { // index of the current v#num in vtotal + return repr->v_nsizeCur[idx]; + } + uchar Vertex::num() const { // number of neighboring faces + return repr->v_num[idx]; + } + float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz + return repr->v_dist[idx][i]; + } + float Vertex::dist_orig(size_t i) const { // size() is vtotal. distance to neighboring vertices based on origxyz + return repr->v_dist_orig[idx][i]; + } + int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_capacity[idx]; + } + int Vertex::dist_orig_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_orig_capacity[idx]; + } + float Vertex::x() const { // current coordinates + return repr->v_x[idx]; + } + float Vertex::y() const { // use MRISsetXYZ() to set + return repr->v_y[idx]; + } + float Vertex::z() const { + return repr->v_z[idx]; + } + float Vertex::origx() const { // original coordinates, see also MRIS::origxyz_status + return repr->v_origx[idx]; + } + float Vertex::origy() const { // use MRISsetOriginalXYZ(, + return repr->v_origy[idx]; + } + float Vertex::origz() const { // or MRISsetOriginalXYZfromXYZ to set + return repr->v_origz[idx]; + } + float Vertex::nx() const { + return repr->v_nx[idx]; + } + float Vertex::ny() const { + return repr->v_ny[idx]; + } + float Vertex::nz() const { // curr normal + return repr->v_nz[idx]; + } + float Vertex::pnx() const { + return repr->v_pnx[idx]; + } + float Vertex::pny() const { + return repr->v_pny[idx]; + } + float Vertex::pnz() const { // pial normal + return repr->v_pnz[idx]; + } + float Vertex::wnx() const { + return repr->v_wnx[idx]; + } + float Vertex::wny() const { + return repr->v_wny[idx]; + } + float Vertex::wnz() const { // white normal + return repr->v_wnz[idx]; + } + float Vertex::onx() const { + return repr->v_onx[idx]; + } + float Vertex::ony() const { + return repr->v_ony[idx]; + } + float Vertex::onz() const { // original normal + return repr->v_onz[idx]; + } + float Vertex::dx() const { + return repr->v_dx[idx]; + } + float Vertex::dy() const { + return repr->v_dy[idx]; + } + float Vertex::dz() const { // current change in position + return repr->v_dz[idx]; + } + float Vertex::odx() const { + return repr->v_odx[idx]; + } + float Vertex::ody() const { + return repr->v_ody[idx]; + } + float Vertex::odz() const { // last change of position (for momentum, + return repr->v_odz[idx]; + } + float Vertex::tdx() const { + return repr->v_tdx[idx]; + } + float Vertex::tdy() const { + return repr->v_tdy[idx]; + } + float Vertex::tdz() const { // temporary storage for averaging gradient + return repr->v_tdz[idx]; + } + float Vertex::curv() const { // curr curvature + return repr->v_curv[idx]; + } + float Vertex::curvbak() const { + return repr->v_curvbak[idx]; + } + float Vertex::val() const { // scalar data value (file: rh.val, sig2-rh.w) + return repr->v_val[idx]; + } + float Vertex::imag_val() const { // imaginary part of complex data value + return repr->v_imag_val[idx]; + } + float Vertex::cx() const { + return repr->v_cx[idx]; + } + float Vertex::cy() const { + return repr->v_cy[idx]; + } + float Vertex::cz() const { // coordinates in canonical coordinate system + return repr->v_cz[idx]; + } + float Vertex::tx() const { + return repr->v_tx[idx]; + } + float Vertex::ty() const { + return repr->v_ty[idx]; + } + float Vertex::tz() const { // tmp coordinate storage + return repr->v_tz[idx]; + } + float Vertex::t2x() const { + return repr->v_t2x[idx]; + } + float Vertex::t2y() const { + return repr->v_t2y[idx]; + } + float Vertex::t2z() const { // another tmp coordinate storage + return repr->v_t2z[idx]; + } + float Vertex::targx() const { + return repr->v_targx[idx]; + } + float Vertex::targy() const { + return repr->v_targy[idx]; + } + float Vertex::targz() const { // target coordinates + return repr->v_targz[idx]; + } + float Vertex::pialx() const { + return repr->v_pialx[idx]; + } + float Vertex::pialy() const { + return repr->v_pialy[idx]; + } + float Vertex::pialz() const { // pial surface coordinates + return repr->v_pialz[idx]; + } + float Vertex::whitex() const { + return repr->v_whitex[idx]; + } + float Vertex::whitey() const { + return repr->v_whitey[idx]; + } + float Vertex::whitez() const { // white surface coordinates + return repr->v_whitez[idx]; + } + float Vertex::l4x() const { + return repr->v_l4x[idx]; + } + float Vertex::l4y() const { + return repr->v_l4y[idx]; + } + float Vertex::l4z() const { // layerIV surface coordinates + return repr->v_l4z[idx]; + } + float Vertex::infx() const { + return repr->v_infx[idx]; + } + float Vertex::infy() const { + return repr->v_infy[idx]; + } + float Vertex::infz() const { // inflated coordinates + return repr->v_infz[idx]; + } + float Vertex::fx() const { + return repr->v_fx[idx]; + } + float Vertex::fy() const { + return repr->v_fy[idx]; + } + float Vertex::fz() const { // flattened coordinates + return repr->v_fz[idx]; + } + int Vertex::px() const { + return repr->v_px[idx]; + } + int Vertex::qx() const { + return repr->v_qx[idx]; + } + int Vertex::py() const { + return repr->v_py[idx]; + } + int Vertex::qy() const { + return repr->v_qy[idx]; + } + int Vertex::pz() const { + return repr->v_pz[idx]; + } + int Vertex::qz() const { // rational coordinates for exact calculations + return repr->v_qz[idx]; + } + float Vertex::e1x() const { + return repr->v_e1x[idx]; + } + float Vertex::e1y() const { + return repr->v_e1y[idx]; + } + float Vertex::e1z() const { // 1st basis vector for the local tangent plane + return repr->v_e1z[idx]; + } + float Vertex::e2x() const { + return repr->v_e2x[idx]; + } + float Vertex::e2y() const { + return repr->v_e2y[idx]; + } + float Vertex::e2z() const { // 2nd basis vector for the local tangent plane + return repr->v_e2z[idx]; + } + float Vertex::pe1x() const { + return repr->v_pe1x[idx]; + } + float Vertex::pe1y() const { + return repr->v_pe1y[idx]; + } + float Vertex::pe1z() const { // 1st basis vector for the local tangent plane + return repr->v_pe1z[idx]; + } + float Vertex::pe2x() const { + return repr->v_pe2x[idx]; + } + float Vertex::pe2y() const { + return repr->v_pe2y[idx]; + } + float Vertex::pe2z() const { // 2nd basis vector for the local tangent plane + return repr->v_pe2z[idx]; + } + float Vertex::nc() const { // curr length normal comp + return repr->v_nc[idx]; + } + float Vertex::val2() const { // complex comp data value (file: sig3-rh.w) + return repr->v_val2[idx]; + } + float Vertex::valbak() const { // scalar data stack + return repr->v_valbak[idx]; + } + float Vertex::val2bak() const { // complex comp data stack + return repr->v_val2bak[idx]; + } + float Vertex::stat() const { // statistic + return repr->v_stat[idx]; + } + int Vertex::undefval() const { // [previously dist=0] + return repr->v_undefval[idx]; + } + int Vertex::old_undefval() const { // for smooth_val_sparse + return repr->v_old_undefval[idx]; + } + int Vertex::fixedval() const { // [previously val=0] + return repr->v_fixedval[idx]; + } + float Vertex::fieldsign() const { // fieldsign--final: -1, "0", "1" (file: rh.fs) + return repr->v_fieldsign[idx]; + } + float Vertex::fsmask() const { // significance mask (file: rh.fm) + return repr->v_fsmask[idx]; + } + float Vertex::d() const { // for distance calculations + return repr->v_d[idx]; + } + int Vertex::annotation() const { // area label (defunct--now from label file name!) + return repr->v_annotation[idx]; + } + char Vertex::oripflag() const { + return repr->v_oripflag[idx]; + } + char Vertex::origripflag() const { // cuts flags + return repr->v_origripflag[idx]; + } + p_void Vertex::vp() const { // to store user's information + return repr->v_vp[idx]; + } + float Vertex::theta() const { + return repr->v_theta[idx]; + } + float Vertex::phi() const { // parameterization + return repr->v_phi[idx]; + } + float Vertex::area() const { + return repr->v_area[idx]; + } + float Vertex::origarea() const { + return repr->v_origarea[idx]; + } + float Vertex::group_avg_area() const { + return repr->v_group_avg_area[idx]; + } + float Vertex::K() const { // Gaussian curvature + return repr->v_K[idx]; + } + float Vertex::H() const { // mean curvature + return repr->v_H[idx]; + } + float Vertex::k1() const { + return repr->v_k1[idx]; + } + float Vertex::k2() const { // the principal curvatures + return repr->v_k2[idx]; + } + float Vertex::mean() const { + return repr->v_mean[idx]; + } + float Vertex::mean_imag() const { // imaginary part of complex statistic + return repr->v_mean_imag[idx]; + } + float Vertex::std_error() const { + return repr->v_std_error[idx]; + } + uint Vertex::flags() const { + return repr->v_flags[idx]; + } + int Vertex::fno() const { // face that this vertex is in + return repr->v_fno[idx]; + } + int Vertex::cropped() const { + return repr->v_cropped[idx]; + } + short Vertex::marked() const { // for a variety of uses + return repr->v_marked[idx]; + } + short Vertex::marked2() const { + return repr->v_marked2[idx]; + } + short Vertex::marked3() const { + return repr->v_marked3[idx]; + } + char Vertex::neg() const { // 1 if the normal vector is inverted + return repr->v_neg[idx]; + } + char Vertex::border() const { // flag + return repr->v_border[idx]; + } + char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache + return repr->v_ripflag[idx]; + } + void Vertex::which_coords(int which, float *x, float *y, float *z) const { + + #define CASE(WHICH, FIELD) \ + case WHICH: \ + *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ + break; + + switch (which) { + CASE(CURRENT_VERTICES,) + CASE(ORIGINAL_VERTICES,orig) + CASE(VERTEX_NORMALS,n) + CASE(PIAL_NORMALS,pn) + CASE(WHITE_NORMALS,wn) + CASE(CANONICAL_VERTICES,c) + CASE(TMP_VERTICES,t) + CASE(TMP2_VERTICES,t2) + CASE(PIAL_VERTICES,pial) + CASE(WHITE_VERTICES,white) + CASE(INFLATED_VERTICES,inf) + CASE(FLATTENED_VERTICES,f) + default: + *x = *y = *z = 0.0; + ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); + break; + } + + #undef CASE + } + + void Vertex::set_f(size_t i, Face to) { // size() is num. array[v->num] the fno's of the neighboring faces + cheapAssert(repr == to.repr); repr->v_f[idx][i] = to.idx; + } + void Vertex::set_n(size_t i, size_t to) { // size() is num. array[v->num] the face.v[*] index for this vertex + repr->v_n[idx][i] = uchar(to); + } + void Vertex::set_e(size_t i, int to) { // edge state for neighboring vertices + repr->v_e[idx][i] = to; + } + void Vertex::set_nx(float to) { + repr->v_nx[idx] = to; + } + void Vertex::set_ny(float to) { + repr->v_ny[idx] = to; + } + void Vertex::set_nz(float to) { // curr normal + repr->v_nz[idx] = to; + } + void Vertex::set_pnx(float to) { + repr->v_pnx[idx] = to; + } + void Vertex::set_pny(float to) { + repr->v_pny[idx] = to; + } + void Vertex::set_pnz(float to) { // pial normal + repr->v_pnz[idx] = to; + } + void Vertex::set_wnx(float to) { + repr->v_wnx[idx] = to; + } + void Vertex::set_wny(float to) { + repr->v_wny[idx] = to; + } + void Vertex::set_wnz(float to) { // white normal + repr->v_wnz[idx] = to; + } + void Vertex::set_onx(float to) { + repr->v_onx[idx] = to; + } + void Vertex::set_ony(float to) { + repr->v_ony[idx] = to; + } + void Vertex::set_onz(float to) { // original normal + repr->v_onz[idx] = to; + } + void Vertex::set_dx(float to) { + repr->v_dx[idx] = to; + } + void Vertex::set_dy(float to) { + repr->v_dy[idx] = to; + } + void Vertex::set_dz(float to) { // current change in position + repr->v_dz[idx] = to; + } + void Vertex::set_odx(float to) { + repr->v_odx[idx] = to; + } + void Vertex::set_ody(float to) { + repr->v_ody[idx] = to; + } + void Vertex::set_odz(float to) { // last change of position (for momentum, + repr->v_odz[idx] = to; + } + void Vertex::set_tdx(float to) { + repr->v_tdx[idx] = to; + } + void Vertex::set_tdy(float to) { + repr->v_tdy[idx] = to; + } + void Vertex::set_tdz(float to) { // temporary storage for averaging gradient + repr->v_tdz[idx] = to; + } + void Vertex::set_curv(float to) { // curr curvature + repr->v_curv[idx] = to; + } + void Vertex::set_curvbak(float to) { + repr->v_curvbak[idx] = to; + } + void Vertex::set_val(float to) { // scalar data value (file: rh.val, sig2-rh.w) + repr->v_val[idx] = to; + } + void Vertex::set_imag_val(float to) { // imaginary part of complex data value + repr->v_imag_val[idx] = to; + } + void Vertex::set_cx(float to) { + repr->v_cx[idx] = to; + } + void Vertex::set_cy(float to) { + repr->v_cy[idx] = to; + } + void Vertex::set_cz(float to) { // coordinates in canonical coordinate system + repr->v_cz[idx] = to; + } + void Vertex::set_tx(float to) { + repr->v_tx[idx] = to; + } + void Vertex::set_ty(float to) { + repr->v_ty[idx] = to; + } + void Vertex::set_tz(float to) { // tmp coordinate storage + repr->v_tz[idx] = to; + } + void Vertex::set_t2x(float to) { + repr->v_t2x[idx] = to; + } + void Vertex::set_t2y(float to) { + repr->v_t2y[idx] = to; + } + void Vertex::set_t2z(float to) { // another tmp coordinate storage + repr->v_t2z[idx] = to; + } + void Vertex::set_targx(float to) { + repr->v_targx[idx] = to; + } + void Vertex::set_targy(float to) { + repr->v_targy[idx] = to; + } + void Vertex::set_targz(float to) { // target coordinates + repr->v_targz[idx] = to; + } + void Vertex::set_pialx(float to) { + repr->v_pialx[idx] = to; + } + void Vertex::set_pialy(float to) { + repr->v_pialy[idx] = to; + } + void Vertex::set_pialz(float to) { // pial surface coordinates + repr->v_pialz[idx] = to; + } + void Vertex::set_whitex(float to) { + repr->v_whitex[idx] = to; + } + void Vertex::set_whitey(float to) { + repr->v_whitey[idx] = to; + } + void Vertex::set_whitez(float to) { // white surface coordinates + repr->v_whitez[idx] = to; + } + void Vertex::set_l4x(float to) { + repr->v_l4x[idx] = to; + } + void Vertex::set_l4y(float to) { + repr->v_l4y[idx] = to; + } + void Vertex::set_l4z(float to) { // layerIV surface coordinates + repr->v_l4z[idx] = to; + } + void Vertex::set_infx(float to) { + repr->v_infx[idx] = to; + } + void Vertex::set_infy(float to) { + repr->v_infy[idx] = to; + } + void Vertex::set_infz(float to) { // inflated coordinates + repr->v_infz[idx] = to; + } + void Vertex::set_fx(float to) { + repr->v_fx[idx] = to; + } + void Vertex::set_fy(float to) { + repr->v_fy[idx] = to; + } + void Vertex::set_fz(float to) { // flattened coordinates + repr->v_fz[idx] = to; + } + void Vertex::set_px(int to) { + repr->v_px[idx] = to; + } + void Vertex::set_qx(int to) { + repr->v_qx[idx] = to; + } + void Vertex::set_py(int to) { + repr->v_py[idx] = to; + } + void Vertex::set_qy(int to) { + repr->v_qy[idx] = to; + } + void Vertex::set_pz(int to) { + repr->v_pz[idx] = to; + } + void Vertex::set_qz(int to) { // rational coordinates for exact calculations + repr->v_qz[idx] = to; + } + void Vertex::set_e1x(float to) { + repr->v_e1x[idx] = to; + } + void Vertex::set_e1y(float to) { + repr->v_e1y[idx] = to; + } + void Vertex::set_e1z(float to) { // 1st basis vector for the local tangent plane + repr->v_e1z[idx] = to; + } + void Vertex::set_e2x(float to) { + repr->v_e2x[idx] = to; + } + void Vertex::set_e2y(float to) { + repr->v_e2y[idx] = to; + } + void Vertex::set_e2z(float to) { // 2nd basis vector for the local tangent plane + repr->v_e2z[idx] = to; + } + void Vertex::set_pe1x(float to) { + repr->v_pe1x[idx] = to; + } + void Vertex::set_pe1y(float to) { + repr->v_pe1y[idx] = to; + } + void Vertex::set_pe1z(float to) { // 1st basis vector for the local tangent plane + repr->v_pe1z[idx] = to; + } + void Vertex::set_pe2x(float to) { + repr->v_pe2x[idx] = to; + } + void Vertex::set_pe2y(float to) { + repr->v_pe2y[idx] = to; + } + void Vertex::set_pe2z(float to) { // 2nd basis vector for the local tangent plane + repr->v_pe2z[idx] = to; + } + void Vertex::set_nc(float to) { // curr length normal comp + repr->v_nc[idx] = to; + } + void Vertex::set_val2(float to) { // complex comp data value (file: sig3-rh.w) + repr->v_val2[idx] = to; + } + void Vertex::set_valbak(float to) { // scalar data stack + repr->v_valbak[idx] = to; + } + void Vertex::set_val2bak(float to) { // complex comp data stack + repr->v_val2bak[idx] = to; + } + void Vertex::set_stat(float to) { // statistic + repr->v_stat[idx] = to; + } + void Vertex::set_undefval(int to) { // [previously dist=0] + repr->v_undefval[idx] = to; + } + void Vertex::set_old_undefval(int to) { // for smooth_val_sparse + repr->v_old_undefval[idx] = to; + } + void Vertex::set_fixedval(int to) { // [previously val=0] + repr->v_fixedval[idx] = to; + } + void Vertex::set_fieldsign(float to) { // fieldsign--final: -1, "0", "1" (file: rh.fs) + repr->v_fieldsign[idx] = to; + } + void Vertex::set_fsmask(float to) { // significance mask (file: rh.fm) + repr->v_fsmask[idx] = to; + } + void Vertex::set_d(float to) { // for distance calculations + repr->v_d[idx] = to; + } + void Vertex::set_annotation(int to) { // area label (defunct--now from label file name!) + repr->v_annotation[idx] = to; + } + void Vertex::set_oripflag(char to) { + repr->v_oripflag[idx] = to; + } + void Vertex::set_origripflag(char to) { // cuts flags + repr->v_origripflag[idx] = to; + } + void Vertex::set_vp(p_void to) { // to store user's information + repr->v_vp[idx] = to; + } + void Vertex::set_theta(float to) { + repr->v_theta[idx] = to; + } + void Vertex::set_phi(float to) { // parameterization + repr->v_phi[idx] = to; + } + void Vertex::set_origarea(float to) { + repr->v_origarea[idx] = to; + } + void Vertex::set_group_avg_area(float to) { + repr->v_group_avg_area[idx] = to; + } + void Vertex::set_K(float to) { // Gaussian curvature + repr->v_K[idx] = to; + } + void Vertex::set_H(float to) { // mean curvature + repr->v_H[idx] = to; + } + void Vertex::set_k1(float to) { + repr->v_k1[idx] = to; + } + void Vertex::set_k2(float to) { // the principal curvatures + repr->v_k2[idx] = to; + } + void Vertex::set_mean(float to) { + repr->v_mean[idx] = to; + } + void Vertex::set_mean_imag(float to) { // imaginary part of complex statistic + repr->v_mean_imag[idx] = to; + } + void Vertex::set_std_error(float to) { + repr->v_std_error[idx] = to; + } + void Vertex::set_flags(uint to) { + repr->v_flags[idx] = to; + } + void Vertex::set_fno(int to) { // face that this vertex is in + repr->v_fno[idx] = to; + } + void Vertex::set_cropped(int to) { + repr->v_cropped[idx] = to; + } + void Vertex::set_marked(short to) { // for a variety of uses + repr->v_marked[idx] = to; + } + void Vertex::set_marked2(short to) { + repr->v_marked2[idx] = to; + } + void Vertex::set_marked3(short to) { + repr->v_marked3[idx] = to; + } + void Vertex::set_neg(char to) { // 1 if the normal vector is inverted + repr->v_neg[idx] = to; + } + void Vertex::set_border(char to) { // flag + repr->v_border[idx] = to; + } + void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache + repr->v_ripflag[idx] = to; + } + + + Surface::Surface ( ) {} + Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} + Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + + int Surface::nverticesFrozen() const { // # of vertices on surface is frozen + return repr->nverticesFrozen; + } + int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nvertices; + } + int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nfaces; + } + bool Surface::faceAttachmentDeferred() const { // defer connecting faces to vertices for performance reasons + return repr->faceAttachmentDeferred; + } + int Surface::nedges() const { // # of edges on surface + return repr->nedges; + } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } + int Surface::nstrips() const { + return repr->nstrips; + } + Vertex Surface::vertices(size_t i) const { + return Vertex(repr, i); + } + p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + return repr->dist_storage; + } + p_p_void Surface::dist_orig_storage() const { // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + return repr->dist_orig_storage; + } + int Surface::tempsAssigned() const { // State of various temp fields that can be borrowed if not already in use + return repr->tempsAssigned; + } + Face Surface::faces(size_t i) const { + return Face(repr, i); + } + MRI_EDGE Surface::edges(size_t i) const { + return repr->edges[i]; + } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + STRIP Surface::strips(size_t i) const { + return repr->strips[i]; + } + float Surface::xctr() const { + return repr->xctr; + } + float Surface::yctr() const { + return repr->yctr; + } + float Surface::zctr() const { + return repr->zctr; + } + float Surface::xlo() const { + return repr->xlo; + } + float Surface::ylo() const { + return repr->ylo; + } + float Surface::zlo() const { + return repr->zlo; + } + float Surface::xhi() const { + return repr->xhi; + } + float Surface::yhi() const { + return repr->yhi; + } + float Surface::zhi() const { + return repr->zhi; + } + float Surface::x0() const { // center of spherical expansion + return repr->x0; + } + float Surface::y0() const { + return repr->y0; + } + float Surface::z0() const { + return repr->z0; + } + float Surface::max_curv() const { + return repr->max_curv; + } + float Surface::min_curv() const { + return repr->min_curv; + } + float Surface::total_area() const { + return repr->total_area; + } + double Surface::avg_vertex_area() const { + return repr->avg_vertex_area; + } + double Surface::avg_vertex_dist() const { // set by MRIScomputeAvgInterVertexDist + return repr->avg_vertex_dist; + } + double Surface::std_vertex_dist() const { + return repr->std_vertex_dist; + } + float Surface::orig_area() const { + return repr->orig_area; + } + float Surface::neg_area() const { + return repr->neg_area; + } + float Surface::neg_orig_area() const { // amount of original surface in folds + return repr->neg_orig_area; + } + int Surface::zeros() const { + return repr->zeros; + } + int Surface::hemisphere() const { // which hemisphere + return repr->hemisphere; + } + int Surface::initialized() const { + return repr->initialized; + } + PLTA Surface::lta() const { + return repr->lta; + } + PMATRIX Surface::SRASToTalSRAS_() const { + return repr->SRASToTalSRAS_; + } + PMATRIX Surface::TalSRASToSRAS_() const { + return repr->TalSRASToSRAS_; + } + int Surface::free_transform() const { + return repr->free_transform; + } + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; + } + float Surface::a() const { + return repr->a; + } + float Surface::b() const { + return repr->b; + } + float Surface::c() const { // ellipsoid parameters + return repr->c; + } + MRIS_fname_t Surface::fname() const { // file it was originally loaded from + return repr->fname; + } + float Surface::Hmin() const { // min mean curvature + return repr->Hmin; + } + float Surface::Hmax() const { // max mean curvature + return repr->Hmax; + } + float Surface::Kmin() const { // min Gaussian curvature + return repr->Kmin; + } + float Surface::Kmax() const { // max Gaussian curvature + return repr->Kmax; + } + double Surface::Ktotal() const { // total Gaussian curvature + return repr->Ktotal; + } + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->status; + } + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; + } + int Surface::patch() const { // if a patch of the surface + return repr->patch; + } + int Surface::nlabels() const { + return repr->nlabels; + } + PMRIS_AREA_LABEL Surface::labels() const { // nlabels of these (may be null) + return repr->labels; + } + p_void Surface::vp() const { // for misc. use + return repr->vp; + } + float Surface::alpha() const { // rotation around z-axis + return repr->alpha; + } + float Surface::beta() const { // rotation around y-axis + return repr->beta; + } + float Surface::gamma() const { // rotation around x-axis + return repr->gamma; + } + float Surface::da() const { + return repr->da; + } + float Surface::db() const { + return repr->db; + } + float Surface::dg() const { // old deltas + return repr->dg; + } + int Surface::type() const { // what type of surface was this initially + return repr->type; + } + int Surface::max_vertices() const { // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + return repr->max_vertices; + } + int Surface::max_faces() const { // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + return repr->max_faces; + } + MRIS_subject_name_t Surface::subject_name() const { // name of the subject + return repr->subject_name; + } + float Surface::canon_area() const { + return repr->canon_area; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->noscale; + } + float Surface::dx2(size_t i) const { // an extra set of gradient (not always alloced) + return repr->dx2[i]; + } + float Surface::dy2(size_t i) const { + return repr->dy2[i]; + } + float Surface::dz2(size_t i) const { + return repr->dz2[i]; + } + PCOLOR_TABLE Surface::ct() const { + return repr->ct; + } + int Surface::useRealRAS() const { // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + return repr->useRealRAS; + } + VOL_GEOM Surface::vg() const { // volume info from which this surface is created. valid iff vg.valid = 1 + return repr->vg; + } + MRIS_cmdlines_t Surface::cmdlines() const { + return repr->cmdlines; + } + int Surface::ncmds() const { + return repr->ncmds; + } + float Surface::group_avg_surface_area() const { // average of total surface area for group + return repr->group_avg_surface_area; + } + int Surface::group_avg_vtxarea_loaded() const { // average vertex area for group at each vertex + return repr->group_avg_vtxarea_loaded; + } + int Surface::triangle_links_removed() const { // for quad surfaces + return repr->triangle_links_removed; + } + p_void Surface::user_parms() const { // for whatever the user wants to hang here + return repr->user_parms; + } + PMATRIX Surface::m_sras2vox() const { // for converting surface ras to voxel + return repr->m_sras2vox; + } + PMRI Surface::mri_sras2vox() const { // volume that the above matrix is for + return repr->mri_sras2vox; + } + p_void Surface::mht() const { + return repr->mht; + } + p_void Surface::temps() const { + return repr->temps; + } + + void Surface::set_strips(size_t i, STRIP to) { + repr->strips[i] = to; + } + void Surface::set_xctr(float to) { + repr->xctr = to; + } + void Surface::set_yctr(float to) { + repr->yctr = to; + } + void Surface::set_zctr(float to) { + repr->zctr = to; + } + void Surface::set_xlo(float to) { + repr->xlo = to; + } + void Surface::set_ylo(float to) { + repr->ylo = to; + } + void Surface::set_zlo(float to) { + repr->zlo = to; + } + void Surface::set_xhi(float to) { + repr->xhi = to; + } + void Surface::set_yhi(float to) { + repr->yhi = to; + } + void Surface::set_zhi(float to) { + repr->zhi = to; + } + void Surface::set_x0(float to) { // center of spherical expansion + repr->x0 = to; + } + void Surface::set_y0(float to) { + repr->y0 = to; + } + void Surface::set_z0(float to) { + repr->z0 = to; + } + void Surface::set_max_curv(float to) { + repr->max_curv = to; + } + void Surface::set_min_curv(float to) { + repr->min_curv = to; + } + void Surface::set_total_area(float to) { + repr->total_area = to; + } + void Surface::set_avg_vertex_area(double to) { + repr->avg_vertex_area = to; + } + void Surface::set_zeros(int to) { + repr->zeros = to; + } + void Surface::set_hemisphere(int to) { // which hemisphere + repr->hemisphere = to; + } + void Surface::set_Hmin(float to) { // min mean curvature + repr->Hmin = to; + } + void Surface::set_Hmax(float to) { // max mean curvature + repr->Hmax = to; + } + void Surface::set_Kmin(float to) { // min Gaussian curvature + repr->Kmin = to; + } + void Surface::set_Kmax(float to) { // max Gaussian curvature + repr->Kmax = to; + } + void Surface::set_Ktotal(double to) { // total Gaussian curvature + repr->Ktotal = to; + } + void Surface::set_nlabels(int to) { + repr->nlabels = to; + } + void Surface::set_labels(PMRIS_AREA_LABEL to) { // nlabels of these (may be null) + repr->labels = to; + } + void Surface::set_vp(p_void to) { // for misc. use + repr->vp = to; + } + void Surface::set_alpha(float to) { // rotation around z-axis + repr->alpha = to; + } + void Surface::set_beta(float to) { // rotation around y-axis + repr->beta = to; + } + void Surface::set_gamma(float to) { // rotation around x-axis + repr->gamma = to; + } + void Surface::set_da(float to) { + repr->da = to; + } + void Surface::set_db(float to) { + repr->db = to; + } + void Surface::set_dg(float to) { // old deltas + repr->dg = to; + } + void Surface::set_type(int to) { // what type of surface was this initially + repr->type = to; + } + + + } // namespace DistortM + + + namespace AnalysisM { + Face::Face ( ) {} + Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Face::Face ( Face const & src ) : Repr_Elt(src) {} + Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} + + Vertex Face::v(size_t i) const { + return Vertex(repr,repr->f_v[idx][i]); + } + float Face::area() const { + return repr->f_area[idx]; + } + angles_per_triangle_t Face::angle() const { + return repr->f_angle[idx]; + } + angles_per_triangle_t Face::orig_angle() const { + return repr->f_orig_angle[idx]; + } + char Face::ripflag() const { + return repr->f_ripflag[idx]; + } + char Face::oripflag() const { + return repr->f_oripflag[idx]; + } + int Face::marked() const { + return repr->f_marked[idx]; + } + PDMATRIX Face::norm() const { + return repr->f_norm[idx]; + } + A3PDMATRIX Face::gradNorm() const { + return repr->f_gradNorm[idx]; + } + + void Face::set_orig_angle(angles_per_triangle_t to) { + repr->f_orig_angle[idx] = to; + } + void Face::set_ripflag(char to) { + repr->f_ripflag[idx] = to; + } + void Face::set_oripflag(char to) { + repr->f_oripflag[idx] = to; + } + void Face::set_marked(int to) { + repr->f_marked[idx] = to; + } + + + Vertex::Vertex ( ) {} + Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} + + Face Vertex::f(size_t i) const { // size() is num. array[v->num] the fno's of the neighboring faces + return Face(repr, repr->v_f[idx][i]); + } + size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex + return repr->v_n[idx][i]; + } + int Vertex::e(size_t i) const { // edge state for neighboring vertices + return repr->v_e[idx][i]; + } + Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + return Vertex(repr,repr->v_v[idx][i]); + } + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) + return repr->v_vnum[idx]; + } + short Vertex::v2num() const { // number of 1, or 2-hop neighbors + return repr->v_v2num[idx]; + } + short Vertex::v3num() const { // number of 1,2,or 3-hop neighbors + return repr->v_v3num[idx]; + } + short Vertex::vtotal() const { // total # of neighbors. copy of vnum.nsizeCur + return repr->v_vtotal[idx]; + } + short Vertex::nsizeMaxClock() const { // copy of mris->nsizeMaxClock when v#num + return repr->v_nsizeMaxClock[idx]; + } + uchar Vertex::nsizeMax() const { // the max nsize that was used to fill in vnum etc + return repr->v_nsizeMax[idx]; + } + uchar Vertex::nsizeCur() const { // index of the current v#num in vtotal + return repr->v_nsizeCur[idx]; + } + uchar Vertex::num() const { // number of neighboring faces + return repr->v_num[idx]; + } + float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz + return repr->v_dist[idx][i]; + } + float Vertex::dist_orig(size_t i) const { // size() is vtotal. distance to neighboring vertices based on origxyz + return repr->v_dist_orig[idx][i]; + } + int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_capacity[idx]; + } + int Vertex::dist_orig_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_orig_capacity[idx]; + } + float Vertex::x() const { // current coordinates + return repr->v_x[idx]; + } + float Vertex::y() const { // use MRISsetXYZ() to set + return repr->v_y[idx]; + } + float Vertex::z() const { + return repr->v_z[idx]; + } + float Vertex::origx() const { // original coordinates, see also MRIS::origxyz_status + return repr->v_origx[idx]; + } + float Vertex::origy() const { // use MRISsetOriginalXYZ(, + return repr->v_origy[idx]; + } + float Vertex::origz() const { // or MRISsetOriginalXYZfromXYZ to set + return repr->v_origz[idx]; + } + float Vertex::nx() const { + return repr->v_nx[idx]; + } + float Vertex::ny() const { + return repr->v_ny[idx]; + } + float Vertex::nz() const { // curr normal + return repr->v_nz[idx]; + } + float Vertex::pnx() const { + return repr->v_pnx[idx]; + } + float Vertex::pny() const { + return repr->v_pny[idx]; + } + float Vertex::pnz() const { // pial normal + return repr->v_pnz[idx]; + } + float Vertex::wnx() const { + return repr->v_wnx[idx]; + } + float Vertex::wny() const { + return repr->v_wny[idx]; + } + float Vertex::wnz() const { // white normal + return repr->v_wnz[idx]; + } + float Vertex::onx() const { + return repr->v_onx[idx]; + } + float Vertex::ony() const { + return repr->v_ony[idx]; + } + float Vertex::onz() const { // original normal + return repr->v_onz[idx]; + } + float Vertex::dx() const { + return repr->v_dx[idx]; + } + float Vertex::dy() const { + return repr->v_dy[idx]; + } + float Vertex::dz() const { // current change in position + return repr->v_dz[idx]; + } + float Vertex::odx() const { + return repr->v_odx[idx]; + } + float Vertex::ody() const { + return repr->v_ody[idx]; + } + float Vertex::odz() const { // last change of position (for momentum, + return repr->v_odz[idx]; + } + float Vertex::tdx() const { + return repr->v_tdx[idx]; + } + float Vertex::tdy() const { + return repr->v_tdy[idx]; + } + float Vertex::tdz() const { // temporary storage for averaging gradient + return repr->v_tdz[idx]; + } + float Vertex::curv() const { // curr curvature + return repr->v_curv[idx]; + } + float Vertex::curvbak() const { + return repr->v_curvbak[idx]; + } + float Vertex::val() const { // scalar data value (file: rh.val, sig2-rh.w) + return repr->v_val[idx]; + } + float Vertex::imag_val() const { // imaginary part of complex data value + return repr->v_imag_val[idx]; + } + float Vertex::cx() const { + return repr->v_cx[idx]; + } + float Vertex::cy() const { + return repr->v_cy[idx]; + } + float Vertex::cz() const { // coordinates in canonical coordinate system + return repr->v_cz[idx]; + } + float Vertex::tx() const { + return repr->v_tx[idx]; + } + float Vertex::ty() const { + return repr->v_ty[idx]; + } + float Vertex::tz() const { // tmp coordinate storage + return repr->v_tz[idx]; + } + float Vertex::t2x() const { + return repr->v_t2x[idx]; + } + float Vertex::t2y() const { + return repr->v_t2y[idx]; + } + float Vertex::t2z() const { // another tmp coordinate storage + return repr->v_t2z[idx]; + } + float Vertex::targx() const { + return repr->v_targx[idx]; + } + float Vertex::targy() const { + return repr->v_targy[idx]; + } + float Vertex::targz() const { // target coordinates + return repr->v_targz[idx]; + } + float Vertex::pialx() const { + return repr->v_pialx[idx]; + } + float Vertex::pialy() const { + return repr->v_pialy[idx]; + } + float Vertex::pialz() const { // pial surface coordinates + return repr->v_pialz[idx]; + } + float Vertex::whitex() const { + return repr->v_whitex[idx]; + } + float Vertex::whitey() const { + return repr->v_whitey[idx]; + } + float Vertex::whitez() const { // white surface coordinates + return repr->v_whitez[idx]; + } + float Vertex::l4x() const { + return repr->v_l4x[idx]; + } + float Vertex::l4y() const { + return repr->v_l4y[idx]; + } + float Vertex::l4z() const { // layerIV surface coordinates + return repr->v_l4z[idx]; + } + float Vertex::infx() const { + return repr->v_infx[idx]; + } + float Vertex::infy() const { + return repr->v_infy[idx]; + } + float Vertex::infz() const { // inflated coordinates + return repr->v_infz[idx]; + } + float Vertex::fx() const { + return repr->v_fx[idx]; + } + float Vertex::fy() const { + return repr->v_fy[idx]; + } + float Vertex::fz() const { // flattened coordinates + return repr->v_fz[idx]; + } + int Vertex::px() const { + return repr->v_px[idx]; + } + int Vertex::qx() const { + return repr->v_qx[idx]; + } + int Vertex::py() const { + return repr->v_py[idx]; + } + int Vertex::qy() const { + return repr->v_qy[idx]; + } + int Vertex::pz() const { + return repr->v_pz[idx]; + } + int Vertex::qz() const { // rational coordinates for exact calculations + return repr->v_qz[idx]; + } + float Vertex::e1x() const { + return repr->v_e1x[idx]; + } + float Vertex::e1y() const { + return repr->v_e1y[idx]; + } + float Vertex::e1z() const { // 1st basis vector for the local tangent plane + return repr->v_e1z[idx]; + } + float Vertex::e2x() const { + return repr->v_e2x[idx]; + } + float Vertex::e2y() const { + return repr->v_e2y[idx]; + } + float Vertex::e2z() const { // 2nd basis vector for the local tangent plane + return repr->v_e2z[idx]; + } + float Vertex::pe1x() const { + return repr->v_pe1x[idx]; + } + float Vertex::pe1y() const { + return repr->v_pe1y[idx]; + } + float Vertex::pe1z() const { // 1st basis vector for the local tangent plane + return repr->v_pe1z[idx]; + } + float Vertex::pe2x() const { + return repr->v_pe2x[idx]; + } + float Vertex::pe2y() const { + return repr->v_pe2y[idx]; + } + float Vertex::pe2z() const { // 2nd basis vector for the local tangent plane + return repr->v_pe2z[idx]; + } + float Vertex::nc() const { // curr length normal comp + return repr->v_nc[idx]; + } + float Vertex::val2() const { // complex comp data value (file: sig3-rh.w) + return repr->v_val2[idx]; + } + float Vertex::valbak() const { // scalar data stack + return repr->v_valbak[idx]; + } + float Vertex::val2bak() const { // complex comp data stack + return repr->v_val2bak[idx]; + } + float Vertex::stat() const { // statistic + return repr->v_stat[idx]; + } + int Vertex::undefval() const { // [previously dist=0] + return repr->v_undefval[idx]; + } + int Vertex::old_undefval() const { // for smooth_val_sparse + return repr->v_old_undefval[idx]; + } + int Vertex::fixedval() const { // [previously val=0] + return repr->v_fixedval[idx]; + } + float Vertex::fieldsign() const { // fieldsign--final: -1, "0", "1" (file: rh.fs) + return repr->v_fieldsign[idx]; + } + float Vertex::fsmask() const { // significance mask (file: rh.fm) + return repr->v_fsmask[idx]; + } + float Vertex::d() const { // for distance calculations + return repr->v_d[idx]; + } + int Vertex::annotation() const { // area label (defunct--now from label file name!) + return repr->v_annotation[idx]; + } + char Vertex::oripflag() const { + return repr->v_oripflag[idx]; + } + char Vertex::origripflag() const { // cuts flags + return repr->v_origripflag[idx]; + } + p_void Vertex::vp() const { // to store user's information + return repr->v_vp[idx]; + } + float Vertex::theta() const { + return repr->v_theta[idx]; } - - - Surface::Surface ( ) {} - Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} - Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} - Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} - - double Surface::radius() const { // radius (if status==MRIS_SPHERE) - return repr->radius; + float Vertex::phi() const { // parameterization + return repr->v_phi[idx]; } - MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) - return repr->status; + float Vertex::area() const { + return repr->v_area[idx]; } - MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from - return repr->origxyz_status; + float Vertex::origarea() const { + return repr->v_origarea[idx]; } - - void Surface::set_status(MRIS_Status to) { // type of surface (e.g. sphere, plane) - repr->status = to; + float Vertex::group_avg_area() const { + return repr->v_group_avg_area[idx]; } - void Surface::set_origxyz_status(MRIS_Status to) { // type of surface (e.g. sphere, plane) that this origxyz were obtained from - repr->origxyz_status = to; + float Vertex::K() const { // Gaussian curvature + return repr->v_K[idx]; } - - - } // namespace ExistenceM - - - namespace TopologyM { - Face::Face ( ) {} - Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} - Face::Face ( Face const & src ) : Repr_Elt(src) {} - Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} - - Vertex Face::v(size_t i) const { - return Vertex(repr,repr->f_v[idx][i]); + float Vertex::H() const { // mean curvature + return repr->v_H[idx]; } - char Face::ripflag() const { - return repr->f_ripflag[idx]; + float Vertex::k1() const { + return repr->v_k1[idx]; } - - void Face::set_v(size_t i, Vertex to) { - cheapAssert(repr == to.repr); repr->f_v[idx][i] = to.idx; + float Vertex::k2() const { // the principal curvatures + return repr->v_k2[idx]; } - void Face::set_ripflag(char to) { - repr->f_ripflag[idx] = to; + float Vertex::mean() const { + return repr->v_mean[idx]; } - - - Vertex::Vertex ( ) {} - Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} - Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} - Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} - - Face Vertex::f(size_t i) const { // size() is num. array[v->num] the fno's of the neighboring faces - return Face(repr,repr->v_f[idx][i]); + float Vertex::mean_imag() const { // imaginary part of complex statistic + return repr->v_mean_imag[idx]; } - uchar Vertex::num() const { // number of neighboring faces - return repr->v_num[idx]; + float Vertex::std_error() const { + return repr->v_std_error[idx]; + } + uint Vertex::flags() const { + return repr->v_flags[idx]; + } + int Vertex::fno() const { // face that this vertex is in + return repr->v_fno[idx]; + } + int Vertex::cropped() const { + return repr->v_cropped[idx]; + } + short Vertex::marked() const { // for a variety of uses + return repr->v_marked[idx]; + } + short Vertex::marked2() const { + return repr->v_marked2[idx]; + } + short Vertex::marked3() const { + return repr->v_marked3[idx]; + } + char Vertex::neg() const { // 1 if the normal vector is inverted + return repr->v_neg[idx]; + } + char Vertex::border() const { // flag + return repr->v_border[idx]; } char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache return repr->v_ripflag[idx]; @@ -1144,6 +6891,18 @@ namespace SurfaceFromMRISPV { break; switch (which) { + CASE(CURRENT_VERTICES,) + CASE(ORIGINAL_VERTICES,orig) + CASE(VERTEX_NORMALS,n) + CASE(PIAL_NORMALS,pn) + CASE(WHITE_NORMALS,wn) + CASE(CANONICAL_VERTICES,c) + CASE(TMP_VERTICES,t) + CASE(TMP2_VERTICES,t2) + CASE(PIAL_VERTICES,pial) + CASE(WHITE_VERTICES,white) + CASE(INFLATED_VERTICES,inf) + CASE(FLATTENED_VERTICES,f) default: *x = *y = *z = 0.0; ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); @@ -1156,268 +6915,323 @@ namespace SurfaceFromMRISPV { void Vertex::set_f(size_t i, Face to) { // size() is num. array[v->num] the fno's of the neighboring faces cheapAssert(repr == to.repr); repr->v_f[idx][i] = to.idx; } - void Vertex::set_num(uchar to) { // number of neighboring faces - repr->v_num[idx] = to; + void Vertex::set_n(size_t i, size_t to) { // size() is num. array[v->num] the face.v[*] index for this vertex + repr->v_n[idx][i] = uchar(to); } - void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache - repr->v_ripflag[idx] = to; + void Vertex::set_e(size_t i, int to) { // edge state for neighboring vertices + repr->v_e[idx][i] = to; } - - - Surface::Surface ( ) {} - Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} - Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} - Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} - - int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - return repr->nvertices; + void Vertex::set_nx(float to) { + repr->v_nx[idx] = to; } - int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - return repr->nfaces; + void Vertex::set_ny(float to) { + repr->v_ny[idx] = to; } - Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + void Vertex::set_nz(float to) { // curr normal + repr->v_nz[idx] = to; } - Face Surface::faces(size_t i) const { - return Face(repr,i); + void Vertex::set_pnx(float to) { + repr->v_pnx[idx] = to; } - double Surface::radius() const { // radius (if status==MRIS_SPHERE) - return repr->radius; + void Vertex::set_pny(float to) { + repr->v_pny[idx] = to; } - MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) - return repr->status; + void Vertex::set_pnz(float to) { // pial normal + repr->v_pnz[idx] = to; } - MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from - return repr->origxyz_status; + void Vertex::set_wnx(float to) { + repr->v_wnx[idx] = to; } - - - } // namespace TopologyM - - - namespace XYZPositionM { - Face::Face ( ) {} - Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} - Face::Face ( Face const & src ) : Repr_Elt(src) {} - Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} - - Vertex Face::v(size_t i) const { - return Vertex(repr,repr->f_v[idx][i]); + void Vertex::set_wny(float to) { + repr->v_wny[idx] = to; } - char Face::ripflag() const { - return repr->f_ripflag[idx]; + void Vertex::set_wnz(float to) { // white normal + repr->v_wnz[idx] = to; } - - void Face::set_ripflag(char to) { - repr->f_ripflag[idx] = to; + void Vertex::set_onx(float to) { + repr->v_onx[idx] = to; } - - - Vertex::Vertex ( ) {} - Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} - Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} - Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} - - Face Vertex::f(size_t i) const { // size() is num. array[v->num] the fno's of the neighboring faces - return Face(repr,repr->v_f[idx][i]); + void Vertex::set_ony(float to) { + repr->v_ony[idx] = to; } - uchar Vertex::num() const { // number of neighboring faces - return repr->v_num[idx]; + void Vertex::set_onz(float to) { // original normal + repr->v_onz[idx] = to; } - float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz - return repr->v_dist[idx][i]; + void Vertex::set_dx(float to) { + repr->v_dx[idx] = to; } - int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements - return repr->v_dist_capacity[idx]; + void Vertex::set_dy(float to) { + repr->v_dy[idx] = to; } - float Vertex::x() const { // current coordinates - return repr->v_x[idx]; + void Vertex::set_dz(float to) { // current change in position + repr->v_dz[idx] = to; } - float Vertex::y() const { // use MRISsetXYZ() to set - return repr->v_y[idx]; + void Vertex::set_odx(float to) { + repr->v_odx[idx] = to; } - float Vertex::z() const { - return repr->v_z[idx]; + void Vertex::set_ody(float to) { + repr->v_ody[idx] = to; } - char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache - return repr->v_ripflag[idx]; + void Vertex::set_odz(float to) { // last change of position (for momentum, + repr->v_odz[idx] = to; } - void Vertex::which_coords(int which, float *x, float *y, float *z) const { - - #define CASE(WHICH, FIELD) \ - case WHICH: \ - *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ - break; - - switch (which) { - CASE(CURRENT_VERTICES,) - default: - *x = *y = *z = 0.0; - ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); - break; - } - - #undef CASE + void Vertex::set_tdx(float to) { + repr->v_tdx[idx] = to; } - - void Vertex::set_f(size_t i, Face to) { // size() is num. array[v->num] the fno's of the neighboring faces - cheapAssert(repr == to.repr); repr->v_f[idx][i] = to.idx; + void Vertex::set_tdy(float to) { + repr->v_tdy[idx] = to; } - void Vertex::set_x(float to) { // current coordinates - repr->v_x[idx] = to; + void Vertex::set_tdz(float to) { // temporary storage for averaging gradient + repr->v_tdz[idx] = to; } - void Vertex::set_y(float to) { // use MRISsetXYZ() to set - repr->v_y[idx] = to; + void Vertex::set_curv(float to) { // curr curvature + repr->v_curv[idx] = to; } - void Vertex::set_z(float to) { - repr->v_z[idx] = to; + void Vertex::set_curvbak(float to) { + repr->v_curvbak[idx] = to; } - void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache - repr->v_ripflag[idx] = to; + void Vertex::set_val(float to) { // scalar data value (file: rh.val, sig2-rh.w) + repr->v_val[idx] = to; } - - - Surface::Surface ( ) {} - Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} - Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} - Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} - - int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - return repr->nvertices; + void Vertex::set_imag_val(float to) { // imaginary part of complex data value + repr->v_imag_val[idx] = to; } - int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - return repr->nfaces; + void Vertex::set_cx(float to) { + repr->v_cx[idx] = to; } - Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + void Vertex::set_cy(float to) { + repr->v_cy[idx] = to; } - Face Surface::faces(size_t i) const { - return Face(repr,i); + void Vertex::set_cz(float to) { // coordinates in canonical coordinate system + repr->v_cz[idx] = to; } - double Surface::radius() const { // radius (if status==MRIS_SPHERE) - return repr->radius; + void Vertex::set_tx(float to) { + repr->v_tx[idx] = to; } - MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) - return repr->status; + void Vertex::set_ty(float to) { + repr->v_ty[idx] = to; } - MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from - return repr->origxyz_status; + void Vertex::set_tz(float to) { // tmp coordinate storage + repr->v_tz[idx] = to; } - - - } // namespace XYZPositionM - - - namespace XYZPositionConsequencesM { - Face::Face ( ) {} - Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} - Face::Face ( Face const & src ) : Repr_Elt(src) {} - Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} - - Vertex Face::v(size_t i) const { - return Vertex(repr,repr->f_v[idx][i]); + void Vertex::set_t2x(float to) { + repr->v_t2x[idx] = to; } - float Face::area() const { - return repr->f_area[idx]; + void Vertex::set_t2y(float to) { + repr->v_t2y[idx] = to; } - angles_per_triangle_t Face::angle() const { - return repr->f_angle[idx]; + void Vertex::set_t2z(float to) { // another tmp coordinate storage + repr->v_t2z[idx] = to; } - char Face::ripflag() const { - return repr->f_ripflag[idx]; + void Vertex::set_targx(float to) { + repr->v_targx[idx] = to; } - PDMATRIX Face::norm() const { - return repr->f_norm[idx]; + void Vertex::set_targy(float to) { + repr->v_targy[idx] = to; } - - void Face::set_area(float to) { - repr->f_area[idx] = to; + void Vertex::set_targz(float to) { // target coordinates + repr->v_targz[idx] = to; } - void Face::set_angle(angles_per_triangle_t to) { - repr->f_angle[idx] = to; + void Vertex::set_pialx(float to) { + repr->v_pialx[idx] = to; + } + void Vertex::set_pialy(float to) { + repr->v_pialy[idx] = to; + } + void Vertex::set_pialz(float to) { // pial surface coordinates + repr->v_pialz[idx] = to; + } + void Vertex::set_whitex(float to) { + repr->v_whitex[idx] = to; + } + void Vertex::set_whitey(float to) { + repr->v_whitey[idx] = to; + } + void Vertex::set_whitez(float to) { // white surface coordinates + repr->v_whitez[idx] = to; + } + void Vertex::set_l4x(float to) { + repr->v_l4x[idx] = to; + } + void Vertex::set_l4y(float to) { + repr->v_l4y[idx] = to; + } + void Vertex::set_l4z(float to) { // layerIV surface coordinates + repr->v_l4z[idx] = to; + } + void Vertex::set_infx(float to) { + repr->v_infx[idx] = to; + } + void Vertex::set_infy(float to) { + repr->v_infy[idx] = to; + } + void Vertex::set_infz(float to) { // inflated coordinates + repr->v_infz[idx] = to; + } + void Vertex::set_fx(float to) { + repr->v_fx[idx] = to; + } + void Vertex::set_fy(float to) { + repr->v_fy[idx] = to; + } + void Vertex::set_fz(float to) { // flattened coordinates + repr->v_fz[idx] = to; + } + void Vertex::set_px(int to) { + repr->v_px[idx] = to; + } + void Vertex::set_qx(int to) { + repr->v_qx[idx] = to; + } + void Vertex::set_py(int to) { + repr->v_py[idx] = to; + } + void Vertex::set_qy(int to) { + repr->v_qy[idx] = to; + } + void Vertex::set_pz(int to) { + repr->v_pz[idx] = to; + } + void Vertex::set_qz(int to) { // rational coordinates for exact calculations + repr->v_qz[idx] = to; + } + void Vertex::set_e1x(float to) { + repr->v_e1x[idx] = to; + } + void Vertex::set_e1y(float to) { + repr->v_e1y[idx] = to; + } + void Vertex::set_e1z(float to) { // 1st basis vector for the local tangent plane + repr->v_e1z[idx] = to; + } + void Vertex::set_e2x(float to) { + repr->v_e2x[idx] = to; + } + void Vertex::set_e2y(float to) { + repr->v_e2y[idx] = to; + } + void Vertex::set_e2z(float to) { // 2nd basis vector for the local tangent plane + repr->v_e2z[idx] = to; + } + void Vertex::set_pe1x(float to) { + repr->v_pe1x[idx] = to; + } + void Vertex::set_pe1y(float to) { + repr->v_pe1y[idx] = to; + } + void Vertex::set_pe1z(float to) { // 1st basis vector for the local tangent plane + repr->v_pe1z[idx] = to; + } + void Vertex::set_pe2x(float to) { + repr->v_pe2x[idx] = to; + } + void Vertex::set_pe2y(float to) { + repr->v_pe2y[idx] = to; + } + void Vertex::set_pe2z(float to) { // 2nd basis vector for the local tangent plane + repr->v_pe2z[idx] = to; + } + void Vertex::set_nc(float to) { // curr length normal comp + repr->v_nc[idx] = to; + } + void Vertex::set_val2(float to) { // complex comp data value (file: sig3-rh.w) + repr->v_val2[idx] = to; + } + void Vertex::set_valbak(float to) { // scalar data stack + repr->v_valbak[idx] = to; + } + void Vertex::set_val2bak(float to) { // complex comp data stack + repr->v_val2bak[idx] = to; + } + void Vertex::set_stat(float to) { // statistic + repr->v_stat[idx] = to; + } + void Vertex::set_undefval(int to) { // [previously dist=0] + repr->v_undefval[idx] = to; + } + void Vertex::set_old_undefval(int to) { // for smooth_val_sparse + repr->v_old_undefval[idx] = to; + } + void Vertex::set_fixedval(int to) { // [previously val=0] + repr->v_fixedval[idx] = to; + } + void Vertex::set_fieldsign(float to) { // fieldsign--final: -1, "0", "1" (file: rh.fs) + repr->v_fieldsign[idx] = to; + } + void Vertex::set_fsmask(float to) { // significance mask (file: rh.fm) + repr->v_fsmask[idx] = to; + } + void Vertex::set_d(float to) { // for distance calculations + repr->v_d[idx] = to; + } + void Vertex::set_annotation(int to) { // area label (defunct--now from label file name!) + repr->v_annotation[idx] = to; + } + void Vertex::set_oripflag(char to) { + repr->v_oripflag[idx] = to; + } + void Vertex::set_origripflag(char to) { // cuts flags + repr->v_origripflag[idx] = to; } - void Face::set_ripflag(char to) { - repr->f_ripflag[idx] = to; + void Vertex::set_vp(p_void to) { // to store user's information + repr->v_vp[idx] = to; } - void Face::set_norm(PDMATRIX to) { - repr->f_norm[idx] = to; + void Vertex::set_theta(float to) { + repr->v_theta[idx] = to; } - - - Vertex::Vertex ( ) {} - Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} - Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} - Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} - - Face Vertex::f(size_t i) const { // size() is num. array[v->num] the fno's of the neighboring faces - return Face(repr,repr->v_f[idx][i]); + void Vertex::set_phi(float to) { // parameterization + repr->v_phi[idx] = to; } - uchar Vertex::num() const { // number of neighboring faces - return repr->v_num[idx]; + void Vertex::set_origarea(float to) { + repr->v_origarea[idx] = to; } - float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz - return repr->v_dist[idx][i]; + void Vertex::set_group_avg_area(float to) { + repr->v_group_avg_area[idx] = to; } - int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements - return repr->v_dist_capacity[idx]; + void Vertex::set_K(float to) { // Gaussian curvature + repr->v_K[idx] = to; } - float Vertex::x() const { // current coordinates - return repr->v_x[idx]; + void Vertex::set_H(float to) { // mean curvature + repr->v_H[idx] = to; } - float Vertex::y() const { // use MRISsetXYZ() to set - return repr->v_y[idx]; + void Vertex::set_k1(float to) { + repr->v_k1[idx] = to; } - float Vertex::z() const { - return repr->v_z[idx]; + void Vertex::set_k2(float to) { // the principal curvatures + repr->v_k2[idx] = to; } - float Vertex::nx() const { - return repr->v_nx[idx]; + void Vertex::set_mean(float to) { + repr->v_mean[idx] = to; } - float Vertex::ny() const { - return repr->v_ny[idx]; + void Vertex::set_mean_imag(float to) { // imaginary part of complex statistic + repr->v_mean_imag[idx] = to; } - float Vertex::nz() const { // curr normal - return repr->v_nz[idx]; + void Vertex::set_std_error(float to) { + repr->v_std_error[idx] = to; } - float Vertex::area() const { - return repr->v_area[idx]; + void Vertex::set_flags(uint to) { + repr->v_flags[idx] = to; } - char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache - return repr->v_ripflag[idx]; + void Vertex::set_fno(int to) { // face that this vertex is in + repr->v_fno[idx] = to; } - void Vertex::which_coords(int which, float *x, float *y, float *z) const { - - #define CASE(WHICH, FIELD) \ - case WHICH: \ - *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ - break; - - switch (which) { - CASE(CURRENT_VERTICES,) - CASE(VERTEX_NORMALS,n) - default: - *x = *y = *z = 0.0; - ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); - break; - } - - #undef CASE + void Vertex::set_cropped(int to) { + repr->v_cropped[idx] = to; } - - void Vertex::set_f(size_t i, Face to) { // size() is num. array[v->num] the fno's of the neighboring faces - cheapAssert(repr == to.repr); repr->v_f[idx][i] = to.idx; + void Vertex::set_marked(short to) { // for a variety of uses + repr->v_marked[idx] = to; } - void Vertex::set_nx(float to) { - repr->v_nx[idx] = to; + void Vertex::set_marked2(short to) { + repr->v_marked2[idx] = to; } - void Vertex::set_ny(float to) { - repr->v_ny[idx] = to; + void Vertex::set_marked3(short to) { + repr->v_marked3[idx] = to; } - void Vertex::set_nz(float to) { // curr normal - repr->v_nz[idx] = to; + void Vertex::set_neg(char to) { // 1 if the normal vector is inverted + repr->v_neg[idx] = to; } - void Vertex::set_area(float to) { - repr->v_area[idx] = to; + void Vertex::set_border(char to) { // flag + repr->v_border[idx] = to; } void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache repr->v_ripflag[idx] = to; @@ -1429,17 +7243,56 @@ namespace SurfaceFromMRISPV { Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + int Surface::nverticesFrozen() const { // # of vertices on surface is frozen + return repr->nverticesFrozen; + } int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al return repr->nvertices; } int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al return repr->nfaces; } + bool Surface::faceAttachmentDeferred() const { // defer connecting faces to vertices for performance reasons + return repr->faceAttachmentDeferred; + } + int Surface::nedges() const { // # of edges on surface + return repr->nedges; + } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } + int Surface::nstrips() const { + return repr->nstrips; + } Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + return Vertex(repr, i); + } + p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + return repr->dist_storage; + } + p_p_void Surface::dist_orig_storage() const { // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + return repr->dist_orig_storage; + } + int Surface::tempsAssigned() const { // State of various temp fields that can be borrowed if not already in use + return repr->tempsAssigned; } Face Surface::faces(size_t i) const { - return Face(repr,i); + return Face(repr, i); + } + MRI_EDGE Surface::edges(size_t i) const { + return repr->edges[i]; + } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + STRIP Surface::strips(size_t i) const { + return repr->strips[i]; } float Surface::xctr() const { return repr->xctr; @@ -1468,6 +7321,21 @@ namespace SurfaceFromMRISPV { float Surface::zhi() const { return repr->zhi; } + float Surface::x0() const { // center of spherical expansion + return repr->x0; + } + float Surface::y0() const { + return repr->y0; + } + float Surface::z0() const { + return repr->z0; + } + float Surface::max_curv() const { + return repr->max_curv; + } + float Surface::min_curv() const { + return repr->min_curv; + } float Surface::total_area() const { return repr->total_area; } @@ -1480,266 +7348,172 @@ namespace SurfaceFromMRISPV { double Surface::std_vertex_dist() const { return repr->std_vertex_dist; } + float Surface::orig_area() const { + return repr->orig_area; + } float Surface::neg_area() const { return repr->neg_area; } float Surface::neg_orig_area() const { // amount of original surface in folds return repr->neg_orig_area; } - double Surface::radius() const { // radius (if status==MRIS_SPHERE) - return repr->radius; - } - MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) - return repr->status; - } - MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from - return repr->origxyz_status; - } - - void Surface::set_xctr(float to) { - repr->xctr = to; - } - void Surface::set_yctr(float to) { - repr->yctr = to; - } - void Surface::set_zctr(float to) { - repr->zctr = to; - } - void Surface::set_xlo(float to) { - repr->xlo = to; - } - void Surface::set_ylo(float to) { - repr->ylo = to; - } - void Surface::set_zlo(float to) { - repr->zlo = to; - } - void Surface::set_xhi(float to) { - repr->xhi = to; - } - void Surface::set_yhi(float to) { - repr->yhi = to; - } - void Surface::set_zhi(float to) { - repr->zhi = to; - } - void Surface::set_total_area(float to) { - repr->total_area = to; - } - void Surface::set_avg_vertex_area(double to) { - repr->avg_vertex_area = to; - } - void Surface::set_avg_vertex_dist(double to) { // set by MRIScomputeAvgInterVertexDist - repr->avg_vertex_dist = to; - } - void Surface::set_std_vertex_dist(double to) { - repr->std_vertex_dist = to; - } - void Surface::set_neg_area(float to) { - repr->neg_area = to; - } - void Surface::set_neg_orig_area(float to) { // amount of original surface in folds - repr->neg_orig_area = to; - } - - - } // namespace XYZPositionConsequencesM - - - namespace DistortM { - Face::Face ( ) {} - Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} - Face::Face ( Face const & src ) : Repr_Elt(src) {} - Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} - - Vertex Face::v(size_t i) const { - return Vertex(repr,repr->f_v[idx][i]); - } - float Face::area() const { - return repr->f_area[idx]; - } - angles_per_triangle_t Face::angle() const { - return repr->f_angle[idx]; - } - char Face::ripflag() const { - return repr->f_ripflag[idx]; - } - PDMATRIX Face::norm() const { - return repr->f_norm[idx]; - } - - void Face::set_ripflag(char to) { - repr->f_ripflag[idx] = to; + int Surface::zeros() const { + return repr->zeros; } - - - Vertex::Vertex ( ) {} - Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} - Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} - Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} - - Face Vertex::f(size_t i) const { // size() is num. array[v->num] the fno's of the neighboring faces - return Face(repr,repr->v_f[idx][i]); + int Surface::hemisphere() const { // which hemisphere + return repr->hemisphere; } - uchar Vertex::num() const { // number of neighboring faces - return repr->v_num[idx]; + int Surface::initialized() const { + return repr->initialized; } - float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz - return repr->v_dist[idx][i]; + PLTA Surface::lta() const { + return repr->lta; } - int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements - return repr->v_dist_capacity[idx]; + PMATRIX Surface::SRASToTalSRAS_() const { + return repr->SRASToTalSRAS_; } - float Vertex::x() const { // current coordinates - return repr->v_x[idx]; + PMATRIX Surface::TalSRASToSRAS_() const { + return repr->TalSRASToSRAS_; } - float Vertex::y() const { // use MRISsetXYZ() to set - return repr->v_y[idx]; + int Surface::free_transform() const { + return repr->free_transform; } - float Vertex::z() const { - return repr->v_z[idx]; + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; } - float Vertex::nx() const { - return repr->v_nx[idx]; + float Surface::a() const { + return repr->a; } - float Vertex::ny() const { - return repr->v_ny[idx]; + float Surface::b() const { + return repr->b; } - float Vertex::nz() const { // curr normal - return repr->v_nz[idx]; + float Surface::c() const { // ellipsoid parameters + return repr->c; } - float Vertex::area() const { - return repr->v_area[idx]; + MRIS_fname_t Surface::fname() const { // file it was originally loaded from + return repr->fname; } - float Vertex::origarea() const { - return repr->v_origarea[idx]; + float Surface::Hmin() const { // min mean curvature + return repr->Hmin; } - char Vertex::neg() const { // 1 if the normal vector is inverted - return repr->v_neg[idx]; + float Surface::Hmax() const { // max mean curvature + return repr->Hmax; } - char Vertex::border() const { // flag - return repr->v_border[idx]; + float Surface::Kmin() const { // min Gaussian curvature + return repr->Kmin; } - char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache - return repr->v_ripflag[idx]; + float Surface::Kmax() const { // max Gaussian curvature + return repr->Kmax; } - void Vertex::which_coords(int which, float *x, float *y, float *z) const { - - #define CASE(WHICH, FIELD) \ - case WHICH: \ - *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ - break; - - switch (which) { - CASE(CURRENT_VERTICES,) - CASE(VERTEX_NORMALS,n) - default: - *x = *y = *z = 0.0; - ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); - break; - } - - #undef CASE + double Surface::Ktotal() const { // total Gaussian curvature + return repr->Ktotal; } - - void Vertex::set_f(size_t i, Face to) { // size() is num. array[v->num] the fno's of the neighboring faces - cheapAssert(repr == to.repr); repr->v_f[idx][i] = to.idx; + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->status; } - void Vertex::set_nx(float to) { - repr->v_nx[idx] = to; + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; } - void Vertex::set_ny(float to) { - repr->v_ny[idx] = to; + int Surface::patch() const { // if a patch of the surface + return repr->patch; } - void Vertex::set_nz(float to) { // curr normal - repr->v_nz[idx] = to; + int Surface::nlabels() const { + return repr->nlabels; } - void Vertex::set_origarea(float to) { - repr->v_origarea[idx] = to; + PMRIS_AREA_LABEL Surface::labels() const { // nlabels of these (may be null) + return repr->labels; } - void Vertex::set_neg(char to) { // 1 if the normal vector is inverted - repr->v_neg[idx] = to; + p_void Surface::vp() const { // for misc. use + return repr->vp; } - void Vertex::set_border(char to) { // flag - repr->v_border[idx] = to; + float Surface::alpha() const { // rotation around z-axis + return repr->alpha; } - void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache - repr->v_ripflag[idx] = to; + float Surface::beta() const { // rotation around y-axis + return repr->beta; } - - - Surface::Surface ( ) {} - Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} - Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} - Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} - - int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - return repr->nvertices; + float Surface::gamma() const { // rotation around x-axis + return repr->gamma; } - int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - return repr->nfaces; + float Surface::da() const { + return repr->da; } - Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + float Surface::db() const { + return repr->db; } - Face Surface::faces(size_t i) const { - return Face(repr,i); + float Surface::dg() const { // old deltas + return repr->dg; } - float Surface::xctr() const { - return repr->xctr; + int Surface::type() const { // what type of surface was this initially + return repr->type; } - float Surface::yctr() const { - return repr->yctr; + int Surface::max_vertices() const { // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + return repr->max_vertices; } - float Surface::zctr() const { - return repr->zctr; + int Surface::max_faces() const { // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + return repr->max_faces; } - float Surface::xlo() const { - return repr->xlo; + MRIS_subject_name_t Surface::subject_name() const { // name of the subject + return repr->subject_name; } - float Surface::ylo() const { - return repr->ylo; + float Surface::canon_area() const { + return repr->canon_area; } - float Surface::zlo() const { - return repr->zlo; + int Surface::noscale() const { // don't scale by surface area if true + return repr->noscale; } - float Surface::xhi() const { - return repr->xhi; + float Surface::dx2(size_t i) const { // an extra set of gradient (not always alloced) + return repr->dx2[i]; } - float Surface::yhi() const { - return repr->yhi; + float Surface::dy2(size_t i) const { + return repr->dy2[i]; } - float Surface::zhi() const { - return repr->zhi; + float Surface::dz2(size_t i) const { + return repr->dz2[i]; } - float Surface::total_area() const { - return repr->total_area; + PCOLOR_TABLE Surface::ct() const { + return repr->ct; } - double Surface::avg_vertex_area() const { - return repr->avg_vertex_area; + int Surface::useRealRAS() const { // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + return repr->useRealRAS; } - double Surface::avg_vertex_dist() const { // set by MRIScomputeAvgInterVertexDist - return repr->avg_vertex_dist; + VOL_GEOM Surface::vg() const { // volume info from which this surface is created. valid iff vg.valid = 1 + return repr->vg; } - double Surface::std_vertex_dist() const { - return repr->std_vertex_dist; + MRIS_cmdlines_t Surface::cmdlines() const { + return repr->cmdlines; } - float Surface::neg_area() const { - return repr->neg_area; + int Surface::ncmds() const { + return repr->ncmds; } - float Surface::neg_orig_area() const { // amount of original surface in folds - return repr->neg_orig_area; + float Surface::group_avg_surface_area() const { // average of total surface area for group + return repr->group_avg_surface_area; } - double Surface::radius() const { // radius (if status==MRIS_SPHERE) - return repr->radius; + int Surface::group_avg_vtxarea_loaded() const { // average vertex area for group at each vertex + return repr->group_avg_vtxarea_loaded; } - MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) - return repr->status; + int Surface::triangle_links_removed() const { // for quad surfaces + return repr->triangle_links_removed; } - MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from - return repr->origxyz_status; + p_void Surface::user_parms() const { // for whatever the user wants to hang here + return repr->user_parms; + } + PMATRIX Surface::m_sras2vox() const { // for converting surface ras to voxel + return repr->m_sras2vox; + } + PMRI Surface::mri_sras2vox() const { // volume that the above matrix is for + return repr->mri_sras2vox; + } + p_void Surface::mht() const { + return repr->mht; + } + p_void Surface::temps() const { + return repr->temps; } + void Surface::set_strips(size_t i, STRIP to) { + repr->strips[i] = to; + } void Surface::set_xctr(float to) { repr->xctr = to; } @@ -1767,22 +7541,87 @@ namespace SurfaceFromMRISPV { void Surface::set_zhi(float to) { repr->zhi = to; } + void Surface::set_x0(float to) { // center of spherical expansion + repr->x0 = to; + } + void Surface::set_y0(float to) { + repr->y0 = to; + } + void Surface::set_z0(float to) { + repr->z0 = to; + } + void Surface::set_max_curv(float to) { + repr->max_curv = to; + } + void Surface::set_min_curv(float to) { + repr->min_curv = to; + } void Surface::set_total_area(float to) { repr->total_area = to; } void Surface::set_avg_vertex_area(double to) { repr->avg_vertex_area = to; } + void Surface::set_zeros(int to) { + repr->zeros = to; + } + void Surface::set_hemisphere(int to) { // which hemisphere + repr->hemisphere = to; + } + void Surface::set_Hmin(float to) { // min mean curvature + repr->Hmin = to; + } + void Surface::set_Hmax(float to) { // max mean curvature + repr->Hmax = to; + } + void Surface::set_Kmin(float to) { // min Gaussian curvature + repr->Kmin = to; + } + void Surface::set_Kmax(float to) { // max Gaussian curvature + repr->Kmax = to; + } + void Surface::set_Ktotal(double to) { // total Gaussian curvature + repr->Ktotal = to; + } + void Surface::set_nlabels(int to) { + repr->nlabels = to; + } + void Surface::set_labels(PMRIS_AREA_LABEL to) { // nlabels of these (may be null) + repr->labels = to; + } + void Surface::set_vp(p_void to) { // for misc. use + repr->vp = to; + } + void Surface::set_alpha(float to) { // rotation around z-axis + repr->alpha = to; + } + void Surface::set_beta(float to) { // rotation around y-axis + repr->beta = to; + } + void Surface::set_gamma(float to) { // rotation around x-axis + repr->gamma = to; + } + void Surface::set_da(float to) { + repr->da = to; + } + void Surface::set_db(float to) { + repr->db = to; + } + void Surface::set_dg(float to) { // old deltas + repr->dg = to; + } + void Surface::set_type(int to) { // what type of surface was this initially + repr->type = to; + } - } // namespace DistortM + } // namespace AnalysisM - namespace AnalysisM { + namespace AllM { Face::Face ( ) {} Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} Face::Face ( Face const & src ) : Repr_Elt(src) {} - Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} Vertex Face::v(size_t i) const { return Vertex(repr,repr->f_v[idx][i]); @@ -1793,25 +7632,90 @@ namespace SurfaceFromMRISPV { angles_per_triangle_t Face::angle() const { return repr->f_angle[idx]; } + angles_per_triangle_t Face::orig_angle() const { + return repr->f_orig_angle[idx]; + } char Face::ripflag() const { return repr->f_ripflag[idx]; } + char Face::oripflag() const { + return repr->f_oripflag[idx]; + } + int Face::marked() const { + return repr->f_marked[idx]; + } PDMATRIX Face::norm() const { return repr->f_norm[idx]; } + A3PDMATRIX Face::gradNorm() const { + return repr->f_gradNorm[idx]; + } + void Face::set_v(size_t i, Vertex to) { + cheapAssert(repr == to.repr); repr->f_v[idx][i] = to.idx; + } + void Face::set_area(float to) { + repr->f_area[idx] = to; + } + void Face::set_angle(angles_per_triangle_t to) { + repr->f_angle[idx] = to; + } + void Face::set_orig_angle(angles_per_triangle_t to) { + repr->f_orig_angle[idx] = to; + } void Face::set_ripflag(char to) { repr->f_ripflag[idx] = to; } + void Face::set_oripflag(char to) { + repr->f_oripflag[idx] = to; + } + void Face::set_marked(int to) { + repr->f_marked[idx] = to; + } + void Face::set_norm(PDMATRIX to) { + repr->f_norm[idx] = to; + } + void Face::set_gradNorm(A3PDMATRIX to) { + repr->f_gradNorm[idx] = to; + } Vertex::Vertex ( ) {} Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} - Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} Face Vertex::f(size_t i) const { // size() is num. array[v->num] the fno's of the neighboring faces - return Face(repr,repr->v_f[idx][i]); + return Face(repr, repr->v_f[idx][i]); + } + size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex + return repr->v_n[idx][i]; + } + int Vertex::e(size_t i) const { // edge state for neighboring vertices + return repr->v_e[idx][i]; + } + Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + return Vertex(repr,repr->v_v[idx][i]); + } + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) + return repr->v_vnum[idx]; + } + short Vertex::v2num() const { // number of 1, or 2-hop neighbors + return repr->v_v2num[idx]; + } + short Vertex::v3num() const { // number of 1,2,or 3-hop neighbors + return repr->v_v3num[idx]; + } + short Vertex::vtotal() const { // total # of neighbors. copy of vnum.nsizeCur + return repr->v_vtotal[idx]; + } + short Vertex::nsizeMaxClock() const { // copy of mris->nsizeMaxClock when v#num + return repr->v_nsizeMaxClock[idx]; + } + uchar Vertex::nsizeMax() const { // the max nsize that was used to fill in vnum etc + return repr->v_nsizeMax[idx]; + } + uchar Vertex::nsizeCur() const { // index of the current v#num in vtotal + return repr->v_nsizeCur[idx]; } uchar Vertex::num() const { // number of neighboring faces return repr->v_num[idx]; @@ -1819,9 +7723,15 @@ namespace SurfaceFromMRISPV { float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz return repr->v_dist[idx][i]; } + float Vertex::dist_orig(size_t i) const { // size() is vtotal. distance to neighboring vertices based on origxyz + return repr->v_dist_orig[idx][i]; + } int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements return repr->v_dist_capacity[idx]; } + int Vertex::dist_orig_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_orig_capacity[idx]; + } float Vertex::x() const { // current coordinates return repr->v_x[idx]; } @@ -1831,6 +7741,15 @@ namespace SurfaceFromMRISPV { float Vertex::z() const { return repr->v_z[idx]; } + float Vertex::origx() const { // original coordinates, see also MRIS::origxyz_status + return repr->v_origx[idx]; + } + float Vertex::origy() const { // use MRISsetOriginalXYZ(, + return repr->v_origy[idx]; + } + float Vertex::origz() const { // or MRISsetOriginalXYZfromXYZ to set + return repr->v_origz[idx]; + } float Vertex::nx() const { return repr->v_nx[idx]; } @@ -1840,247 +7759,257 @@ namespace SurfaceFromMRISPV { float Vertex::nz() const { // curr normal return repr->v_nz[idx]; } - float Vertex::area() const { - return repr->v_area[idx]; + float Vertex::pnx() const { + return repr->v_pnx[idx]; } - float Vertex::origarea() const { - return repr->v_origarea[idx]; + float Vertex::pny() const { + return repr->v_pny[idx]; } - char Vertex::neg() const { // 1 if the normal vector is inverted - return repr->v_neg[idx]; + float Vertex::pnz() const { // pial normal + return repr->v_pnz[idx]; } - char Vertex::border() const { // flag - return repr->v_border[idx]; + float Vertex::wnx() const { + return repr->v_wnx[idx]; } - char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache - return repr->v_ripflag[idx]; + float Vertex::wny() const { + return repr->v_wny[idx]; } - void Vertex::which_coords(int which, float *x, float *y, float *z) const { - - #define CASE(WHICH, FIELD) \ - case WHICH: \ - *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ - break; - - switch (which) { - CASE(CURRENT_VERTICES,) - CASE(VERTEX_NORMALS,n) - default: - *x = *y = *z = 0.0; - ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); - break; - } - - #undef CASE + float Vertex::wnz() const { // white normal + return repr->v_wnz[idx]; } - - void Vertex::set_f(size_t i, Face to) { // size() is num. array[v->num] the fno's of the neighboring faces - cheapAssert(repr == to.repr); repr->v_f[idx][i] = to.idx; + float Vertex::onx() const { + return repr->v_onx[idx]; } - void Vertex::set_nx(float to) { - repr->v_nx[idx] = to; + float Vertex::ony() const { + return repr->v_ony[idx]; } - void Vertex::set_ny(float to) { - repr->v_ny[idx] = to; + float Vertex::onz() const { // original normal + return repr->v_onz[idx]; } - void Vertex::set_nz(float to) { // curr normal - repr->v_nz[idx] = to; + float Vertex::dx() const { + return repr->v_dx[idx]; } - void Vertex::set_origarea(float to) { - repr->v_origarea[idx] = to; + float Vertex::dy() const { + return repr->v_dy[idx]; } - void Vertex::set_neg(char to) { // 1 if the normal vector is inverted - repr->v_neg[idx] = to; + float Vertex::dz() const { // current change in position + return repr->v_dz[idx]; } - void Vertex::set_border(char to) { // flag - repr->v_border[idx] = to; + float Vertex::odx() const { + return repr->v_odx[idx]; } - void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache - repr->v_ripflag[idx] = to; + float Vertex::ody() const { + return repr->v_ody[idx]; } - - - Surface::Surface ( ) {} - Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} - Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} - Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} - - int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - return repr->nvertices; + float Vertex::odz() const { // last change of position (for momentum, + return repr->v_odz[idx]; } - int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - return repr->nfaces; + float Vertex::tdx() const { + return repr->v_tdx[idx]; } - Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + float Vertex::tdy() const { + return repr->v_tdy[idx]; } - Face Surface::faces(size_t i) const { - return Face(repr,i); + float Vertex::tdz() const { // temporary storage for averaging gradient + return repr->v_tdz[idx]; } - float Surface::xctr() const { - return repr->xctr; + float Vertex::curv() const { // curr curvature + return repr->v_curv[idx]; } - float Surface::yctr() const { - return repr->yctr; + float Vertex::curvbak() const { + return repr->v_curvbak[idx]; } - float Surface::zctr() const { - return repr->zctr; + float Vertex::val() const { // scalar data value (file: rh.val, sig2-rh.w) + return repr->v_val[idx]; } - float Surface::xlo() const { - return repr->xlo; + float Vertex::imag_val() const { // imaginary part of complex data value + return repr->v_imag_val[idx]; } - float Surface::ylo() const { - return repr->ylo; + float Vertex::cx() const { + return repr->v_cx[idx]; } - float Surface::zlo() const { - return repr->zlo; + float Vertex::cy() const { + return repr->v_cy[idx]; } - float Surface::xhi() const { - return repr->xhi; + float Vertex::cz() const { // coordinates in canonical coordinate system + return repr->v_cz[idx]; } - float Surface::yhi() const { - return repr->yhi; + float Vertex::tx() const { + return repr->v_tx[idx]; } - float Surface::zhi() const { - return repr->zhi; + float Vertex::ty() const { + return repr->v_ty[idx]; } - float Surface::total_area() const { - return repr->total_area; + float Vertex::tz() const { // tmp coordinate storage + return repr->v_tz[idx]; } - double Surface::avg_vertex_area() const { - return repr->avg_vertex_area; + float Vertex::t2x() const { + return repr->v_t2x[idx]; } - double Surface::avg_vertex_dist() const { // set by MRIScomputeAvgInterVertexDist - return repr->avg_vertex_dist; + float Vertex::t2y() const { + return repr->v_t2y[idx]; } - double Surface::std_vertex_dist() const { - return repr->std_vertex_dist; + float Vertex::t2z() const { // another tmp coordinate storage + return repr->v_t2z[idx]; } - float Surface::neg_area() const { - return repr->neg_area; + float Vertex::targx() const { + return repr->v_targx[idx]; } - float Surface::neg_orig_area() const { // amount of original surface in folds - return repr->neg_orig_area; + float Vertex::targy() const { + return repr->v_targy[idx]; } - double Surface::radius() const { // radius (if status==MRIS_SPHERE) - return repr->radius; + float Vertex::targz() const { // target coordinates + return repr->v_targz[idx]; } - MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) - return repr->status; + float Vertex::pialx() const { + return repr->v_pialx[idx]; } - MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from - return repr->origxyz_status; + float Vertex::pialy() const { + return repr->v_pialy[idx]; } - - void Surface::set_xctr(float to) { - repr->xctr = to; + float Vertex::pialz() const { // pial surface coordinates + return repr->v_pialz[idx]; } - void Surface::set_yctr(float to) { - repr->yctr = to; + float Vertex::whitex() const { + return repr->v_whitex[idx]; } - void Surface::set_zctr(float to) { - repr->zctr = to; + float Vertex::whitey() const { + return repr->v_whitey[idx]; } - void Surface::set_xlo(float to) { - repr->xlo = to; + float Vertex::whitez() const { // white surface coordinates + return repr->v_whitez[idx]; } - void Surface::set_ylo(float to) { - repr->ylo = to; + float Vertex::l4x() const { + return repr->v_l4x[idx]; } - void Surface::set_zlo(float to) { - repr->zlo = to; + float Vertex::l4y() const { + return repr->v_l4y[idx]; } - void Surface::set_xhi(float to) { - repr->xhi = to; + float Vertex::l4z() const { // layerIV surface coordinates + return repr->v_l4z[idx]; } - void Surface::set_yhi(float to) { - repr->yhi = to; + float Vertex::infx() const { + return repr->v_infx[idx]; } - void Surface::set_zhi(float to) { - repr->zhi = to; + float Vertex::infy() const { + return repr->v_infy[idx]; } - void Surface::set_total_area(float to) { - repr->total_area = to; + float Vertex::infz() const { // inflated coordinates + return repr->v_infz[idx]; } - void Surface::set_avg_vertex_area(double to) { - repr->avg_vertex_area = to; + float Vertex::fx() const { + return repr->v_fx[idx]; } - - - } // namespace AnalysisM - - - namespace AllM { - Face::Face ( ) {} - Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} - Face::Face ( Face const & src ) : Repr_Elt(src) {} - - Vertex Face::v(size_t i) const { - return Vertex(repr,repr->f_v[idx][i]); + float Vertex::fy() const { + return repr->v_fy[idx]; } - float Face::area() const { - return repr->f_area[idx]; + float Vertex::fz() const { // flattened coordinates + return repr->v_fz[idx]; } - angles_per_triangle_t Face::angle() const { - return repr->f_angle[idx]; + int Vertex::px() const { + return repr->v_px[idx]; + } + int Vertex::qx() const { + return repr->v_qx[idx]; + } + int Vertex::py() const { + return repr->v_py[idx]; + } + int Vertex::qy() const { + return repr->v_qy[idx]; + } + int Vertex::pz() const { + return repr->v_pz[idx]; + } + int Vertex::qz() const { // rational coordinates for exact calculations + return repr->v_qz[idx]; + } + float Vertex::e1x() const { + return repr->v_e1x[idx]; + } + float Vertex::e1y() const { + return repr->v_e1y[idx]; + } + float Vertex::e1z() const { // 1st basis vector for the local tangent plane + return repr->v_e1z[idx]; + } + float Vertex::e2x() const { + return repr->v_e2x[idx]; + } + float Vertex::e2y() const { + return repr->v_e2y[idx]; + } + float Vertex::e2z() const { // 2nd basis vector for the local tangent plane + return repr->v_e2z[idx]; + } + float Vertex::pe1x() const { + return repr->v_pe1x[idx]; + } + float Vertex::pe1y() const { + return repr->v_pe1y[idx]; + } + float Vertex::pe1z() const { // 1st basis vector for the local tangent plane + return repr->v_pe1z[idx]; + } + float Vertex::pe2x() const { + return repr->v_pe2x[idx]; + } + float Vertex::pe2y() const { + return repr->v_pe2y[idx]; } - char Face::ripflag() const { - return repr->f_ripflag[idx]; + float Vertex::pe2z() const { // 2nd basis vector for the local tangent plane + return repr->v_pe2z[idx]; } - PDMATRIX Face::norm() const { - return repr->f_norm[idx]; + float Vertex::nc() const { // curr length normal comp + return repr->v_nc[idx]; } - - void Face::set_v(size_t i, Vertex to) { - cheapAssert(repr == to.repr); repr->f_v[idx][i] = to.idx; + float Vertex::val2() const { // complex comp data value (file: sig3-rh.w) + return repr->v_val2[idx]; } - void Face::set_area(float to) { - repr->f_area[idx] = to; + float Vertex::valbak() const { // scalar data stack + return repr->v_valbak[idx]; } - void Face::set_angle(angles_per_triangle_t to) { - repr->f_angle[idx] = to; + float Vertex::val2bak() const { // complex comp data stack + return repr->v_val2bak[idx]; } - void Face::set_ripflag(char to) { - repr->f_ripflag[idx] = to; + float Vertex::stat() const { // statistic + return repr->v_stat[idx]; } - void Face::set_norm(PDMATRIX to) { - repr->f_norm[idx] = to; + int Vertex::undefval() const { // [previously dist=0] + return repr->v_undefval[idx]; } - - - Vertex::Vertex ( ) {} - Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} - Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} - - Face Vertex::f(size_t i) const { // size() is num. array[v->num] the fno's of the neighboring faces - return Face(repr,repr->v_f[idx][i]); + int Vertex::old_undefval() const { // for smooth_val_sparse + return repr->v_old_undefval[idx]; } - uchar Vertex::num() const { // number of neighboring faces - return repr->v_num[idx]; + int Vertex::fixedval() const { // [previously val=0] + return repr->v_fixedval[idx]; } - float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz - return repr->v_dist[idx][i]; + float Vertex::fieldsign() const { // fieldsign--final: -1, "0", "1" (file: rh.fs) + return repr->v_fieldsign[idx]; } - int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements - return repr->v_dist_capacity[idx]; + float Vertex::fsmask() const { // significance mask (file: rh.fm) + return repr->v_fsmask[idx]; } - float Vertex::x() const { // current coordinates - return repr->v_x[idx]; + float Vertex::d() const { // for distance calculations + return repr->v_d[idx]; } - float Vertex::y() const { // use MRISsetXYZ() to set - return repr->v_y[idx]; + int Vertex::annotation() const { // area label (defunct--now from label file name!) + return repr->v_annotation[idx]; } - float Vertex::z() const { - return repr->v_z[idx]; + char Vertex::oripflag() const { + return repr->v_oripflag[idx]; } - float Vertex::nx() const { - return repr->v_nx[idx]; + char Vertex::origripflag() const { // cuts flags + return repr->v_origripflag[idx]; } - float Vertex::ny() const { - return repr->v_ny[idx]; + p_void Vertex::vp() const { // to store user's information + return repr->v_vp[idx]; } - float Vertex::nz() const { // curr normal - return repr->v_nz[idx]; + float Vertex::theta() const { + return repr->v_theta[idx]; + } + float Vertex::phi() const { // parameterization + return repr->v_phi[idx]; } float Vertex::area() const { return repr->v_area[idx]; @@ -2088,6 +8017,48 @@ namespace SurfaceFromMRISPV { float Vertex::origarea() const { return repr->v_origarea[idx]; } + float Vertex::group_avg_area() const { + return repr->v_group_avg_area[idx]; + } + float Vertex::K() const { // Gaussian curvature + return repr->v_K[idx]; + } + float Vertex::H() const { // mean curvature + return repr->v_H[idx]; + } + float Vertex::k1() const { + return repr->v_k1[idx]; + } + float Vertex::k2() const { // the principal curvatures + return repr->v_k2[idx]; + } + float Vertex::mean() const { + return repr->v_mean[idx]; + } + float Vertex::mean_imag() const { // imaginary part of complex statistic + return repr->v_mean_imag[idx]; + } + float Vertex::std_error() const { + return repr->v_std_error[idx]; + } + uint Vertex::flags() const { + return repr->v_flags[idx]; + } + int Vertex::fno() const { // face that this vertex is in + return repr->v_fno[idx]; + } + int Vertex::cropped() const { + return repr->v_cropped[idx]; + } + short Vertex::marked() const { // for a variety of uses + return repr->v_marked[idx]; + } + short Vertex::marked2() const { + return repr->v_marked2[idx]; + } + short Vertex::marked3() const { + return repr->v_marked3[idx]; + } char Vertex::neg() const { // 1 if the normal vector is inverted return repr->v_neg[idx]; } @@ -2106,7 +8077,17 @@ namespace SurfaceFromMRISPV { switch (which) { CASE(CURRENT_VERTICES,) + CASE(ORIGINAL_VERTICES,orig) CASE(VERTEX_NORMALS,n) + CASE(PIAL_NORMALS,pn) + CASE(WHITE_NORMALS,wn) + CASE(CANONICAL_VERTICES,c) + CASE(TMP_VERTICES,t) + CASE(TMP2_VERTICES,t2) + CASE(PIAL_VERTICES,pial) + CASE(WHITE_VERTICES,white) + CASE(INFLATED_VERTICES,inf) + CASE(FLATTENED_VERTICES,f) default: *x = *y = *z = 0.0; ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); @@ -2119,6 +8100,36 @@ namespace SurfaceFromMRISPV { void Vertex::set_f(size_t i, Face to) { // size() is num. array[v->num] the fno's of the neighboring faces cheapAssert(repr == to.repr); repr->v_f[idx][i] = to.idx; } + void Vertex::set_n(size_t i, size_t to) { // size() is num. array[v->num] the face.v[*] index for this vertex + repr->v_n[idx][i] = uchar(to); + } + void Vertex::set_e(size_t i, int to) { // edge state for neighboring vertices + repr->v_e[idx][i] = to; + } + void Vertex::set_v(size_t i, Vertex to) { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + cheapAssert(repr == to.repr); repr->v_v[idx][i] = to.idx; + } + void Vertex::set_vnum(short to) { // number of 1-hop neighbors should use [p]VERTEXvnum(i) + repr->v_vnum[idx] = to; + } + void Vertex::set_v2num(short to) { // number of 1, or 2-hop neighbors + repr->v_v2num[idx] = to; + } + void Vertex::set_v3num(short to) { // number of 1,2,or 3-hop neighbors + repr->v_v3num[idx] = to; + } + void Vertex::set_vtotal(short to) { // total # of neighbors. copy of vnum.nsizeCur + repr->v_vtotal[idx] = to; + } + void Vertex::set_nsizeMaxClock(short to) { // copy of mris->nsizeMaxClock when v#num + repr->v_nsizeMaxClock[idx] = to; + } + void Vertex::set_nsizeMax(uchar to) { // the max nsize that was used to fill in vnum etc + repr->v_nsizeMax[idx] = to; + } + void Vertex::set_nsizeCur(uchar to) { // index of the current v#num in vtotal + repr->v_nsizeCur[idx] = to; + } void Vertex::set_num(uchar to) { // number of neighboring faces repr->v_num[idx] = to; } @@ -2140,12 +8151,306 @@ namespace SurfaceFromMRISPV { void Vertex::set_nz(float to) { // curr normal repr->v_nz[idx] = to; } + void Vertex::set_pnx(float to) { + repr->v_pnx[idx] = to; + } + void Vertex::set_pny(float to) { + repr->v_pny[idx] = to; + } + void Vertex::set_pnz(float to) { // pial normal + repr->v_pnz[idx] = to; + } + void Vertex::set_wnx(float to) { + repr->v_wnx[idx] = to; + } + void Vertex::set_wny(float to) { + repr->v_wny[idx] = to; + } + void Vertex::set_wnz(float to) { // white normal + repr->v_wnz[idx] = to; + } + void Vertex::set_onx(float to) { + repr->v_onx[idx] = to; + } + void Vertex::set_ony(float to) { + repr->v_ony[idx] = to; + } + void Vertex::set_onz(float to) { // original normal + repr->v_onz[idx] = to; + } + void Vertex::set_dx(float to) { + repr->v_dx[idx] = to; + } + void Vertex::set_dy(float to) { + repr->v_dy[idx] = to; + } + void Vertex::set_dz(float to) { // current change in position + repr->v_dz[idx] = to; + } + void Vertex::set_odx(float to) { + repr->v_odx[idx] = to; + } + void Vertex::set_ody(float to) { + repr->v_ody[idx] = to; + } + void Vertex::set_odz(float to) { // last change of position (for momentum, + repr->v_odz[idx] = to; + } + void Vertex::set_tdx(float to) { + repr->v_tdx[idx] = to; + } + void Vertex::set_tdy(float to) { + repr->v_tdy[idx] = to; + } + void Vertex::set_tdz(float to) { // temporary storage for averaging gradient + repr->v_tdz[idx] = to; + } + void Vertex::set_curv(float to) { // curr curvature + repr->v_curv[idx] = to; + } + void Vertex::set_curvbak(float to) { + repr->v_curvbak[idx] = to; + } + void Vertex::set_val(float to) { // scalar data value (file: rh.val, sig2-rh.w) + repr->v_val[idx] = to; + } + void Vertex::set_imag_val(float to) { // imaginary part of complex data value + repr->v_imag_val[idx] = to; + } + void Vertex::set_cx(float to) { + repr->v_cx[idx] = to; + } + void Vertex::set_cy(float to) { + repr->v_cy[idx] = to; + } + void Vertex::set_cz(float to) { // coordinates in canonical coordinate system + repr->v_cz[idx] = to; + } + void Vertex::set_tx(float to) { + repr->v_tx[idx] = to; + } + void Vertex::set_ty(float to) { + repr->v_ty[idx] = to; + } + void Vertex::set_tz(float to) { // tmp coordinate storage + repr->v_tz[idx] = to; + } + void Vertex::set_t2x(float to) { + repr->v_t2x[idx] = to; + } + void Vertex::set_t2y(float to) { + repr->v_t2y[idx] = to; + } + void Vertex::set_t2z(float to) { // another tmp coordinate storage + repr->v_t2z[idx] = to; + } + void Vertex::set_targx(float to) { + repr->v_targx[idx] = to; + } + void Vertex::set_targy(float to) { + repr->v_targy[idx] = to; + } + void Vertex::set_targz(float to) { // target coordinates + repr->v_targz[idx] = to; + } + void Vertex::set_pialx(float to) { + repr->v_pialx[idx] = to; + } + void Vertex::set_pialy(float to) { + repr->v_pialy[idx] = to; + } + void Vertex::set_pialz(float to) { // pial surface coordinates + repr->v_pialz[idx] = to; + } + void Vertex::set_whitex(float to) { + repr->v_whitex[idx] = to; + } + void Vertex::set_whitey(float to) { + repr->v_whitey[idx] = to; + } + void Vertex::set_whitez(float to) { // white surface coordinates + repr->v_whitez[idx] = to; + } + void Vertex::set_l4x(float to) { + repr->v_l4x[idx] = to; + } + void Vertex::set_l4y(float to) { + repr->v_l4y[idx] = to; + } + void Vertex::set_l4z(float to) { // layerIV surface coordinates + repr->v_l4z[idx] = to; + } + void Vertex::set_infx(float to) { + repr->v_infx[idx] = to; + } + void Vertex::set_infy(float to) { + repr->v_infy[idx] = to; + } + void Vertex::set_infz(float to) { // inflated coordinates + repr->v_infz[idx] = to; + } + void Vertex::set_fx(float to) { + repr->v_fx[idx] = to; + } + void Vertex::set_fy(float to) { + repr->v_fy[idx] = to; + } + void Vertex::set_fz(float to) { // flattened coordinates + repr->v_fz[idx] = to; + } + void Vertex::set_px(int to) { + repr->v_px[idx] = to; + } + void Vertex::set_qx(int to) { + repr->v_qx[idx] = to; + } + void Vertex::set_py(int to) { + repr->v_py[idx] = to; + } + void Vertex::set_qy(int to) { + repr->v_qy[idx] = to; + } + void Vertex::set_pz(int to) { + repr->v_pz[idx] = to; + } + void Vertex::set_qz(int to) { // rational coordinates for exact calculations + repr->v_qz[idx] = to; + } + void Vertex::set_e1x(float to) { + repr->v_e1x[idx] = to; + } + void Vertex::set_e1y(float to) { + repr->v_e1y[idx] = to; + } + void Vertex::set_e1z(float to) { // 1st basis vector for the local tangent plane + repr->v_e1z[idx] = to; + } + void Vertex::set_e2x(float to) { + repr->v_e2x[idx] = to; + } + void Vertex::set_e2y(float to) { + repr->v_e2y[idx] = to; + } + void Vertex::set_e2z(float to) { // 2nd basis vector for the local tangent plane + repr->v_e2z[idx] = to; + } + void Vertex::set_pe1x(float to) { + repr->v_pe1x[idx] = to; + } + void Vertex::set_pe1y(float to) { + repr->v_pe1y[idx] = to; + } + void Vertex::set_pe1z(float to) { // 1st basis vector for the local tangent plane + repr->v_pe1z[idx] = to; + } + void Vertex::set_pe2x(float to) { + repr->v_pe2x[idx] = to; + } + void Vertex::set_pe2y(float to) { + repr->v_pe2y[idx] = to; + } + void Vertex::set_pe2z(float to) { // 2nd basis vector for the local tangent plane + repr->v_pe2z[idx] = to; + } + void Vertex::set_nc(float to) { // curr length normal comp + repr->v_nc[idx] = to; + } + void Vertex::set_val2(float to) { // complex comp data value (file: sig3-rh.w) + repr->v_val2[idx] = to; + } + void Vertex::set_valbak(float to) { // scalar data stack + repr->v_valbak[idx] = to; + } + void Vertex::set_val2bak(float to) { // complex comp data stack + repr->v_val2bak[idx] = to; + } + void Vertex::set_stat(float to) { // statistic + repr->v_stat[idx] = to; + } + void Vertex::set_undefval(int to) { // [previously dist=0] + repr->v_undefval[idx] = to; + } + void Vertex::set_old_undefval(int to) { // for smooth_val_sparse + repr->v_old_undefval[idx] = to; + } + void Vertex::set_fixedval(int to) { // [previously val=0] + repr->v_fixedval[idx] = to; + } + void Vertex::set_fieldsign(float to) { // fieldsign--final: -1, "0", "1" (file: rh.fs) + repr->v_fieldsign[idx] = to; + } + void Vertex::set_fsmask(float to) { // significance mask (file: rh.fm) + repr->v_fsmask[idx] = to; + } + void Vertex::set_d(float to) { // for distance calculations + repr->v_d[idx] = to; + } + void Vertex::set_annotation(int to) { // area label (defunct--now from label file name!) + repr->v_annotation[idx] = to; + } + void Vertex::set_oripflag(char to) { + repr->v_oripflag[idx] = to; + } + void Vertex::set_origripflag(char to) { // cuts flags + repr->v_origripflag[idx] = to; + } + void Vertex::set_vp(p_void to) { // to store user's information + repr->v_vp[idx] = to; + } + void Vertex::set_theta(float to) { + repr->v_theta[idx] = to; + } + void Vertex::set_phi(float to) { // parameterization + repr->v_phi[idx] = to; + } void Vertex::set_area(float to) { repr->v_area[idx] = to; } void Vertex::set_origarea(float to) { repr->v_origarea[idx] = to; } + void Vertex::set_group_avg_area(float to) { + repr->v_group_avg_area[idx] = to; + } + void Vertex::set_K(float to) { // Gaussian curvature + repr->v_K[idx] = to; + } + void Vertex::set_H(float to) { // mean curvature + repr->v_H[idx] = to; + } + void Vertex::set_k1(float to) { + repr->v_k1[idx] = to; + } + void Vertex::set_k2(float to) { // the principal curvatures + repr->v_k2[idx] = to; + } + void Vertex::set_mean(float to) { + repr->v_mean[idx] = to; + } + void Vertex::set_mean_imag(float to) { // imaginary part of complex statistic + repr->v_mean_imag[idx] = to; + } + void Vertex::set_std_error(float to) { + repr->v_std_error[idx] = to; + } + void Vertex::set_flags(uint to) { + repr->v_flags[idx] = to; + } + void Vertex::set_fno(int to) { // face that this vertex is in + repr->v_fno[idx] = to; + } + void Vertex::set_cropped(int to) { + repr->v_cropped[idx] = to; + } + void Vertex::set_marked(short to) { // for a variety of uses + repr->v_marked[idx] = to; + } + void Vertex::set_marked2(short to) { + repr->v_marked2[idx] = to; + } + void Vertex::set_marked3(short to) { + repr->v_marked3[idx] = to; + } void Vertex::set_neg(char to) { // 1 if the normal vector is inverted repr->v_neg[idx] = to; } @@ -2161,17 +8466,56 @@ namespace SurfaceFromMRISPV { Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + int Surface::nverticesFrozen() const { // # of vertices on surface is frozen + return repr->nverticesFrozen; + } int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al return repr->nvertices; } int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al return repr->nfaces; } + bool Surface::faceAttachmentDeferred() const { // defer connecting faces to vertices for performance reasons + return repr->faceAttachmentDeferred; + } + int Surface::nedges() const { // # of edges on surface + return repr->nedges; + } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } + int Surface::nstrips() const { + return repr->nstrips; + } Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + return Vertex(repr, i); + } + p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + return repr->dist_storage; + } + p_p_void Surface::dist_orig_storage() const { // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + return repr->dist_orig_storage; + } + int Surface::tempsAssigned() const { // State of various temp fields that can be borrowed if not already in use + return repr->tempsAssigned; } Face Surface::faces(size_t i) const { - return Face(repr,i); + return Face(repr, i); + } + MRI_EDGE Surface::edges(size_t i) const { + return repr->edges[i]; + } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + STRIP Surface::strips(size_t i) const { + return repr->strips[i]; } float Surface::xctr() const { return repr->xctr; @@ -2200,6 +8544,21 @@ namespace SurfaceFromMRISPV { float Surface::zhi() const { return repr->zhi; } + float Surface::x0() const { // center of spherical expansion + return repr->x0; + } + float Surface::y0() const { + return repr->y0; + } + float Surface::z0() const { + return repr->z0; + } + float Surface::max_curv() const { + return repr->max_curv; + } + float Surface::min_curv() const { + return repr->min_curv; + } float Surface::total_area() const { return repr->total_area; } @@ -2212,22 +8571,172 @@ namespace SurfaceFromMRISPV { double Surface::std_vertex_dist() const { return repr->std_vertex_dist; } + float Surface::orig_area() const { + return repr->orig_area; + } float Surface::neg_area() const { return repr->neg_area; } float Surface::neg_orig_area() const { // amount of original surface in folds return repr->neg_orig_area; } + int Surface::zeros() const { + return repr->zeros; + } + int Surface::hemisphere() const { // which hemisphere + return repr->hemisphere; + } + int Surface::initialized() const { + return repr->initialized; + } + PLTA Surface::lta() const { + return repr->lta; + } + PMATRIX Surface::SRASToTalSRAS_() const { + return repr->SRASToTalSRAS_; + } + PMATRIX Surface::TalSRASToSRAS_() const { + return repr->TalSRASToSRAS_; + } + int Surface::free_transform() const { + return repr->free_transform; + } double Surface::radius() const { // radius (if status==MRIS_SPHERE) return repr->radius; } + float Surface::a() const { + return repr->a; + } + float Surface::b() const { + return repr->b; + } + float Surface::c() const { // ellipsoid parameters + return repr->c; + } + MRIS_fname_t Surface::fname() const { // file it was originally loaded from + return repr->fname; + } + float Surface::Hmin() const { // min mean curvature + return repr->Hmin; + } + float Surface::Hmax() const { // max mean curvature + return repr->Hmax; + } + float Surface::Kmin() const { // min Gaussian curvature + return repr->Kmin; + } + float Surface::Kmax() const { // max Gaussian curvature + return repr->Kmax; + } + double Surface::Ktotal() const { // total Gaussian curvature + return repr->Ktotal; + } MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) return repr->status; } MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from return repr->origxyz_status; } + int Surface::patch() const { // if a patch of the surface + return repr->patch; + } + int Surface::nlabels() const { + return repr->nlabels; + } + PMRIS_AREA_LABEL Surface::labels() const { // nlabels of these (may be null) + return repr->labels; + } + p_void Surface::vp() const { // for misc. use + return repr->vp; + } + float Surface::alpha() const { // rotation around z-axis + return repr->alpha; + } + float Surface::beta() const { // rotation around y-axis + return repr->beta; + } + float Surface::gamma() const { // rotation around x-axis + return repr->gamma; + } + float Surface::da() const { + return repr->da; + } + float Surface::db() const { + return repr->db; + } + float Surface::dg() const { // old deltas + return repr->dg; + } + int Surface::type() const { // what type of surface was this initially + return repr->type; + } + int Surface::max_vertices() const { // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + return repr->max_vertices; + } + int Surface::max_faces() const { // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + return repr->max_faces; + } + MRIS_subject_name_t Surface::subject_name() const { // name of the subject + return repr->subject_name; + } + float Surface::canon_area() const { + return repr->canon_area; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->noscale; + } + float Surface::dx2(size_t i) const { // an extra set of gradient (not always alloced) + return repr->dx2[i]; + } + float Surface::dy2(size_t i) const { + return repr->dy2[i]; + } + float Surface::dz2(size_t i) const { + return repr->dz2[i]; + } + PCOLOR_TABLE Surface::ct() const { + return repr->ct; + } + int Surface::useRealRAS() const { // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + return repr->useRealRAS; + } + VOL_GEOM Surface::vg() const { // volume info from which this surface is created. valid iff vg.valid = 1 + return repr->vg; + } + MRIS_cmdlines_t Surface::cmdlines() const { + return repr->cmdlines; + } + int Surface::ncmds() const { + return repr->ncmds; + } + float Surface::group_avg_surface_area() const { // average of total surface area for group + return repr->group_avg_surface_area; + } + int Surface::group_avg_vtxarea_loaded() const { // average vertex area for group at each vertex + return repr->group_avg_vtxarea_loaded; + } + int Surface::triangle_links_removed() const { // for quad surfaces + return repr->triangle_links_removed; + } + p_void Surface::user_parms() const { // for whatever the user wants to hang here + return repr->user_parms; + } + PMATRIX Surface::m_sras2vox() const { // for converting surface ras to voxel + return repr->m_sras2vox; + } + PMRI Surface::mri_sras2vox() const { // volume that the above matrix is for + return repr->mri_sras2vox; + } + p_void Surface::mht() const { + return repr->mht; + } + p_void Surface::temps() const { + return repr->temps; + } + void Surface::set_strips(size_t i, STRIP to) { + repr->strips[i] = to; + } void Surface::set_xctr(float to) { repr->xctr = to; } @@ -2255,6 +8764,21 @@ namespace SurfaceFromMRISPV { void Surface::set_zhi(float to) { repr->zhi = to; } + void Surface::set_x0(float to) { // center of spherical expansion + repr->x0 = to; + } + void Surface::set_y0(float to) { + repr->y0 = to; + } + void Surface::set_z0(float to) { + repr->z0 = to; + } + void Surface::set_max_curv(float to) { + repr->max_curv = to; + } + void Surface::set_min_curv(float to) { + repr->min_curv = to; + } void Surface::set_total_area(float to) { repr->total_area = to; } @@ -2267,18 +8791,78 @@ namespace SurfaceFromMRISPV { void Surface::set_std_vertex_dist(double to) { repr->std_vertex_dist = to; } + void Surface::set_orig_area(float to) { + repr->orig_area = to; + } void Surface::set_neg_area(float to) { repr->neg_area = to; } void Surface::set_neg_orig_area(float to) { // amount of original surface in folds repr->neg_orig_area = to; } + void Surface::set_zeros(int to) { + repr->zeros = to; + } + void Surface::set_hemisphere(int to) { // which hemisphere + repr->hemisphere = to; + } + void Surface::set_fname(MRIS_fname_t to) { // file it was originally loaded from + repr->fname = to; + } + void Surface::set_Hmin(float to) { // min mean curvature + repr->Hmin = to; + } + void Surface::set_Hmax(float to) { // max mean curvature + repr->Hmax = to; + } + void Surface::set_Kmin(float to) { // min Gaussian curvature + repr->Kmin = to; + } + void Surface::set_Kmax(float to) { // max Gaussian curvature + repr->Kmax = to; + } + void Surface::set_Ktotal(double to) { // total Gaussian curvature + repr->Ktotal = to; + } void Surface::set_status(MRIS_Status to) { // type of surface (e.g. sphere, plane) repr->status = to; } void Surface::set_origxyz_status(MRIS_Status to) { // type of surface (e.g. sphere, plane) that this origxyz were obtained from repr->origxyz_status = to; } + void Surface::set_patch(int to) { // if a patch of the surface + repr->patch = to; + } + void Surface::set_nlabels(int to) { + repr->nlabels = to; + } + void Surface::set_labels(PMRIS_AREA_LABEL to) { // nlabels of these (may be null) + repr->labels = to; + } + void Surface::set_vp(p_void to) { // for misc. use + repr->vp = to; + } + void Surface::set_alpha(float to) { // rotation around z-axis + repr->alpha = to; + } + void Surface::set_beta(float to) { // rotation around y-axis + repr->beta = to; + } + void Surface::set_gamma(float to) { // rotation around x-axis + repr->gamma = to; + } + void Surface::set_da(float to) { + repr->da = to; + } + void Surface::set_db(float to) { + repr->db = to; + } + void Surface::set_dg(float to) { // old deltas + repr->dg = to; + } + void Surface::set_type(int to) { // what type of surface was this initially + repr->type = to; + } } // namespace AllM diff --git a/include/mrisurf_SurfaceFromMRIS_MP_generated.h b/include/mrisurf_SurfaceFromMRIS_MP_generated.h new file mode 100644 index 00000000000..71ee6437dbc --- /dev/null +++ b/include/mrisurf_SurfaceFromMRIS_MP_generated.h @@ -0,0 +1,25 @@ +#pragma once +#include "./mrisurf_SurfaceFromMRIS_MP_generated_prefix.h" + +#pragma once +// GENERATED SOURCE - DO NOT DIRECTLY EDIT +// +// ======================================= +#include "mrisurf_aaa.h" +namespace SurfaceFromMRIS_MP { + typedef MRIS_MP Representation; + #include "mrisurf_SurfaceFromMRIS_MP_generated_Existence.h" + #include "mrisurf_SurfaceFromMRIS_MP_generated_Topology.h" + #include "mrisurf_SurfaceFromMRIS_MP_generated_XYZPosition.h" + #include "mrisurf_SurfaceFromMRIS_MP_generated_XYZPositionConsequences.h" + #include "mrisurf_SurfaceFromMRIS_MP_generated_Distort.h" + #include "mrisurf_SurfaceFromMRIS_MP_generated_Analysis.h" + #include "mrisurf_SurfaceFromMRIS_MP_generated_ExistenceM.h" + #include "mrisurf_SurfaceFromMRIS_MP_generated_TopologyM.h" + #include "mrisurf_SurfaceFromMRIS_MP_generated_XYZPositionM.h" + #include "mrisurf_SurfaceFromMRIS_MP_generated_XYZPositionConsequencesM.h" + #include "mrisurf_SurfaceFromMRIS_MP_generated_DistortM.h" + #include "mrisurf_SurfaceFromMRIS_MP_generated_AnalysisM.h" + #include "mrisurf_SurfaceFromMRIS_MP_generated_AllM.h" +} // SurfaceFromMRIS_MP +#include "./mrisurf_SurfaceFromMRIS_MP_generated_suffix.h" diff --git a/include/mrisurf_SurfaceFromMRIS_MP_generated_AllM.h b/include/mrisurf_SurfaceFromMRIS_MP_generated_AllM.h new file mode 100644 index 00000000000..42cb3c2b161 --- /dev/null +++ b/include/mrisurf_SurfaceFromMRIS_MP_generated_AllM.h @@ -0,0 +1,165 @@ + namespace AllM { + struct Face : public Repr_Elt { + typedef AllM::Surface Surface; + typedef AllM::Vertex Vertex; + inline Face ( ); + inline Face ( Face const & src ); + inline Face ( Representation* representation, size_t idx ); + int fno () const { return idx; } + + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline FloatXYZ norm ( ) const ; + + inline void set_v ( size_t i, Vertex to ) ; + inline void set_area ( float to ) ; + inline void set_angle ( angles_per_triangle_t to ) ; + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + inline void set_norm ( FloatXYZ to ) ; + }; // Face + + struct Vertex : public Repr_Elt { + typedef AllM::Surface Surface; + typedef AllM::Face Face; + inline Vertex ( ); + inline Vertex ( Vertex const & src ); + inline Vertex ( Representation* representation, size_t idx ); + int vno () const { return idx; } + + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float wnx ( ) const ; + inline float wny ( ) const ; + inline float wnz ( ) const ; // white normal + inline float dx ( ) const ; + inline float dy ( ) const ; + inline float dz ( ) const ; // current change in position + inline float curv ( ) const ; // curr curvature + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float pialx ( ) const ; + inline float pialy ( ) const ; + inline float pialz ( ) const ; // pial surface coordinates + inline float whitex ( ) const ; + inline float whitey ( ) const ; + inline float whitez ( ) const ; // white surface coordinates + inline float area ( ) const ; + inline float origarea ( ) const ; + inline int fno ( ) const ; // face that this vertex is in + inline char neg ( ) const ; // 1 if the normal vector is inverted + inline char border ( ) const ; // flag + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; + + inline void set_x ( float to ) ; // current coordinates + inline void set_y ( float to ) ; // use MRISsetXYZ() to set + inline void set_z ( float to ) ; + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_wnx ( float to ) ; + inline void set_wny ( float to ) ; + inline void set_wnz ( float to ) ; // white normal + inline void set_dx ( float to ) ; + inline void set_dy ( float to ) ; + inline void set_dz ( float to ) ; // current change in position + inline void set_curv ( float to ) ; // curr curvature + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_pialx ( float to ) ; + inline void set_pialy ( float to ) ; + inline void set_pialz ( float to ) ; // pial surface coordinates + inline void set_whitex ( float to ) ; + inline void set_whitey ( float to ) ; + inline void set_whitez ( float to ) ; // white surface coordinates + inline void set_area ( float to ) ; + inline void set_origarea ( float to ) ; + inline void set_fno ( int to ) ; // face that this vertex is in + inline void set_neg ( char to ) ; // 1 if the normal vector is inverted + inline void set_border ( char to ) ; // flag + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex + + struct MRIS_MP : public Repr_Elt { + typedef AllM::Surface Surface; + typedef AllM::Face Face; + typedef AllM::Vertex Vertex; + inline MRIS_MP ( ); + inline MRIS_MP ( MRIS_MP const & src ); + inline MRIS_MP ( Representation* representation, size_t idx ); + + }; // MRIS_MP + + struct Surface : public Repr_Elt { + typedef AllM::Face Face; + typedef AllM::Vertex Vertex; + inline Surface ( ); + inline Surface ( Surface const & src ); + inline Surface ( Representation* representation ); + + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline Vertex vertices ( size_t i ) const ; + inline Face faces ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int noscale ( ) const ; // don't scale by surface area if true + + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + inline void set_avg_vertex_dist ( double to ) ; // set by MRIScomputeAvgInterVertexDist + inline void set_std_vertex_dist ( double to ) ; + inline void set_orig_area ( float to ) ; + inline void set_neg_area ( float to ) ; + inline void set_neg_orig_area ( float to ) ; // amount of original surface in folds + inline void set_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) + inline void set_origxyz_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline void set_patch ( int to ) ; // if a patch of the surface + }; // Surface + + } // namespace AllM diff --git a/include/mrisurf_SurfaceFromMRIS_MP_generated_Analysis.h b/include/mrisurf_SurfaceFromMRIS_MP_generated_Analysis.h new file mode 100644 index 00000000000..4a6006c4a60 --- /dev/null +++ b/include/mrisurf_SurfaceFromMRIS_MP_generated_Analysis.h @@ -0,0 +1,153 @@ + namespace Analysis { + struct Face : public Repr_Elt { + typedef Analysis::Surface Surface; + typedef Analysis::Vertex Vertex; + inline Face ( ); + inline Face ( Face const & src ); + inline Face ( Representation* representation, size_t idx ); + inline Face ( AllM::Face const & src ); + int fno () const { return idx; } + + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline FloatXYZ norm ( ) const ; + + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + }; // Face + + struct Vertex : public Repr_Elt { + typedef Analysis::Surface Surface; + typedef Analysis::Face Face; + inline Vertex ( ); + inline Vertex ( Vertex const & src ); + inline Vertex ( Representation* representation, size_t idx ); + inline Vertex ( AllM::Vertex const & src ); + int vno () const { return idx; } + + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float wnx ( ) const ; + inline float wny ( ) const ; + inline float wnz ( ) const ; // white normal + inline float dx ( ) const ; + inline float dy ( ) const ; + inline float dz ( ) const ; // current change in position + inline float curv ( ) const ; // curr curvature + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float pialx ( ) const ; + inline float pialy ( ) const ; + inline float pialz ( ) const ; // pial surface coordinates + inline float whitex ( ) const ; + inline float whitey ( ) const ; + inline float whitez ( ) const ; // white surface coordinates + inline float area ( ) const ; + inline float origarea ( ) const ; + inline int fno ( ) const ; // face that this vertex is in + inline char neg ( ) const ; // 1 if the normal vector is inverted + inline char border ( ) const ; // flag + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; + + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_wnx ( float to ) ; + inline void set_wny ( float to ) ; + inline void set_wnz ( float to ) ; // white normal + inline void set_dx ( float to ) ; + inline void set_dy ( float to ) ; + inline void set_dz ( float to ) ; // current change in position + inline void set_curv ( float to ) ; // curr curvature + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_pialx ( float to ) ; + inline void set_pialy ( float to ) ; + inline void set_pialz ( float to ) ; // pial surface coordinates + inline void set_whitex ( float to ) ; + inline void set_whitey ( float to ) ; + inline void set_whitez ( float to ) ; // white surface coordinates + inline void set_origarea ( float to ) ; + inline void set_fno ( int to ) ; // face that this vertex is in + inline void set_neg ( char to ) ; // 1 if the normal vector is inverted + inline void set_border ( char to ) ; // flag + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex + + struct MRIS_MP : public Repr_Elt { + typedef Analysis::Surface Surface; + typedef Analysis::Face Face; + typedef Analysis::Vertex Vertex; + inline MRIS_MP ( ); + inline MRIS_MP ( MRIS_MP const & src ); + inline MRIS_MP ( Representation* representation, size_t idx ); + inline MRIS_MP ( AllM::MRIS_MP const & src ); + + }; // MRIS_MP + + struct Surface : public Repr_Elt { + typedef Analysis::Face Face; + typedef Analysis::Vertex Vertex; + inline Surface ( ); + inline Surface ( Surface const & src ); + inline Surface ( Representation* representation ); + inline Surface ( AllM::Surface const & src ); + + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline Vertex vertices ( size_t i ) const ; + inline Face faces ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int noscale ( ) const ; // don't scale by surface area if true + + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + }; // Surface + + } // namespace Analysis diff --git a/include/mrisurf_SurfaceFromMRIS_MP_generated_AnalysisM.h b/include/mrisurf_SurfaceFromMRIS_MP_generated_AnalysisM.h new file mode 100644 index 00000000000..e16d142093f --- /dev/null +++ b/include/mrisurf_SurfaceFromMRIS_MP_generated_AnalysisM.h @@ -0,0 +1,153 @@ + namespace AnalysisM { + struct Face : public Repr_Elt { + typedef AnalysisM::Surface Surface; + typedef AnalysisM::Vertex Vertex; + inline Face ( ); + inline Face ( Face const & src ); + inline Face ( Representation* representation, size_t idx ); + inline Face ( AllM::Face const & src ); + int fno () const { return idx; } + + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline FloatXYZ norm ( ) const ; + + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + }; // Face + + struct Vertex : public Repr_Elt { + typedef AnalysisM::Surface Surface; + typedef AnalysisM::Face Face; + inline Vertex ( ); + inline Vertex ( Vertex const & src ); + inline Vertex ( Representation* representation, size_t idx ); + inline Vertex ( AllM::Vertex const & src ); + int vno () const { return idx; } + + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float wnx ( ) const ; + inline float wny ( ) const ; + inline float wnz ( ) const ; // white normal + inline float dx ( ) const ; + inline float dy ( ) const ; + inline float dz ( ) const ; // current change in position + inline float curv ( ) const ; // curr curvature + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float pialx ( ) const ; + inline float pialy ( ) const ; + inline float pialz ( ) const ; // pial surface coordinates + inline float whitex ( ) const ; + inline float whitey ( ) const ; + inline float whitez ( ) const ; // white surface coordinates + inline float area ( ) const ; + inline float origarea ( ) const ; + inline int fno ( ) const ; // face that this vertex is in + inline char neg ( ) const ; // 1 if the normal vector is inverted + inline char border ( ) const ; // flag + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; + + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_wnx ( float to ) ; + inline void set_wny ( float to ) ; + inline void set_wnz ( float to ) ; // white normal + inline void set_dx ( float to ) ; + inline void set_dy ( float to ) ; + inline void set_dz ( float to ) ; // current change in position + inline void set_curv ( float to ) ; // curr curvature + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_pialx ( float to ) ; + inline void set_pialy ( float to ) ; + inline void set_pialz ( float to ) ; // pial surface coordinates + inline void set_whitex ( float to ) ; + inline void set_whitey ( float to ) ; + inline void set_whitez ( float to ) ; // white surface coordinates + inline void set_origarea ( float to ) ; + inline void set_fno ( int to ) ; // face that this vertex is in + inline void set_neg ( char to ) ; // 1 if the normal vector is inverted + inline void set_border ( char to ) ; // flag + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex + + struct MRIS_MP : public Repr_Elt { + typedef AnalysisM::Surface Surface; + typedef AnalysisM::Face Face; + typedef AnalysisM::Vertex Vertex; + inline MRIS_MP ( ); + inline MRIS_MP ( MRIS_MP const & src ); + inline MRIS_MP ( Representation* representation, size_t idx ); + inline MRIS_MP ( AllM::MRIS_MP const & src ); + + }; // MRIS_MP + + struct Surface : public Repr_Elt { + typedef AnalysisM::Face Face; + typedef AnalysisM::Vertex Vertex; + inline Surface ( ); + inline Surface ( Surface const & src ); + inline Surface ( Representation* representation ); + inline Surface ( AllM::Surface const & src ); + + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline Vertex vertices ( size_t i ) const ; + inline Face faces ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int noscale ( ) const ; // don't scale by surface area if true + + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + }; // Surface + + } // namespace AnalysisM diff --git a/include/mrisurf_SurfaceFromMRIS_MP_generated_Distort.h b/include/mrisurf_SurfaceFromMRIS_MP_generated_Distort.h new file mode 100644 index 00000000000..e2ac802d859 --- /dev/null +++ b/include/mrisurf_SurfaceFromMRIS_MP_generated_Distort.h @@ -0,0 +1,161 @@ + namespace Distort { + struct Face : public Repr_Elt { + typedef Distort::Surface Surface; + typedef Distort::Vertex Vertex; + inline Face ( ); + inline Face ( Face const & src ); + inline Face ( Representation* representation, size_t idx ); + inline Face ( AnalysisM::Face const & src ); + inline Face ( Analysis::Face const & src ); + inline Face ( AllM::Face const & src ); + int fno () const { return idx; } + + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline FloatXYZ norm ( ) const ; + + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + }; // Face + + struct Vertex : public Repr_Elt { + typedef Distort::Surface Surface; + typedef Distort::Face Face; + inline Vertex ( ); + inline Vertex ( Vertex const & src ); + inline Vertex ( Representation* representation, size_t idx ); + inline Vertex ( AnalysisM::Vertex const & src ); + inline Vertex ( Analysis::Vertex const & src ); + inline Vertex ( AllM::Vertex const & src ); + int vno () const { return idx; } + + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float wnx ( ) const ; + inline float wny ( ) const ; + inline float wnz ( ) const ; // white normal + inline float dx ( ) const ; + inline float dy ( ) const ; + inline float dz ( ) const ; // current change in position + inline float curv ( ) const ; // curr curvature + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float pialx ( ) const ; + inline float pialy ( ) const ; + inline float pialz ( ) const ; // pial surface coordinates + inline float whitex ( ) const ; + inline float whitey ( ) const ; + inline float whitez ( ) const ; // white surface coordinates + inline float area ( ) const ; + inline float origarea ( ) const ; + inline int fno ( ) const ; // face that this vertex is in + inline char neg ( ) const ; // 1 if the normal vector is inverted + inline char border ( ) const ; // flag + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; + + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_wnx ( float to ) ; + inline void set_wny ( float to ) ; + inline void set_wnz ( float to ) ; // white normal + inline void set_dx ( float to ) ; + inline void set_dy ( float to ) ; + inline void set_dz ( float to ) ; // current change in position + inline void set_curv ( float to ) ; // curr curvature + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_pialx ( float to ) ; + inline void set_pialy ( float to ) ; + inline void set_pialz ( float to ) ; // pial surface coordinates + inline void set_whitex ( float to ) ; + inline void set_whitey ( float to ) ; + inline void set_whitez ( float to ) ; // white surface coordinates + inline void set_origarea ( float to ) ; + inline void set_fno ( int to ) ; // face that this vertex is in + inline void set_neg ( char to ) ; // 1 if the normal vector is inverted + inline void set_border ( char to ) ; // flag + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex + + struct MRIS_MP : public Repr_Elt { + typedef Distort::Surface Surface; + typedef Distort::Face Face; + typedef Distort::Vertex Vertex; + inline MRIS_MP ( ); + inline MRIS_MP ( MRIS_MP const & src ); + inline MRIS_MP ( Representation* representation, size_t idx ); + inline MRIS_MP ( AnalysisM::MRIS_MP const & src ); + inline MRIS_MP ( Analysis::MRIS_MP const & src ); + inline MRIS_MP ( AllM::MRIS_MP const & src ); + + }; // MRIS_MP + + struct Surface : public Repr_Elt { + typedef Distort::Face Face; + typedef Distort::Vertex Vertex; + inline Surface ( ); + inline Surface ( Surface const & src ); + inline Surface ( Representation* representation ); + inline Surface ( AnalysisM::Surface const & src ); + inline Surface ( Analysis::Surface const & src ); + inline Surface ( AllM::Surface const & src ); + + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline Vertex vertices ( size_t i ) const ; + inline Face faces ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int noscale ( ) const ; // don't scale by surface area if true + + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + }; // Surface + + } // namespace Distort diff --git a/include/mrisurf_SurfaceFromMRIS_MP_generated_DistortM.h b/include/mrisurf_SurfaceFromMRIS_MP_generated_DistortM.h new file mode 100644 index 00000000000..c5d42c7cd0e --- /dev/null +++ b/include/mrisurf_SurfaceFromMRIS_MP_generated_DistortM.h @@ -0,0 +1,154 @@ + namespace DistortM { + struct Face : public Repr_Elt { + typedef DistortM::Surface Surface; + typedef DistortM::Vertex Vertex; + inline Face ( ); + inline Face ( Face const & src ); + inline Face ( Representation* representation, size_t idx ); + inline Face ( AllM::Face const & src ); + int fno () const { return idx; } + + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline FloatXYZ norm ( ) const ; + + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + }; // Face + + struct Vertex : public Repr_Elt { + typedef DistortM::Surface Surface; + typedef DistortM::Face Face; + inline Vertex ( ); + inline Vertex ( Vertex const & src ); + inline Vertex ( Representation* representation, size_t idx ); + inline Vertex ( AllM::Vertex const & src ); + int vno () const { return idx; } + + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float wnx ( ) const ; + inline float wny ( ) const ; + inline float wnz ( ) const ; // white normal + inline float dx ( ) const ; + inline float dy ( ) const ; + inline float dz ( ) const ; // current change in position + inline float curv ( ) const ; // curr curvature + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float pialx ( ) const ; + inline float pialy ( ) const ; + inline float pialz ( ) const ; // pial surface coordinates + inline float whitex ( ) const ; + inline float whitey ( ) const ; + inline float whitez ( ) const ; // white surface coordinates + inline float area ( ) const ; + inline float origarea ( ) const ; + inline int fno ( ) const ; // face that this vertex is in + inline char neg ( ) const ; // 1 if the normal vector is inverted + inline char border ( ) const ; // flag + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; + + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_wnx ( float to ) ; + inline void set_wny ( float to ) ; + inline void set_wnz ( float to ) ; // white normal + inline void set_dx ( float to ) ; + inline void set_dy ( float to ) ; + inline void set_dz ( float to ) ; // current change in position + inline void set_curv ( float to ) ; // curr curvature + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_pialx ( float to ) ; + inline void set_pialy ( float to ) ; + inline void set_pialz ( float to ) ; // pial surface coordinates + inline void set_whitex ( float to ) ; + inline void set_whitey ( float to ) ; + inline void set_whitez ( float to ) ; // white surface coordinates + inline void set_origarea ( float to ) ; + inline void set_fno ( int to ) ; // face that this vertex is in + inline void set_neg ( char to ) ; // 1 if the normal vector is inverted + inline void set_border ( char to ) ; // flag + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex + + struct MRIS_MP : public Repr_Elt { + typedef DistortM::Surface Surface; + typedef DistortM::Face Face; + typedef DistortM::Vertex Vertex; + inline MRIS_MP ( ); + inline MRIS_MP ( MRIS_MP const & src ); + inline MRIS_MP ( Representation* representation, size_t idx ); + inline MRIS_MP ( AllM::MRIS_MP const & src ); + + }; // MRIS_MP + + struct Surface : public Repr_Elt { + typedef DistortM::Face Face; + typedef DistortM::Vertex Vertex; + inline Surface ( ); + inline Surface ( Surface const & src ); + inline Surface ( Representation* representation ); + inline Surface ( AllM::Surface const & src ); + void freeDistsButNotOrig() { MRISfreeDistsButNotOrig(repr); } + + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline Vertex vertices ( size_t i ) const ; + inline Face faces ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int noscale ( ) const ; // don't scale by surface area if true + + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + }; // Surface + + } // namespace DistortM diff --git a/include/mrisurf_SurfaceFromMRIS_MP_generated_Existence.h b/include/mrisurf_SurfaceFromMRIS_MP_generated_Existence.h new file mode 100644 index 00000000000..db490a6d577 --- /dev/null +++ b/include/mrisurf_SurfaceFromMRIS_MP_generated_Existence.h @@ -0,0 +1,97 @@ + namespace Existence { + struct Face : public Repr_Elt { + typedef Existence::Surface Surface; + typedef Existence::Vertex Vertex; + inline Face ( ); + inline Face ( Face const & src ); + inline Face ( Representation* representation, size_t idx ); + inline Face ( TopologyM::Face const & src ); + inline Face ( Topology::Face const & src ); + inline Face ( XYZPositionM::Face const & src ); + inline Face ( XYZPosition::Face const & src ); + inline Face ( XYZPositionConsequencesM::Face const & src ); + inline Face ( XYZPositionConsequences::Face const & src ); + inline Face ( DistortM::Face const & src ); + inline Face ( Distort::Face const & src ); + inline Face ( AnalysisM::Face const & src ); + inline Face ( Analysis::Face const & src ); + inline Face ( AllM::Face const & src ); + int fno () const { return idx; } + + inline char ripflag ( ) const ; + + inline void set_ripflag ( char to ) ; + }; // Face + + struct Vertex : public Repr_Elt { + typedef Existence::Surface Surface; + typedef Existence::Face Face; + inline Vertex ( ); + inline Vertex ( Vertex const & src ); + inline Vertex ( Representation* representation, size_t idx ); + inline Vertex ( TopologyM::Vertex const & src ); + inline Vertex ( Topology::Vertex const & src ); + inline Vertex ( XYZPositionM::Vertex const & src ); + inline Vertex ( XYZPosition::Vertex const & src ); + inline Vertex ( XYZPositionConsequencesM::Vertex const & src ); + inline Vertex ( XYZPositionConsequences::Vertex const & src ); + inline Vertex ( DistortM::Vertex const & src ); + inline Vertex ( Distort::Vertex const & src ); + inline Vertex ( AnalysisM::Vertex const & src ); + inline Vertex ( Analysis::Vertex const & src ); + inline Vertex ( AllM::Vertex const & src ); + int vno () const { return idx; } + + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; + + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex + + struct MRIS_MP : public Repr_Elt { + typedef Existence::Surface Surface; + typedef Existence::Face Face; + typedef Existence::Vertex Vertex; + inline MRIS_MP ( ); + inline MRIS_MP ( MRIS_MP const & src ); + inline MRIS_MP ( Representation* representation, size_t idx ); + inline MRIS_MP ( TopologyM::MRIS_MP const & src ); + inline MRIS_MP ( Topology::MRIS_MP const & src ); + inline MRIS_MP ( XYZPositionM::MRIS_MP const & src ); + inline MRIS_MP ( XYZPosition::MRIS_MP const & src ); + inline MRIS_MP ( XYZPositionConsequencesM::MRIS_MP const & src ); + inline MRIS_MP ( XYZPositionConsequences::MRIS_MP const & src ); + inline MRIS_MP ( DistortM::MRIS_MP const & src ); + inline MRIS_MP ( Distort::MRIS_MP const & src ); + inline MRIS_MP ( AnalysisM::MRIS_MP const & src ); + inline MRIS_MP ( Analysis::MRIS_MP const & src ); + inline MRIS_MP ( AllM::MRIS_MP const & src ); + + }; // MRIS_MP + + struct Surface : public Repr_Elt { + typedef Existence::Face Face; + typedef Existence::Vertex Vertex; + inline Surface ( ); + inline Surface ( Surface const & src ); + inline Surface ( Representation* representation ); + inline Surface ( TopologyM::Surface const & src ); + inline Surface ( Topology::Surface const & src ); + inline Surface ( XYZPositionM::Surface const & src ); + inline Surface ( XYZPosition::Surface const & src ); + inline Surface ( XYZPositionConsequencesM::Surface const & src ); + inline Surface ( XYZPositionConsequences::Surface const & src ); + inline Surface ( DistortM::Surface const & src ); + inline Surface ( Distort::Surface const & src ); + inline Surface ( AnalysisM::Surface const & src ); + inline Surface ( Analysis::Surface const & src ); + inline Surface ( AllM::Surface const & src ); + + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int noscale ( ) const ; // don't scale by surface area if true + }; // Surface + + } // namespace Existence diff --git a/include/mrisurf_SurfaceFromMRIS_MP_generated_ExistenceM.h b/include/mrisurf_SurfaceFromMRIS_MP_generated_ExistenceM.h new file mode 100644 index 00000000000..03f2354f72c --- /dev/null +++ b/include/mrisurf_SurfaceFromMRIS_MP_generated_ExistenceM.h @@ -0,0 +1,61 @@ + namespace ExistenceM { + struct Face : public Repr_Elt { + typedef ExistenceM::Surface Surface; + typedef ExistenceM::Vertex Vertex; + inline Face ( ); + inline Face ( Face const & src ); + inline Face ( Representation* representation, size_t idx ); + inline Face ( AllM::Face const & src ); + int fno () const { return idx; } + + inline char ripflag ( ) const ; + + inline void set_ripflag ( char to ) ; + }; // Face + + struct Vertex : public Repr_Elt { + typedef ExistenceM::Surface Surface; + typedef ExistenceM::Face Face; + inline Vertex ( ); + inline Vertex ( Vertex const & src ); + inline Vertex ( Representation* representation, size_t idx ); + inline Vertex ( AllM::Vertex const & src ); + int vno () const { return idx; } + + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; + + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex + + struct MRIS_MP : public Repr_Elt { + typedef ExistenceM::Surface Surface; + typedef ExistenceM::Face Face; + typedef ExistenceM::Vertex Vertex; + inline MRIS_MP ( ); + inline MRIS_MP ( MRIS_MP const & src ); + inline MRIS_MP ( Representation* representation, size_t idx ); + inline MRIS_MP ( AllM::MRIS_MP const & src ); + + }; // MRIS_MP + + struct Surface : public Repr_Elt { + typedef ExistenceM::Face Face; + typedef ExistenceM::Vertex Vertex; + inline Surface ( ); + inline Surface ( Surface const & src ); + inline Surface ( Representation* representation ); + inline Surface ( AllM::Surface const & src ); + + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int noscale ( ) const ; // don't scale by surface area if true + + inline void set_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) + inline void set_origxyz_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline void set_patch ( int to ) ; // if a patch of the surface + }; // Surface + + } // namespace ExistenceM diff --git a/include/mrisurf_SurfaceFromMRIS_MP_generated_Topology.h b/include/mrisurf_SurfaceFromMRIS_MP_generated_Topology.h new file mode 100644 index 00000000000..6486207a69a --- /dev/null +++ b/include/mrisurf_SurfaceFromMRIS_MP_generated_Topology.h @@ -0,0 +1,96 @@ + namespace Topology { + struct Face : public Repr_Elt { + typedef Topology::Surface Surface; + typedef Topology::Vertex Vertex; + inline Face ( ); + inline Face ( Face const & src ); + inline Face ( Representation* representation, size_t idx ); + inline Face ( XYZPositionM::Face const & src ); + inline Face ( XYZPosition::Face const & src ); + inline Face ( XYZPositionConsequencesM::Face const & src ); + inline Face ( XYZPositionConsequences::Face const & src ); + inline Face ( DistortM::Face const & src ); + inline Face ( Distort::Face const & src ); + inline Face ( AnalysisM::Face const & src ); + inline Face ( Analysis::Face const & src ); + inline Face ( AllM::Face const & src ); + int fno () const { return idx; } + + inline Vertex v ( size_t i ) const ; + inline char ripflag ( ) const ; + + inline void set_ripflag ( char to ) ; + }; // Face + + struct Vertex : public Repr_Elt { + typedef Topology::Surface Surface; + typedef Topology::Face Face; + inline Vertex ( ); + inline Vertex ( Vertex const & src ); + inline Vertex ( Representation* representation, size_t idx ); + inline Vertex ( XYZPositionM::Vertex const & src ); + inline Vertex ( XYZPosition::Vertex const & src ); + inline Vertex ( XYZPositionConsequencesM::Vertex const & src ); + inline Vertex ( XYZPositionConsequences::Vertex const & src ); + inline Vertex ( DistortM::Vertex const & src ); + inline Vertex ( Distort::Vertex const & src ); + inline Vertex ( AnalysisM::Vertex const & src ); + inline Vertex ( Analysis::Vertex const & src ); + inline Vertex ( AllM::Vertex const & src ); + int vno () const { return idx; } + + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; + + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex + + struct MRIS_MP : public Repr_Elt { + typedef Topology::Surface Surface; + typedef Topology::Face Face; + typedef Topology::Vertex Vertex; + inline MRIS_MP ( ); + inline MRIS_MP ( MRIS_MP const & src ); + inline MRIS_MP ( Representation* representation, size_t idx ); + inline MRIS_MP ( XYZPositionM::MRIS_MP const & src ); + inline MRIS_MP ( XYZPosition::MRIS_MP const & src ); + inline MRIS_MP ( XYZPositionConsequencesM::MRIS_MP const & src ); + inline MRIS_MP ( XYZPositionConsequences::MRIS_MP const & src ); + inline MRIS_MP ( DistortM::MRIS_MP const & src ); + inline MRIS_MP ( Distort::MRIS_MP const & src ); + inline MRIS_MP ( AnalysisM::MRIS_MP const & src ); + inline MRIS_MP ( Analysis::MRIS_MP const & src ); + inline MRIS_MP ( AllM::MRIS_MP const & src ); + + }; // MRIS_MP + + struct Surface : public Repr_Elt { + typedef Topology::Face Face; + typedef Topology::Vertex Vertex; + inline Surface ( ); + inline Surface ( Surface const & src ); + inline Surface ( Representation* representation ); + inline Surface ( XYZPositionM::Surface const & src ); + inline Surface ( XYZPosition::Surface const & src ); + inline Surface ( XYZPositionConsequencesM::Surface const & src ); + inline Surface ( XYZPositionConsequences::Surface const & src ); + inline Surface ( DistortM::Surface const & src ); + inline Surface ( Distort::Surface const & src ); + inline Surface ( AnalysisM::Surface const & src ); + inline Surface ( Analysis::Surface const & src ); + inline Surface ( AllM::Surface const & src ); + + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline Vertex vertices ( size_t i ) const ; + inline Face faces ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int noscale ( ) const ; // don't scale by surface area if true + }; // Surface + + } // namespace Topology diff --git a/include/mrisurf_SurfaceFromMRIS_MP_generated_TopologyM.h b/include/mrisurf_SurfaceFromMRIS_MP_generated_TopologyM.h new file mode 100644 index 00000000000..ecc275e8d34 --- /dev/null +++ b/include/mrisurf_SurfaceFromMRIS_MP_generated_TopologyM.h @@ -0,0 +1,65 @@ + namespace TopologyM { + struct Face : public Repr_Elt { + typedef TopologyM::Surface Surface; + typedef TopologyM::Vertex Vertex; + inline Face ( ); + inline Face ( Face const & src ); + inline Face ( Representation* representation, size_t idx ); + inline Face ( AllM::Face const & src ); + int fno () const { return idx; } + + inline Vertex v ( size_t i ) const ; + inline char ripflag ( ) const ; + + inline void set_v ( size_t i, Vertex to ) ; + inline void set_ripflag ( char to ) ; + }; // Face + + struct Vertex : public Repr_Elt { + typedef TopologyM::Surface Surface; + typedef TopologyM::Face Face; + inline Vertex ( ); + inline Vertex ( Vertex const & src ); + inline Vertex ( Representation* representation, size_t idx ); + inline Vertex ( AllM::Vertex const & src ); + int vno () const { return idx; } + + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; + + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex + + struct MRIS_MP : public Repr_Elt { + typedef TopologyM::Surface Surface; + typedef TopologyM::Face Face; + typedef TopologyM::Vertex Vertex; + inline MRIS_MP ( ); + inline MRIS_MP ( MRIS_MP const & src ); + inline MRIS_MP ( Representation* representation, size_t idx ); + inline MRIS_MP ( AllM::MRIS_MP const & src ); + + }; // MRIS_MP + + struct Surface : public Repr_Elt { + typedef TopologyM::Face Face; + typedef TopologyM::Vertex Vertex; + inline Surface ( ); + inline Surface ( Surface const & src ); + inline Surface ( Representation* representation ); + inline Surface ( AllM::Surface const & src ); + + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline Vertex vertices ( size_t i ) const ; + inline Face faces ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int noscale ( ) const ; // don't scale by surface area if true + }; // Surface + + } // namespace TopologyM diff --git a/include/mrisurf_SurfaceFromMRIS_MP_generated_XYZPosition.h b/include/mrisurf_SurfaceFromMRIS_MP_generated_XYZPosition.h new file mode 100644 index 00000000000..7613a10e5cb --- /dev/null +++ b/include/mrisurf_SurfaceFromMRIS_MP_generated_XYZPosition.h @@ -0,0 +1,103 @@ + namespace XYZPosition { + struct Face : public Repr_Elt { + typedef XYZPosition::Surface Surface; + typedef XYZPosition::Vertex Vertex; + inline Face ( ); + inline Face ( Face const & src ); + inline Face ( Representation* representation, size_t idx ); + inline Face ( XYZPositionConsequencesM::Face const & src ); + inline Face ( XYZPositionConsequences::Face const & src ); + inline Face ( DistortM::Face const & src ); + inline Face ( Distort::Face const & src ); + inline Face ( AnalysisM::Face const & src ); + inline Face ( Analysis::Face const & src ); + inline Face ( AllM::Face const & src ); + int fno () const { return idx; } + + inline Vertex v ( size_t i ) const ; + inline char ripflag ( ) const ; + + inline void set_ripflag ( char to ) ; + }; // Face + + struct Vertex : public Repr_Elt { + typedef XYZPosition::Surface Surface; + typedef XYZPosition::Face Face; + inline Vertex ( ); + inline Vertex ( Vertex const & src ); + inline Vertex ( Representation* representation, size_t idx ); + inline Vertex ( XYZPositionConsequencesM::Vertex const & src ); + inline Vertex ( XYZPositionConsequences::Vertex const & src ); + inline Vertex ( DistortM::Vertex const & src ); + inline Vertex ( Distort::Vertex const & src ); + inline Vertex ( AnalysisM::Vertex const & src ); + inline Vertex ( Analysis::Vertex const & src ); + inline Vertex ( AllM::Vertex const & src ); + int vno () const { return idx; } + + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; + + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex + + struct MRIS_MP : public Repr_Elt { + typedef XYZPosition::Surface Surface; + typedef XYZPosition::Face Face; + typedef XYZPosition::Vertex Vertex; + inline MRIS_MP ( ); + inline MRIS_MP ( MRIS_MP const & src ); + inline MRIS_MP ( Representation* representation, size_t idx ); + inline MRIS_MP ( XYZPositionConsequencesM::MRIS_MP const & src ); + inline MRIS_MP ( XYZPositionConsequences::MRIS_MP const & src ); + inline MRIS_MP ( DistortM::MRIS_MP const & src ); + inline MRIS_MP ( Distort::MRIS_MP const & src ); + inline MRIS_MP ( AnalysisM::MRIS_MP const & src ); + inline MRIS_MP ( Analysis::MRIS_MP const & src ); + inline MRIS_MP ( AllM::MRIS_MP const & src ); + + }; // MRIS_MP + + struct Surface : public Repr_Elt { + typedef XYZPosition::Face Face; + typedef XYZPosition::Vertex Vertex; + inline Surface ( ); + inline Surface ( Surface const & src ); + inline Surface ( Representation* representation ); + inline Surface ( XYZPositionConsequencesM::Surface const & src ); + inline Surface ( XYZPositionConsequences::Surface const & src ); + inline Surface ( DistortM::Surface const & src ); + inline Surface ( Distort::Surface const & src ); + inline Surface ( AnalysisM::Surface const & src ); + inline Surface ( Analysis::Surface const & src ); + inline Surface ( AllM::Surface const & src ); + + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline Vertex vertices ( size_t i ) const ; + inline Face faces ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int noscale ( ) const ; // don't scale by surface area if true + }; // Surface + + } // namespace XYZPosition diff --git a/include/mrisurf_SurfaceFromMRIS_MP_generated_XYZPositionConsequences.h b/include/mrisurf_SurfaceFromMRIS_MP_generated_XYZPositionConsequences.h new file mode 100644 index 00000000000..ccfe23d180c --- /dev/null +++ b/include/mrisurf_SurfaceFromMRIS_MP_generated_XYZPositionConsequences.h @@ -0,0 +1,135 @@ + namespace XYZPositionConsequences { + struct Face : public Repr_Elt { + typedef XYZPositionConsequences::Surface Surface; + typedef XYZPositionConsequences::Vertex Vertex; + inline Face ( ); + inline Face ( Face const & src ); + inline Face ( Representation* representation, size_t idx ); + inline Face ( DistortM::Face const & src ); + inline Face ( Distort::Face const & src ); + inline Face ( AnalysisM::Face const & src ); + inline Face ( Analysis::Face const & src ); + inline Face ( AllM::Face const & src ); + int fno () const { return idx; } + + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline FloatXYZ norm ( ) const ; + + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + }; // Face + + struct Vertex : public Repr_Elt { + typedef XYZPositionConsequences::Surface Surface; + typedef XYZPositionConsequences::Face Face; + inline Vertex ( ); + inline Vertex ( Vertex const & src ); + inline Vertex ( Representation* representation, size_t idx ); + inline Vertex ( DistortM::Vertex const & src ); + inline Vertex ( Distort::Vertex const & src ); + inline Vertex ( AnalysisM::Vertex const & src ); + inline Vertex ( Analysis::Vertex const & src ); + inline Vertex ( AllM::Vertex const & src ); + int vno () const { return idx; } + + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float area ( ) const ; + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; + + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex + + struct MRIS_MP : public Repr_Elt { + typedef XYZPositionConsequences::Surface Surface; + typedef XYZPositionConsequences::Face Face; + typedef XYZPositionConsequences::Vertex Vertex; + inline MRIS_MP ( ); + inline MRIS_MP ( MRIS_MP const & src ); + inline MRIS_MP ( Representation* representation, size_t idx ); + inline MRIS_MP ( DistortM::MRIS_MP const & src ); + inline MRIS_MP ( Distort::MRIS_MP const & src ); + inline MRIS_MP ( AnalysisM::MRIS_MP const & src ); + inline MRIS_MP ( Analysis::MRIS_MP const & src ); + inline MRIS_MP ( AllM::MRIS_MP const & src ); + + }; // MRIS_MP + + struct Surface : public Repr_Elt { + typedef XYZPositionConsequences::Face Face; + typedef XYZPositionConsequences::Vertex Vertex; + inline Surface ( ); + inline Surface ( Surface const & src ); + inline Surface ( Representation* representation ); + inline Surface ( DistortM::Surface const & src ); + inline Surface ( Distort::Surface const & src ); + inline Surface ( AnalysisM::Surface const & src ); + inline Surface ( Analysis::Surface const & src ); + inline Surface ( AllM::Surface const & src ); + + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline Vertex vertices ( size_t i ) const ; + inline Face faces ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int noscale ( ) const ; // don't scale by surface area if true + + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + }; // Surface + + } // namespace XYZPositionConsequences diff --git a/include/mrisurf_SurfaceFromMRIS_MP_generated_XYZPositionConsequencesM.h b/include/mrisurf_SurfaceFromMRIS_MP_generated_XYZPositionConsequencesM.h new file mode 100644 index 00000000000..1ef933607a9 --- /dev/null +++ b/include/mrisurf_SurfaceFromMRIS_MP_generated_XYZPositionConsequencesM.h @@ -0,0 +1,128 @@ + namespace XYZPositionConsequencesM { + struct Face : public Repr_Elt { + typedef XYZPositionConsequencesM::Surface Surface; + typedef XYZPositionConsequencesM::Vertex Vertex; + inline Face ( ); + inline Face ( Face const & src ); + inline Face ( Representation* representation, size_t idx ); + inline Face ( AllM::Face const & src ); + int fno () const { return idx; } + + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline FloatXYZ norm ( ) const ; + + inline void set_area ( float to ) ; + inline void set_angle ( angles_per_triangle_t to ) ; + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + inline void set_norm ( FloatXYZ to ) ; + }; // Face + + struct Vertex : public Repr_Elt { + typedef XYZPositionConsequencesM::Surface Surface; + typedef XYZPositionConsequencesM::Face Face; + inline Vertex ( ); + inline Vertex ( Vertex const & src ); + inline Vertex ( Representation* representation, size_t idx ); + inline Vertex ( AllM::Vertex const & src ); + int vno () const { return idx; } + + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float area ( ) const ; + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; + + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_area ( float to ) ; + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex + + struct MRIS_MP : public Repr_Elt { + typedef XYZPositionConsequencesM::Surface Surface; + typedef XYZPositionConsequencesM::Face Face; + typedef XYZPositionConsequencesM::Vertex Vertex; + inline MRIS_MP ( ); + inline MRIS_MP ( MRIS_MP const & src ); + inline MRIS_MP ( Representation* representation, size_t idx ); + inline MRIS_MP ( AllM::MRIS_MP const & src ); + + }; // MRIS_MP + + struct Surface : public Repr_Elt { + typedef XYZPositionConsequencesM::Face Face; + typedef XYZPositionConsequencesM::Vertex Vertex; + inline Surface ( ); + inline Surface ( Surface const & src ); + inline Surface ( Representation* representation ); + inline Surface ( AllM::Surface const & src ); + + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline Vertex vertices ( size_t i ) const ; + inline Face faces ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int noscale ( ) const ; // don't scale by surface area if true + + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + inline void set_avg_vertex_dist ( double to ) ; // set by MRIScomputeAvgInterVertexDist + inline void set_std_vertex_dist ( double to ) ; + inline void set_orig_area ( float to ) ; + inline void set_neg_area ( float to ) ; + inline void set_neg_orig_area ( float to ) ; // amount of original surface in folds + }; // Surface + + } // namespace XYZPositionConsequencesM diff --git a/include/mrisurf_SurfaceFromMRIS_MP_generated_XYZPositionM.h b/include/mrisurf_SurfaceFromMRIS_MP_generated_XYZPositionM.h new file mode 100644 index 00000000000..9374cf81c5f --- /dev/null +++ b/include/mrisurf_SurfaceFromMRIS_MP_generated_XYZPositionM.h @@ -0,0 +1,83 @@ + namespace XYZPositionM { + struct Face : public Repr_Elt { + typedef XYZPositionM::Surface Surface; + typedef XYZPositionM::Vertex Vertex; + inline Face ( ); + inline Face ( Face const & src ); + inline Face ( Representation* representation, size_t idx ); + inline Face ( AllM::Face const & src ); + int fno () const { return idx; } + + inline Vertex v ( size_t i ) const ; + inline char ripflag ( ) const ; + + inline void set_ripflag ( char to ) ; + }; // Face + + struct Vertex : public Repr_Elt { + typedef XYZPositionM::Surface Surface; + typedef XYZPositionM::Face Face; + inline Vertex ( ); + inline Vertex ( Vertex const & src ); + inline Vertex ( Representation* representation, size_t idx ); + inline Vertex ( AllM::Vertex const & src ); + int vno () const { return idx; } + + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; + + inline void set_x ( float to ) ; // current coordinates + inline void set_y ( float to ) ; // use MRISsetXYZ() to set + inline void set_z ( float to ) ; + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex + + struct MRIS_MP : public Repr_Elt { + typedef XYZPositionM::Surface Surface; + typedef XYZPositionM::Face Face; + typedef XYZPositionM::Vertex Vertex; + inline MRIS_MP ( ); + inline MRIS_MP ( MRIS_MP const & src ); + inline MRIS_MP ( Representation* representation, size_t idx ); + inline MRIS_MP ( AllM::MRIS_MP const & src ); + + }; // MRIS_MP + + struct Surface : public Repr_Elt { + typedef XYZPositionM::Face Face; + typedef XYZPositionM::Vertex Vertex; + inline Surface ( ); + inline Surface ( Surface const & src ); + inline Surface ( Representation* representation ); + inline Surface ( AllM::Surface const & src ); + void freeDistsButNotOrig() { MRISfreeDistsButNotOrig(repr); } + + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline Vertex vertices ( size_t i ) const ; + inline Face faces ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int noscale ( ) const ; // don't scale by surface area if true + }; // Surface + + } // namespace XYZPositionM diff --git a/include/mrisurf_SurfaceFromMRIS_MP_generated_prefix.h b/include/mrisurf_SurfaceFromMRIS_MP_generated_prefix.h new file mode 100644 index 00000000000..d56ab558224 --- /dev/null +++ b/include/mrisurf_SurfaceFromMRIS_MP_generated_prefix.h @@ -0,0 +1,163 @@ + +#pragma once +// GENERATED SOURCE - DO NOT DIRECTLY EDIT +// +// ======================================= +#include "mrisurf_aaa.h" +namespace SurfaceFromMRIS_MP { + typedef MRIS_MP Representation; + + + namespace Existence { + struct Face; + struct Vertex; + struct MRIS_MP; + struct Surface; + } // namespace Existence + + + namespace Topology { + struct Face; + struct Vertex; + struct MRIS_MP; + struct Surface; + } // namespace Topology + + + namespace XYZPosition { + struct Face; + struct Vertex; + struct MRIS_MP; + struct Surface; + } // namespace XYZPosition + + + namespace XYZPositionConsequences { + struct Face; + struct Vertex; + struct MRIS_MP; + struct Surface; + } // namespace XYZPositionConsequences + + + namespace Distort { + struct Face; + struct Vertex; + struct MRIS_MP; + struct Surface; + } // namespace Distort + + + namespace Analysis { + struct Face; + struct Vertex; + struct MRIS_MP; + struct Surface; + } // namespace Analysis + + + namespace ExistenceM { + struct Face; + struct Vertex; + struct MRIS_MP; + struct Surface; + } // namespace ExistenceM + + + namespace TopologyM { + struct Face; + struct Vertex; + struct MRIS_MP; + struct Surface; + } // namespace TopologyM + + + namespace XYZPositionM { + struct Face; + struct Vertex; + struct MRIS_MP; + struct Surface; + } // namespace XYZPositionM + + + namespace XYZPositionConsequencesM { + struct Face; + struct Vertex; + struct MRIS_MP; + struct Surface; + } // namespace XYZPositionConsequencesM + + + namespace DistortM { + struct Face; + struct Vertex; + struct MRIS_MP; + struct Surface; + } // namespace DistortM + + + namespace AnalysisM { + struct Face; + struct Vertex; + struct MRIS_MP; + struct Surface; + } // namespace AnalysisM + + + namespace AllM { + struct Face; + struct Vertex; + struct MRIS_MP; + struct Surface; + } // namespace AllM + + struct Repr_Elt { + bool operator==(Repr_Elt const & rhs) const { return repr == rhs.repr && idx == rhs.idx; } + bool operator!=(Repr_Elt const & rhs) const { return repr != rhs.repr || idx != rhs.idx; } + protected: + Representation* repr; size_t idx; + Repr_Elt() : repr(nullptr), idx(0) {} + Repr_Elt(Representation* repr, size_t idx) : repr(repr), idx(idx) {} + Repr_Elt(Repr_Elt const & src) : repr(src.repr), idx(src.idx) {} + + friend struct SurfaceFromMRIS_MP::ExistenceM::Face; + friend struct SurfaceFromMRIS_MP::ExistenceM::Vertex; + friend struct SurfaceFromMRIS_MP::ExistenceM::Surface; + friend struct SurfaceFromMRIS_MP::Existence::Face; + friend struct SurfaceFromMRIS_MP::Existence::Vertex; + friend struct SurfaceFromMRIS_MP::Existence::Surface; + friend struct SurfaceFromMRIS_MP::TopologyM::Face; + friend struct SurfaceFromMRIS_MP::TopologyM::Vertex; + friend struct SurfaceFromMRIS_MP::TopologyM::Surface; + friend struct SurfaceFromMRIS_MP::Topology::Face; + friend struct SurfaceFromMRIS_MP::Topology::Vertex; + friend struct SurfaceFromMRIS_MP::Topology::Surface; + friend struct SurfaceFromMRIS_MP::XYZPositionM::Face; + friend struct SurfaceFromMRIS_MP::XYZPositionM::Vertex; + friend struct SurfaceFromMRIS_MP::XYZPositionM::Surface; + friend struct SurfaceFromMRIS_MP::XYZPosition::Face; + friend struct SurfaceFromMRIS_MP::XYZPosition::Vertex; + friend struct SurfaceFromMRIS_MP::XYZPosition::Surface; + friend struct SurfaceFromMRIS_MP::XYZPositionConsequencesM::Face; + friend struct SurfaceFromMRIS_MP::XYZPositionConsequencesM::Vertex; + friend struct SurfaceFromMRIS_MP::XYZPositionConsequencesM::Surface; + friend struct SurfaceFromMRIS_MP::XYZPositionConsequences::Face; + friend struct SurfaceFromMRIS_MP::XYZPositionConsequences::Vertex; + friend struct SurfaceFromMRIS_MP::XYZPositionConsequences::Surface; + friend struct SurfaceFromMRIS_MP::DistortM::Face; + friend struct SurfaceFromMRIS_MP::DistortM::Vertex; + friend struct SurfaceFromMRIS_MP::DistortM::Surface; + friend struct SurfaceFromMRIS_MP::Distort::Face; + friend struct SurfaceFromMRIS_MP::Distort::Vertex; + friend struct SurfaceFromMRIS_MP::Distort::Surface; + friend struct SurfaceFromMRIS_MP::AnalysisM::Face; + friend struct SurfaceFromMRIS_MP::AnalysisM::Vertex; + friend struct SurfaceFromMRIS_MP::AnalysisM::Surface; + friend struct SurfaceFromMRIS_MP::Analysis::Face; + friend struct SurfaceFromMRIS_MP::Analysis::Vertex; + friend struct SurfaceFromMRIS_MP::Analysis::Surface; + friend struct SurfaceFromMRIS_MP::AllM::Face; + friend struct SurfaceFromMRIS_MP::AllM::Vertex; + friend struct SurfaceFromMRIS_MP::AllM::Surface; + }; +} // SurfaceFromMRIS_MP diff --git a/include/mrisurf_SurfaceFromMRIS_MP_generated_suffix.h b/include/mrisurf_SurfaceFromMRIS_MP_generated_suffix.h new file mode 100644 index 00000000000..4c1e751e5da --- /dev/null +++ b/include/mrisurf_SurfaceFromMRIS_MP_generated_suffix.h @@ -0,0 +1,3244 @@ + +#pragma once +// GENERATED SOURCE - DO NOT DIRECTLY EDIT +// +// ======================================= +#include "mrisurf_aaa.h" +namespace SurfaceFromMRIS_MP { + typedef MRIS_MP Representation; + + + namespace Existence { + Face::Face ( ) {} + Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Face::Face ( Face const & src ) : Repr_Elt(src) {} + Face::Face ( TopologyM::Face const & src ) : Repr_Elt(src) {} + Face::Face ( Topology::Face const & src ) : Repr_Elt(src) {} + Face::Face ( XYZPositionM::Face const & src ) : Repr_Elt(src) {} + Face::Face ( XYZPosition::Face const & src ) : Repr_Elt(src) {} + Face::Face ( XYZPositionConsequencesM::Face const & src ) : Repr_Elt(src) {} + Face::Face ( XYZPositionConsequences::Face const & src ) : Repr_Elt(src) {} + Face::Face ( DistortM::Face const & src ) : Repr_Elt(src) {} + Face::Face ( Distort::Face const & src ) : Repr_Elt(src) {} + Face::Face ( AnalysisM::Face const & src ) : Repr_Elt(src) {} + Face::Face ( Analysis::Face const & src ) : Repr_Elt(src) {} + Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} + + char Face::ripflag() const { + return repr->f_ripflag[idx]; + } + + void Face::set_ripflag(char to) { + repr->f_ripflag[idx] = to; + } + + + Vertex::Vertex ( ) {} + Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( TopologyM::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( Topology::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( XYZPositionM::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( XYZPosition::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( XYZPositionConsequencesM::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( XYZPositionConsequences::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( DistortM::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( Distort::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AnalysisM::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( Analysis::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} + + char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache + return repr->v_ripflag[idx]; + } + void Vertex::which_coords(int which, float *x, float *y, float *z) const { + + #define CASE(WHICH, FIELD) \ + case WHICH: \ + *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ + break; + + switch (which) { + default: + *x = *y = *z = 0.0; + ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); + break; + } + + #undef CASE + } + + void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache + repr->v_ripflag[idx] = to; + } + + + MRIS_MP::MRIS_MP ( ) {} + MRIS_MP::MRIS_MP ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + MRIS_MP::MRIS_MP ( MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( TopologyM::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( Topology::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( XYZPositionM::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( XYZPosition::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( XYZPositionConsequencesM::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( XYZPositionConsequences::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( DistortM::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( Distort::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( AnalysisM::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( Analysis::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( AllM::MRIS_MP const & src ) : Repr_Elt(src) {} + + + + Surface::Surface ( ) {} + Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} + Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( TopologyM::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( Topology::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( XYZPositionM::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( XYZPosition::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( XYZPositionConsequencesM::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( XYZPositionConsequences::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( DistortM::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( Distort::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AnalysisM::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( Analysis::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; + } + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->underlyingMRIS->status; + } + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; + } + int Surface::patch() const { // if a patch of the surface + return repr->underlyingMRIS->patch; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->underlyingMRIS->noscale; + } + + + } // namespace Existence + + + namespace Topology { + Face::Face ( ) {} + Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Face::Face ( Face const & src ) : Repr_Elt(src) {} + Face::Face ( XYZPositionM::Face const & src ) : Repr_Elt(src) {} + Face::Face ( XYZPosition::Face const & src ) : Repr_Elt(src) {} + Face::Face ( XYZPositionConsequencesM::Face const & src ) : Repr_Elt(src) {} + Face::Face ( XYZPositionConsequences::Face const & src ) : Repr_Elt(src) {} + Face::Face ( DistortM::Face const & src ) : Repr_Elt(src) {} + Face::Face ( Distort::Face const & src ) : Repr_Elt(src) {} + Face::Face ( AnalysisM::Face const & src ) : Repr_Elt(src) {} + Face::Face ( Analysis::Face const & src ) : Repr_Elt(src) {} + Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} + + Vertex Face::v(size_t i) const { + return Vertex(repr,repr->f_v[idx][i]); + } + char Face::ripflag() const { + return repr->f_ripflag[idx]; + } + + void Face::set_ripflag(char to) { + repr->f_ripflag[idx] = to; + } + + + Vertex::Vertex ( ) {} + Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( XYZPositionM::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( XYZPosition::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( XYZPositionConsequencesM::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( XYZPositionConsequences::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( DistortM::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( Distort::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AnalysisM::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( Analysis::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} + + char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache + return repr->v_ripflag[idx]; + } + void Vertex::which_coords(int which, float *x, float *y, float *z) const { + + #define CASE(WHICH, FIELD) \ + case WHICH: \ + *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ + break; + + switch (which) { + default: + *x = *y = *z = 0.0; + ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); + break; + } + + #undef CASE + } + + void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache + repr->v_ripflag[idx] = to; + } + + + MRIS_MP::MRIS_MP ( ) {} + MRIS_MP::MRIS_MP ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + MRIS_MP::MRIS_MP ( MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( XYZPositionM::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( XYZPosition::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( XYZPositionConsequencesM::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( XYZPositionConsequences::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( DistortM::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( Distort::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( AnalysisM::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( Analysis::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( AllM::MRIS_MP const & src ) : Repr_Elt(src) {} + + + + Surface::Surface ( ) {} + Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} + Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( XYZPositionM::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( XYZPosition::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( XYZPositionConsequencesM::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( XYZPositionConsequences::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( DistortM::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( Distort::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AnalysisM::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( Analysis::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + + int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nvertices; + } + int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nfaces; + } + Vertex Surface::vertices(size_t i) const { + return Vertex(repr, i); + } + Face Surface::faces(size_t i) const { + return Face(repr, i); + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; + } + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->underlyingMRIS->status; + } + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; + } + int Surface::patch() const { // if a patch of the surface + return repr->underlyingMRIS->patch; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->underlyingMRIS->noscale; + } + + + } // namespace Topology + + + namespace XYZPosition { + Face::Face ( ) {} + Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Face::Face ( Face const & src ) : Repr_Elt(src) {} + Face::Face ( XYZPositionConsequencesM::Face const & src ) : Repr_Elt(src) {} + Face::Face ( XYZPositionConsequences::Face const & src ) : Repr_Elt(src) {} + Face::Face ( DistortM::Face const & src ) : Repr_Elt(src) {} + Face::Face ( Distort::Face const & src ) : Repr_Elt(src) {} + Face::Face ( AnalysisM::Face const & src ) : Repr_Elt(src) {} + Face::Face ( Analysis::Face const & src ) : Repr_Elt(src) {} + Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} + + Vertex Face::v(size_t i) const { + return Vertex(repr,repr->f_v[idx][i]); + } + char Face::ripflag() const { + return repr->f_ripflag[idx]; + } + + void Face::set_ripflag(char to) { + repr->f_ripflag[idx] = to; + } + + + Vertex::Vertex ( ) {} + Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( XYZPositionConsequencesM::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( XYZPositionConsequences::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( DistortM::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( Distort::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AnalysisM::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( Analysis::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} + + float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz + return repr->v_dist[idx][i]; + } + float Vertex::dist_orig(size_t i) const { // size() is vtotal. distance to neighboring vertices based on origxyz + return repr->v_dist_orig[idx][i]; + } + int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_capacity[idx]; + } + float Vertex::x() const { // current coordinates + return repr->v_x[idx]; + } + float Vertex::y() const { // use MRISsetXYZ() to set + return repr->v_y[idx]; + } + float Vertex::z() const { + return repr->v_z[idx]; + } + float Vertex::origx() const { // original coordinates, see also MRIS::origxyz_status + return repr->v_origx[idx]; + } + float Vertex::origy() const { // use MRISsetOriginalXYZ(, + return repr->v_origy[idx]; + } + float Vertex::origz() const { // or MRISsetOriginalXYZfromXYZ to set + return repr->v_origz[idx]; + } + float Vertex::cx() const { + return repr->v_cx[idx]; + } + float Vertex::cy() const { + return repr->v_cy[idx]; + } + float Vertex::cz() const { // coordinates in canonical coordinate system + return repr->v_cz[idx]; + } + char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache + return repr->v_ripflag[idx]; + } + void Vertex::which_coords(int which, float *x, float *y, float *z) const { + + #define CASE(WHICH, FIELD) \ + case WHICH: \ + *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ + break; + + switch (which) { + CASE(CURRENT_VERTICES,) + CASE(ORIGINAL_VERTICES,orig) + CASE(CANONICAL_VERTICES,c) + default: + *x = *y = *z = 0.0; + ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); + break; + } + + #undef CASE + } + + void Vertex::set_cx(float to) { + repr->v_cx[idx] = to; + } + void Vertex::set_cy(float to) { + repr->v_cy[idx] = to; + } + void Vertex::set_cz(float to) { // coordinates in canonical coordinate system + repr->v_cz[idx] = to; + } + void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache + repr->v_ripflag[idx] = to; + } + + + MRIS_MP::MRIS_MP ( ) {} + MRIS_MP::MRIS_MP ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + MRIS_MP::MRIS_MP ( MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( XYZPositionConsequencesM::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( XYZPositionConsequences::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( DistortM::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( Distort::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( AnalysisM::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( Analysis::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( AllM::MRIS_MP const & src ) : Repr_Elt(src) {} + + + + Surface::Surface ( ) {} + Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} + Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( XYZPositionConsequencesM::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( XYZPositionConsequences::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( DistortM::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( Distort::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AnalysisM::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( Analysis::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + + int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nvertices; + } + int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nfaces; + } + Vertex Surface::vertices(size_t i) const { + return Vertex(repr, i); + } + Face Surface::faces(size_t i) const { + return Face(repr, i); + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; + } + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->underlyingMRIS->status; + } + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; + } + int Surface::patch() const { // if a patch of the surface + return repr->underlyingMRIS->patch; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->underlyingMRIS->noscale; + } + + + } // namespace XYZPosition + + + namespace XYZPositionConsequences { + Face::Face ( ) {} + Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Face::Face ( Face const & src ) : Repr_Elt(src) {} + Face::Face ( DistortM::Face const & src ) : Repr_Elt(src) {} + Face::Face ( Distort::Face const & src ) : Repr_Elt(src) {} + Face::Face ( AnalysisM::Face const & src ) : Repr_Elt(src) {} + Face::Face ( Analysis::Face const & src ) : Repr_Elt(src) {} + Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} + + Vertex Face::v(size_t i) const { + return Vertex(repr,repr->f_v[idx][i]); + } + float Face::area() const { + return repr->f_area[idx]; + } + angles_per_triangle_t Face::angle() const { + return repr->f_angle[idx]; + } + angles_per_triangle_t Face::orig_angle() const { + return repr->f_orig_angle[idx]; + } + char Face::ripflag() const { + return repr->f_ripflag[idx]; + } + FloatXYZ Face::norm() const { + return repr->f_norm[idx]; + } + + void Face::set_orig_angle(angles_per_triangle_t to) { + repr->f_orig_angle[idx] = to; + } + void Face::set_ripflag(char to) { + repr->f_ripflag[idx] = to; + } + + + Vertex::Vertex ( ) {} + Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( DistortM::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( Distort::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AnalysisM::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( Analysis::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} + + float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz + return repr->v_dist[idx][i]; + } + float Vertex::dist_orig(size_t i) const { // size() is vtotal. distance to neighboring vertices based on origxyz + return repr->v_dist_orig[idx][i]; + } + int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_capacity[idx]; + } + float Vertex::x() const { // current coordinates + return repr->v_x[idx]; + } + float Vertex::y() const { // use MRISsetXYZ() to set + return repr->v_y[idx]; + } + float Vertex::z() const { + return repr->v_z[idx]; + } + float Vertex::origx() const { // original coordinates, see also MRIS::origxyz_status + return repr->v_origx[idx]; + } + float Vertex::origy() const { // use MRISsetOriginalXYZ(, + return repr->v_origy[idx]; + } + float Vertex::origz() const { // or MRISsetOriginalXYZfromXYZ to set + return repr->v_origz[idx]; + } + float Vertex::nx() const { + return repr->v_nx[idx]; + } + float Vertex::ny() const { + return repr->v_ny[idx]; + } + float Vertex::nz() const { // curr normal + return repr->v_nz[idx]; + } + float Vertex::cx() const { + return repr->v_cx[idx]; + } + float Vertex::cy() const { + return repr->v_cy[idx]; + } + float Vertex::cz() const { // coordinates in canonical coordinate system + return repr->v_cz[idx]; + } + float Vertex::area() const { + return repr->v_area[idx]; + } + char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache + return repr->v_ripflag[idx]; + } + void Vertex::which_coords(int which, float *x, float *y, float *z) const { + + #define CASE(WHICH, FIELD) \ + case WHICH: \ + *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ + break; + + switch (which) { + CASE(CURRENT_VERTICES,) + CASE(ORIGINAL_VERTICES,orig) + CASE(VERTEX_NORMALS,n) + CASE(CANONICAL_VERTICES,c) + default: + *x = *y = *z = 0.0; + ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); + break; + } + + #undef CASE + } + + void Vertex::set_nx(float to) { + repr->v_nx[idx] = to; + } + void Vertex::set_ny(float to) { + repr->v_ny[idx] = to; + } + void Vertex::set_nz(float to) { // curr normal + repr->v_nz[idx] = to; + } + void Vertex::set_cx(float to) { + repr->v_cx[idx] = to; + } + void Vertex::set_cy(float to) { + repr->v_cy[idx] = to; + } + void Vertex::set_cz(float to) { // coordinates in canonical coordinate system + repr->v_cz[idx] = to; + } + void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache + repr->v_ripflag[idx] = to; + } + + + MRIS_MP::MRIS_MP ( ) {} + MRIS_MP::MRIS_MP ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + MRIS_MP::MRIS_MP ( MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( DistortM::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( Distort::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( AnalysisM::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( Analysis::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( AllM::MRIS_MP const & src ) : Repr_Elt(src) {} + + + + Surface::Surface ( ) {} + Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} + Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( DistortM::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( Distort::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AnalysisM::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( Analysis::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + + int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nvertices; + } + int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nfaces; + } + Vertex Surface::vertices(size_t i) const { + return Vertex(repr, i); + } + Face Surface::faces(size_t i) const { + return Face(repr, i); + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + float Surface::xctr() const { + return repr->xctr; + } + float Surface::yctr() const { + return repr->yctr; + } + float Surface::zctr() const { + return repr->zctr; + } + float Surface::xlo() const { + return repr->xlo; + } + float Surface::ylo() const { + return repr->ylo; + } + float Surface::zlo() const { + return repr->zlo; + } + float Surface::xhi() const { + return repr->xhi; + } + float Surface::yhi() const { + return repr->yhi; + } + float Surface::zhi() const { + return repr->zhi; + } + float Surface::total_area() const { + return repr->total_area; + } + double Surface::avg_vertex_area() const { + return repr->avg_vertex_area; + } + double Surface::avg_vertex_dist() const { // set by MRIScomputeAvgInterVertexDist + return repr->avg_vertex_dist; + } + double Surface::std_vertex_dist() const { + return repr->std_vertex_dist; + } + float Surface::orig_area() const { + return repr->orig_area; + } + float Surface::neg_area() const { + return repr->neg_area; + } + float Surface::neg_orig_area() const { // amount of original surface in folds + return repr->neg_orig_area; + } + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; + } + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->underlyingMRIS->status; + } + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; + } + int Surface::patch() const { // if a patch of the surface + return repr->underlyingMRIS->patch; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->underlyingMRIS->noscale; + } + + void Surface::set_xctr(float to) { + repr->xctr = to; + } + void Surface::set_yctr(float to) { + repr->yctr = to; + } + void Surface::set_zctr(float to) { + repr->zctr = to; + } + void Surface::set_xlo(float to) { + repr->xlo = to; + } + void Surface::set_ylo(float to) { + repr->ylo = to; + } + void Surface::set_zlo(float to) { + repr->zlo = to; + } + void Surface::set_xhi(float to) { + repr->xhi = to; + } + void Surface::set_yhi(float to) { + repr->yhi = to; + } + void Surface::set_zhi(float to) { + repr->zhi = to; + } + void Surface::set_total_area(float to) { + repr->total_area = to; + } + void Surface::set_avg_vertex_area(double to) { + repr->avg_vertex_area = to; + } + + + } // namespace XYZPositionConsequences + + + namespace Distort { + Face::Face ( ) {} + Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Face::Face ( Face const & src ) : Repr_Elt(src) {} + Face::Face ( AnalysisM::Face const & src ) : Repr_Elt(src) {} + Face::Face ( Analysis::Face const & src ) : Repr_Elt(src) {} + Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} + + Vertex Face::v(size_t i) const { + return Vertex(repr,repr->f_v[idx][i]); + } + float Face::area() const { + return repr->f_area[idx]; + } + angles_per_triangle_t Face::angle() const { + return repr->f_angle[idx]; + } + angles_per_triangle_t Face::orig_angle() const { + return repr->f_orig_angle[idx]; + } + char Face::ripflag() const { + return repr->f_ripflag[idx]; + } + FloatXYZ Face::norm() const { + return repr->f_norm[idx]; + } + + void Face::set_orig_angle(angles_per_triangle_t to) { + repr->f_orig_angle[idx] = to; + } + void Face::set_ripflag(char to) { + repr->f_ripflag[idx] = to; + } + + + Vertex::Vertex ( ) {} + Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AnalysisM::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( Analysis::Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} + + float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz + return repr->v_dist[idx][i]; + } + float Vertex::dist_orig(size_t i) const { // size() is vtotal. distance to neighboring vertices based on origxyz + return repr->v_dist_orig[idx][i]; + } + int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_capacity[idx]; + } + float Vertex::x() const { // current coordinates + return repr->v_x[idx]; + } + float Vertex::y() const { // use MRISsetXYZ() to set + return repr->v_y[idx]; + } + float Vertex::z() const { + return repr->v_z[idx]; + } + float Vertex::origx() const { // original coordinates, see also MRIS::origxyz_status + return repr->v_origx[idx]; + } + float Vertex::origy() const { // use MRISsetOriginalXYZ(, + return repr->v_origy[idx]; + } + float Vertex::origz() const { // or MRISsetOriginalXYZfromXYZ to set + return repr->v_origz[idx]; + } + float Vertex::nx() const { + return repr->v_nx[idx]; + } + float Vertex::ny() const { + return repr->v_ny[idx]; + } + float Vertex::nz() const { // curr normal + return repr->v_nz[idx]; + } + float Vertex::wnx() const { + return repr->v_wnx[idx]; + } + float Vertex::wny() const { + return repr->v_wny[idx]; + } + float Vertex::wnz() const { // white normal + return repr->v_wnz[idx]; + } + float Vertex::dx() const { + return repr->v_dx[idx]; + } + float Vertex::dy() const { + return repr->v_dy[idx]; + } + float Vertex::dz() const { // current change in position + return repr->v_dz[idx]; + } + float Vertex::curv() const { // curr curvature + return repr->v_curv[idx]; + } + float Vertex::cx() const { + return repr->v_cx[idx]; + } + float Vertex::cy() const { + return repr->v_cy[idx]; + } + float Vertex::cz() const { // coordinates in canonical coordinate system + return repr->v_cz[idx]; + } + float Vertex::pialx() const { + return repr->v_pialx[idx]; + } + float Vertex::pialy() const { + return repr->v_pialy[idx]; + } + float Vertex::pialz() const { // pial surface coordinates + return repr->v_pialz[idx]; + } + float Vertex::whitex() const { + return repr->v_whitex[idx]; + } + float Vertex::whitey() const { + return repr->v_whitey[idx]; + } + float Vertex::whitez() const { // white surface coordinates + return repr->v_whitez[idx]; + } + float Vertex::area() const { + return repr->v_area[idx]; + } + float Vertex::origarea() const { + return repr->v_origarea[idx]; + } + int Vertex::fno() const { // face that this vertex is in + return repr->v_fno[idx]; + } + char Vertex::neg() const { // 1 if the normal vector is inverted + return repr->v_neg[idx]; + } + char Vertex::border() const { // flag + return repr->v_border[idx]; + } + char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache + return repr->v_ripflag[idx]; + } + void Vertex::which_coords(int which, float *x, float *y, float *z) const { + + #define CASE(WHICH, FIELD) \ + case WHICH: \ + *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ + break; + + switch (which) { + CASE(CURRENT_VERTICES,) + CASE(ORIGINAL_VERTICES,orig) + CASE(VERTEX_NORMALS,n) + CASE(WHITE_NORMALS,wn) + CASE(CANONICAL_VERTICES,c) + CASE(PIAL_VERTICES,pial) + CASE(WHITE_VERTICES,white) + default: + *x = *y = *z = 0.0; + ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); + break; + } + + #undef CASE + } + + void Vertex::set_nx(float to) { + repr->v_nx[idx] = to; + } + void Vertex::set_ny(float to) { + repr->v_ny[idx] = to; + } + void Vertex::set_nz(float to) { // curr normal + repr->v_nz[idx] = to; + } + void Vertex::set_wnx(float to) { + repr->v_wnx[idx] = to; + } + void Vertex::set_wny(float to) { + repr->v_wny[idx] = to; + } + void Vertex::set_wnz(float to) { // white normal + repr->v_wnz[idx] = to; + } + void Vertex::set_dx(float to) { + repr->v_dx[idx] = to; + } + void Vertex::set_dy(float to) { + repr->v_dy[idx] = to; + } + void Vertex::set_dz(float to) { // current change in position + repr->v_dz[idx] = to; + } + void Vertex::set_curv(float to) { // curr curvature + repr->v_curv[idx] = to; + } + void Vertex::set_cx(float to) { + repr->v_cx[idx] = to; + } + void Vertex::set_cy(float to) { + repr->v_cy[idx] = to; + } + void Vertex::set_cz(float to) { // coordinates in canonical coordinate system + repr->v_cz[idx] = to; + } + void Vertex::set_pialx(float to) { + repr->v_pialx[idx] = to; + } + void Vertex::set_pialy(float to) { + repr->v_pialy[idx] = to; + } + void Vertex::set_pialz(float to) { // pial surface coordinates + repr->v_pialz[idx] = to; + } + void Vertex::set_whitex(float to) { + repr->v_whitex[idx] = to; + } + void Vertex::set_whitey(float to) { + repr->v_whitey[idx] = to; + } + void Vertex::set_whitez(float to) { // white surface coordinates + repr->v_whitez[idx] = to; + } + void Vertex::set_origarea(float to) { + repr->v_origarea[idx] = to; + } + void Vertex::set_fno(int to) { // face that this vertex is in + repr->v_fno[idx] = to; + } + void Vertex::set_neg(char to) { // 1 if the normal vector is inverted + repr->v_neg[idx] = to; + } + void Vertex::set_border(char to) { // flag + repr->v_border[idx] = to; + } + void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache + repr->v_ripflag[idx] = to; + } + + + MRIS_MP::MRIS_MP ( ) {} + MRIS_MP::MRIS_MP ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + MRIS_MP::MRIS_MP ( MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( AnalysisM::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( Analysis::MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( AllM::MRIS_MP const & src ) : Repr_Elt(src) {} + + + + Surface::Surface ( ) {} + Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} + Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AnalysisM::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( Analysis::Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + + int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nvertices; + } + int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nfaces; + } + Vertex Surface::vertices(size_t i) const { + return Vertex(repr, i); + } + Face Surface::faces(size_t i) const { + return Face(repr, i); + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + float Surface::xctr() const { + return repr->xctr; + } + float Surface::yctr() const { + return repr->yctr; + } + float Surface::zctr() const { + return repr->zctr; + } + float Surface::xlo() const { + return repr->xlo; + } + float Surface::ylo() const { + return repr->ylo; + } + float Surface::zlo() const { + return repr->zlo; + } + float Surface::xhi() const { + return repr->xhi; + } + float Surface::yhi() const { + return repr->yhi; + } + float Surface::zhi() const { + return repr->zhi; + } + float Surface::total_area() const { + return repr->total_area; + } + double Surface::avg_vertex_area() const { + return repr->avg_vertex_area; + } + double Surface::avg_vertex_dist() const { // set by MRIScomputeAvgInterVertexDist + return repr->avg_vertex_dist; + } + double Surface::std_vertex_dist() const { + return repr->std_vertex_dist; + } + float Surface::orig_area() const { + return repr->orig_area; + } + float Surface::neg_area() const { + return repr->neg_area; + } + float Surface::neg_orig_area() const { // amount of original surface in folds + return repr->neg_orig_area; + } + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; + } + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->underlyingMRIS->status; + } + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; + } + int Surface::patch() const { // if a patch of the surface + return repr->underlyingMRIS->patch; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->underlyingMRIS->noscale; + } + + void Surface::set_xctr(float to) { + repr->xctr = to; + } + void Surface::set_yctr(float to) { + repr->yctr = to; + } + void Surface::set_zctr(float to) { + repr->zctr = to; + } + void Surface::set_xlo(float to) { + repr->xlo = to; + } + void Surface::set_ylo(float to) { + repr->ylo = to; + } + void Surface::set_zlo(float to) { + repr->zlo = to; + } + void Surface::set_xhi(float to) { + repr->xhi = to; + } + void Surface::set_yhi(float to) { + repr->yhi = to; + } + void Surface::set_zhi(float to) { + repr->zhi = to; + } + void Surface::set_total_area(float to) { + repr->total_area = to; + } + void Surface::set_avg_vertex_area(double to) { + repr->avg_vertex_area = to; + } + + + } // namespace Distort + + + namespace Analysis { + Face::Face ( ) {} + Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Face::Face ( Face const & src ) : Repr_Elt(src) {} + Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} + + Vertex Face::v(size_t i) const { + return Vertex(repr,repr->f_v[idx][i]); + } + float Face::area() const { + return repr->f_area[idx]; + } + angles_per_triangle_t Face::angle() const { + return repr->f_angle[idx]; + } + angles_per_triangle_t Face::orig_angle() const { + return repr->f_orig_angle[idx]; + } + char Face::ripflag() const { + return repr->f_ripflag[idx]; + } + FloatXYZ Face::norm() const { + return repr->f_norm[idx]; + } + + void Face::set_orig_angle(angles_per_triangle_t to) { + repr->f_orig_angle[idx] = to; + } + void Face::set_ripflag(char to) { + repr->f_ripflag[idx] = to; + } + + + Vertex::Vertex ( ) {} + Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} + + float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz + return repr->v_dist[idx][i]; + } + float Vertex::dist_orig(size_t i) const { // size() is vtotal. distance to neighboring vertices based on origxyz + return repr->v_dist_orig[idx][i]; + } + int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_capacity[idx]; + } + float Vertex::x() const { // current coordinates + return repr->v_x[idx]; + } + float Vertex::y() const { // use MRISsetXYZ() to set + return repr->v_y[idx]; + } + float Vertex::z() const { + return repr->v_z[idx]; + } + float Vertex::origx() const { // original coordinates, see also MRIS::origxyz_status + return repr->v_origx[idx]; + } + float Vertex::origy() const { // use MRISsetOriginalXYZ(, + return repr->v_origy[idx]; + } + float Vertex::origz() const { // or MRISsetOriginalXYZfromXYZ to set + return repr->v_origz[idx]; + } + float Vertex::nx() const { + return repr->v_nx[idx]; + } + float Vertex::ny() const { + return repr->v_ny[idx]; + } + float Vertex::nz() const { // curr normal + return repr->v_nz[idx]; + } + float Vertex::wnx() const { + return repr->v_wnx[idx]; + } + float Vertex::wny() const { + return repr->v_wny[idx]; + } + float Vertex::wnz() const { // white normal + return repr->v_wnz[idx]; + } + float Vertex::dx() const { + return repr->v_dx[idx]; + } + float Vertex::dy() const { + return repr->v_dy[idx]; + } + float Vertex::dz() const { // current change in position + return repr->v_dz[idx]; + } + float Vertex::curv() const { // curr curvature + return repr->v_curv[idx]; + } + float Vertex::cx() const { + return repr->v_cx[idx]; + } + float Vertex::cy() const { + return repr->v_cy[idx]; + } + float Vertex::cz() const { // coordinates in canonical coordinate system + return repr->v_cz[idx]; + } + float Vertex::pialx() const { + return repr->v_pialx[idx]; + } + float Vertex::pialy() const { + return repr->v_pialy[idx]; + } + float Vertex::pialz() const { // pial surface coordinates + return repr->v_pialz[idx]; + } + float Vertex::whitex() const { + return repr->v_whitex[idx]; + } + float Vertex::whitey() const { + return repr->v_whitey[idx]; + } + float Vertex::whitez() const { // white surface coordinates + return repr->v_whitez[idx]; + } + float Vertex::area() const { + return repr->v_area[idx]; + } + float Vertex::origarea() const { + return repr->v_origarea[idx]; + } + int Vertex::fno() const { // face that this vertex is in + return repr->v_fno[idx]; + } + char Vertex::neg() const { // 1 if the normal vector is inverted + return repr->v_neg[idx]; + } + char Vertex::border() const { // flag + return repr->v_border[idx]; + } + char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache + return repr->v_ripflag[idx]; + } + void Vertex::which_coords(int which, float *x, float *y, float *z) const { + + #define CASE(WHICH, FIELD) \ + case WHICH: \ + *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ + break; + + switch (which) { + CASE(CURRENT_VERTICES,) + CASE(ORIGINAL_VERTICES,orig) + CASE(VERTEX_NORMALS,n) + CASE(WHITE_NORMALS,wn) + CASE(CANONICAL_VERTICES,c) + CASE(PIAL_VERTICES,pial) + CASE(WHITE_VERTICES,white) + default: + *x = *y = *z = 0.0; + ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); + break; + } + + #undef CASE + } + + void Vertex::set_nx(float to) { + repr->v_nx[idx] = to; + } + void Vertex::set_ny(float to) { + repr->v_ny[idx] = to; + } + void Vertex::set_nz(float to) { // curr normal + repr->v_nz[idx] = to; + } + void Vertex::set_wnx(float to) { + repr->v_wnx[idx] = to; + } + void Vertex::set_wny(float to) { + repr->v_wny[idx] = to; + } + void Vertex::set_wnz(float to) { // white normal + repr->v_wnz[idx] = to; + } + void Vertex::set_dx(float to) { + repr->v_dx[idx] = to; + } + void Vertex::set_dy(float to) { + repr->v_dy[idx] = to; + } + void Vertex::set_dz(float to) { // current change in position + repr->v_dz[idx] = to; + } + void Vertex::set_curv(float to) { // curr curvature + repr->v_curv[idx] = to; + } + void Vertex::set_cx(float to) { + repr->v_cx[idx] = to; + } + void Vertex::set_cy(float to) { + repr->v_cy[idx] = to; + } + void Vertex::set_cz(float to) { // coordinates in canonical coordinate system + repr->v_cz[idx] = to; + } + void Vertex::set_pialx(float to) { + repr->v_pialx[idx] = to; + } + void Vertex::set_pialy(float to) { + repr->v_pialy[idx] = to; + } + void Vertex::set_pialz(float to) { // pial surface coordinates + repr->v_pialz[idx] = to; + } + void Vertex::set_whitex(float to) { + repr->v_whitex[idx] = to; + } + void Vertex::set_whitey(float to) { + repr->v_whitey[idx] = to; + } + void Vertex::set_whitez(float to) { // white surface coordinates + repr->v_whitez[idx] = to; + } + void Vertex::set_origarea(float to) { + repr->v_origarea[idx] = to; + } + void Vertex::set_fno(int to) { // face that this vertex is in + repr->v_fno[idx] = to; + } + void Vertex::set_neg(char to) { // 1 if the normal vector is inverted + repr->v_neg[idx] = to; + } + void Vertex::set_border(char to) { // flag + repr->v_border[idx] = to; + } + void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache + repr->v_ripflag[idx] = to; + } + + + MRIS_MP::MRIS_MP ( ) {} + MRIS_MP::MRIS_MP ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + MRIS_MP::MRIS_MP ( MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( AllM::MRIS_MP const & src ) : Repr_Elt(src) {} + + + + Surface::Surface ( ) {} + Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} + Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + + int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nvertices; + } + int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nfaces; + } + Vertex Surface::vertices(size_t i) const { + return Vertex(repr, i); + } + Face Surface::faces(size_t i) const { + return Face(repr, i); + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + float Surface::xctr() const { + return repr->xctr; + } + float Surface::yctr() const { + return repr->yctr; + } + float Surface::zctr() const { + return repr->zctr; + } + float Surface::xlo() const { + return repr->xlo; + } + float Surface::ylo() const { + return repr->ylo; + } + float Surface::zlo() const { + return repr->zlo; + } + float Surface::xhi() const { + return repr->xhi; + } + float Surface::yhi() const { + return repr->yhi; + } + float Surface::zhi() const { + return repr->zhi; + } + float Surface::total_area() const { + return repr->total_area; + } + double Surface::avg_vertex_area() const { + return repr->avg_vertex_area; + } + double Surface::avg_vertex_dist() const { // set by MRIScomputeAvgInterVertexDist + return repr->avg_vertex_dist; + } + double Surface::std_vertex_dist() const { + return repr->std_vertex_dist; + } + float Surface::orig_area() const { + return repr->orig_area; + } + float Surface::neg_area() const { + return repr->neg_area; + } + float Surface::neg_orig_area() const { // amount of original surface in folds + return repr->neg_orig_area; + } + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; + } + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->underlyingMRIS->status; + } + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; + } + int Surface::patch() const { // if a patch of the surface + return repr->underlyingMRIS->patch; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->underlyingMRIS->noscale; + } + + void Surface::set_xctr(float to) { + repr->xctr = to; + } + void Surface::set_yctr(float to) { + repr->yctr = to; + } + void Surface::set_zctr(float to) { + repr->zctr = to; + } + void Surface::set_xlo(float to) { + repr->xlo = to; + } + void Surface::set_ylo(float to) { + repr->ylo = to; + } + void Surface::set_zlo(float to) { + repr->zlo = to; + } + void Surface::set_xhi(float to) { + repr->xhi = to; + } + void Surface::set_yhi(float to) { + repr->yhi = to; + } + void Surface::set_zhi(float to) { + repr->zhi = to; + } + void Surface::set_total_area(float to) { + repr->total_area = to; + } + void Surface::set_avg_vertex_area(double to) { + repr->avg_vertex_area = to; + } + + + } // namespace Analysis + + + namespace ExistenceM { + Face::Face ( ) {} + Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Face::Face ( Face const & src ) : Repr_Elt(src) {} + Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} + + char Face::ripflag() const { + return repr->f_ripflag[idx]; + } + + void Face::set_ripflag(char to) { + repr->f_ripflag[idx] = to; + } + + + Vertex::Vertex ( ) {} + Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} + + char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache + return repr->v_ripflag[idx]; + } + void Vertex::which_coords(int which, float *x, float *y, float *z) const { + + #define CASE(WHICH, FIELD) \ + case WHICH: \ + *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ + break; + + switch (which) { + default: + *x = *y = *z = 0.0; + ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); + break; + } + + #undef CASE + } + + void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache + repr->v_ripflag[idx] = to; + } + + + MRIS_MP::MRIS_MP ( ) {} + MRIS_MP::MRIS_MP ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + MRIS_MP::MRIS_MP ( MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( AllM::MRIS_MP const & src ) : Repr_Elt(src) {} + + + + Surface::Surface ( ) {} + Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} + Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; + } + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->underlyingMRIS->status; + } + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; + } + int Surface::patch() const { // if a patch of the surface + return repr->underlyingMRIS->patch; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->underlyingMRIS->noscale; + } + + void Surface::set_status(MRIS_Status to) { // type of surface (e.g. sphere, plane) + repr->underlyingMRIS->status = to; + } + void Surface::set_origxyz_status(MRIS_Status to) { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + repr->origxyz_status = to; + } + void Surface::set_patch(int to) { // if a patch of the surface + repr->underlyingMRIS->patch = to; + } + + + } // namespace ExistenceM + + + namespace TopologyM { + Face::Face ( ) {} + Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Face::Face ( Face const & src ) : Repr_Elt(src) {} + Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} + + Vertex Face::v(size_t i) const { + return Vertex(repr,repr->f_v[idx][i]); + } + char Face::ripflag() const { + return repr->f_ripflag[idx]; + } + + void Face::set_v(size_t i, Vertex to) { + cheapAssert(repr == to.repr); repr->f_v[idx][i] = to.idx; + } + void Face::set_ripflag(char to) { + repr->f_ripflag[idx] = to; + } + + + Vertex::Vertex ( ) {} + Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} + + char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache + return repr->v_ripflag[idx]; + } + void Vertex::which_coords(int which, float *x, float *y, float *z) const { + + #define CASE(WHICH, FIELD) \ + case WHICH: \ + *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ + break; + + switch (which) { + default: + *x = *y = *z = 0.0; + ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); + break; + } + + #undef CASE + } + + void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache + repr->v_ripflag[idx] = to; + } + + + MRIS_MP::MRIS_MP ( ) {} + MRIS_MP::MRIS_MP ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + MRIS_MP::MRIS_MP ( MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( AllM::MRIS_MP const & src ) : Repr_Elt(src) {} + + + + Surface::Surface ( ) {} + Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} + Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + + int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nvertices; + } + int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nfaces; + } + Vertex Surface::vertices(size_t i) const { + return Vertex(repr, i); + } + Face Surface::faces(size_t i) const { + return Face(repr, i); + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; + } + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->underlyingMRIS->status; + } + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; + } + int Surface::patch() const { // if a patch of the surface + return repr->underlyingMRIS->patch; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->underlyingMRIS->noscale; + } + + + } // namespace TopologyM + + + namespace XYZPositionM { + Face::Face ( ) {} + Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Face::Face ( Face const & src ) : Repr_Elt(src) {} + Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} + + Vertex Face::v(size_t i) const { + return Vertex(repr,repr->f_v[idx][i]); + } + char Face::ripflag() const { + return repr->f_ripflag[idx]; + } + + void Face::set_ripflag(char to) { + repr->f_ripflag[idx] = to; + } + + + Vertex::Vertex ( ) {} + Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} + + float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz + return repr->v_dist[idx][i]; + } + float Vertex::dist_orig(size_t i) const { // size() is vtotal. distance to neighboring vertices based on origxyz + return repr->v_dist_orig[idx][i]; + } + int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_capacity[idx]; + } + float Vertex::x() const { // current coordinates + return repr->v_x[idx]; + } + float Vertex::y() const { // use MRISsetXYZ() to set + return repr->v_y[idx]; + } + float Vertex::z() const { + return repr->v_z[idx]; + } + float Vertex::origx() const { // original coordinates, see also MRIS::origxyz_status + return repr->v_origx[idx]; + } + float Vertex::origy() const { // use MRISsetOriginalXYZ(, + return repr->v_origy[idx]; + } + float Vertex::origz() const { // or MRISsetOriginalXYZfromXYZ to set + return repr->v_origz[idx]; + } + float Vertex::cx() const { + return repr->v_cx[idx]; + } + float Vertex::cy() const { + return repr->v_cy[idx]; + } + float Vertex::cz() const { // coordinates in canonical coordinate system + return repr->v_cz[idx]; + } + char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache + return repr->v_ripflag[idx]; + } + void Vertex::which_coords(int which, float *x, float *y, float *z) const { + + #define CASE(WHICH, FIELD) \ + case WHICH: \ + *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ + break; + + switch (which) { + CASE(CURRENT_VERTICES,) + CASE(ORIGINAL_VERTICES,orig) + CASE(CANONICAL_VERTICES,c) + default: + *x = *y = *z = 0.0; + ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); + break; + } + + #undef CASE + } + + void Vertex::set_x(float to) { // current coordinates + repr->v_x[idx] = to; + } + void Vertex::set_y(float to) { // use MRISsetXYZ() to set + repr->v_y[idx] = to; + } + void Vertex::set_z(float to) { + repr->v_z[idx] = to; + } + void Vertex::set_cx(float to) { + repr->v_cx[idx] = to; + } + void Vertex::set_cy(float to) { + repr->v_cy[idx] = to; + } + void Vertex::set_cz(float to) { // coordinates in canonical coordinate system + repr->v_cz[idx] = to; + } + void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache + repr->v_ripflag[idx] = to; + } + + + MRIS_MP::MRIS_MP ( ) {} + MRIS_MP::MRIS_MP ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + MRIS_MP::MRIS_MP ( MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( AllM::MRIS_MP const & src ) : Repr_Elt(src) {} + + + + Surface::Surface ( ) {} + Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} + Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + + int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nvertices; + } + int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nfaces; + } + Vertex Surface::vertices(size_t i) const { + return Vertex(repr, i); + } + Face Surface::faces(size_t i) const { + return Face(repr, i); + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; + } + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->underlyingMRIS->status; + } + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; + } + int Surface::patch() const { // if a patch of the surface + return repr->underlyingMRIS->patch; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->underlyingMRIS->noscale; + } + + + } // namespace XYZPositionM + + + namespace XYZPositionConsequencesM { + Face::Face ( ) {} + Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Face::Face ( Face const & src ) : Repr_Elt(src) {} + Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} + + Vertex Face::v(size_t i) const { + return Vertex(repr,repr->f_v[idx][i]); + } + float Face::area() const { + return repr->f_area[idx]; + } + angles_per_triangle_t Face::angle() const { + return repr->f_angle[idx]; + } + angles_per_triangle_t Face::orig_angle() const { + return repr->f_orig_angle[idx]; + } + char Face::ripflag() const { + return repr->f_ripflag[idx]; + } + FloatXYZ Face::norm() const { + return repr->f_norm[idx]; + } + + void Face::set_area(float to) { + repr->f_area[idx] = to; + } + void Face::set_angle(angles_per_triangle_t to) { + repr->f_angle[idx] = to; + } + void Face::set_orig_angle(angles_per_triangle_t to) { + repr->f_orig_angle[idx] = to; + } + void Face::set_ripflag(char to) { + repr->f_ripflag[idx] = to; + } + void Face::set_norm(FloatXYZ to) { + repr->f_norm[idx] = to; + } + + + Vertex::Vertex ( ) {} + Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} + + float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz + return repr->v_dist[idx][i]; + } + float Vertex::dist_orig(size_t i) const { // size() is vtotal. distance to neighboring vertices based on origxyz + return repr->v_dist_orig[idx][i]; + } + int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_capacity[idx]; + } + float Vertex::x() const { // current coordinates + return repr->v_x[idx]; + } + float Vertex::y() const { // use MRISsetXYZ() to set + return repr->v_y[idx]; + } + float Vertex::z() const { + return repr->v_z[idx]; + } + float Vertex::origx() const { // original coordinates, see also MRIS::origxyz_status + return repr->v_origx[idx]; + } + float Vertex::origy() const { // use MRISsetOriginalXYZ(, + return repr->v_origy[idx]; + } + float Vertex::origz() const { // or MRISsetOriginalXYZfromXYZ to set + return repr->v_origz[idx]; + } + float Vertex::nx() const { + return repr->v_nx[idx]; + } + float Vertex::ny() const { + return repr->v_ny[idx]; + } + float Vertex::nz() const { // curr normal + return repr->v_nz[idx]; + } + float Vertex::cx() const { + return repr->v_cx[idx]; + } + float Vertex::cy() const { + return repr->v_cy[idx]; + } + float Vertex::cz() const { // coordinates in canonical coordinate system + return repr->v_cz[idx]; + } + float Vertex::area() const { + return repr->v_area[idx]; + } + char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache + return repr->v_ripflag[idx]; + } + void Vertex::which_coords(int which, float *x, float *y, float *z) const { + + #define CASE(WHICH, FIELD) \ + case WHICH: \ + *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ + break; + + switch (which) { + CASE(CURRENT_VERTICES,) + CASE(ORIGINAL_VERTICES,orig) + CASE(VERTEX_NORMALS,n) + CASE(CANONICAL_VERTICES,c) + default: + *x = *y = *z = 0.0; + ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); + break; + } + + #undef CASE + } + + void Vertex::set_nx(float to) { + repr->v_nx[idx] = to; + } + void Vertex::set_ny(float to) { + repr->v_ny[idx] = to; + } + void Vertex::set_nz(float to) { // curr normal + repr->v_nz[idx] = to; + } + void Vertex::set_cx(float to) { + repr->v_cx[idx] = to; + } + void Vertex::set_cy(float to) { + repr->v_cy[idx] = to; + } + void Vertex::set_cz(float to) { // coordinates in canonical coordinate system + repr->v_cz[idx] = to; + } + void Vertex::set_area(float to) { + repr->v_area[idx] = to; + } + void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache + repr->v_ripflag[idx] = to; + } + + + MRIS_MP::MRIS_MP ( ) {} + MRIS_MP::MRIS_MP ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + MRIS_MP::MRIS_MP ( MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( AllM::MRIS_MP const & src ) : Repr_Elt(src) {} + + + + Surface::Surface ( ) {} + Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} + Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + + int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nvertices; + } + int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nfaces; + } + Vertex Surface::vertices(size_t i) const { + return Vertex(repr, i); + } + Face Surface::faces(size_t i) const { + return Face(repr, i); + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + float Surface::xctr() const { + return repr->xctr; + } + float Surface::yctr() const { + return repr->yctr; + } + float Surface::zctr() const { + return repr->zctr; + } + float Surface::xlo() const { + return repr->xlo; + } + float Surface::ylo() const { + return repr->ylo; + } + float Surface::zlo() const { + return repr->zlo; + } + float Surface::xhi() const { + return repr->xhi; + } + float Surface::yhi() const { + return repr->yhi; + } + float Surface::zhi() const { + return repr->zhi; + } + float Surface::total_area() const { + return repr->total_area; + } + double Surface::avg_vertex_area() const { + return repr->avg_vertex_area; + } + double Surface::avg_vertex_dist() const { // set by MRIScomputeAvgInterVertexDist + return repr->avg_vertex_dist; + } + double Surface::std_vertex_dist() const { + return repr->std_vertex_dist; + } + float Surface::orig_area() const { + return repr->orig_area; + } + float Surface::neg_area() const { + return repr->neg_area; + } + float Surface::neg_orig_area() const { // amount of original surface in folds + return repr->neg_orig_area; + } + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; + } + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->underlyingMRIS->status; + } + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; + } + int Surface::patch() const { // if a patch of the surface + return repr->underlyingMRIS->patch; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->underlyingMRIS->noscale; + } + + void Surface::set_xctr(float to) { + repr->xctr = to; + } + void Surface::set_yctr(float to) { + repr->yctr = to; + } + void Surface::set_zctr(float to) { + repr->zctr = to; + } + void Surface::set_xlo(float to) { + repr->xlo = to; + } + void Surface::set_ylo(float to) { + repr->ylo = to; + } + void Surface::set_zlo(float to) { + repr->zlo = to; + } + void Surface::set_xhi(float to) { + repr->xhi = to; + } + void Surface::set_yhi(float to) { + repr->yhi = to; + } + void Surface::set_zhi(float to) { + repr->zhi = to; + } + void Surface::set_total_area(float to) { + repr->total_area = to; + } + void Surface::set_avg_vertex_area(double to) { + repr->avg_vertex_area = to; + } + void Surface::set_avg_vertex_dist(double to) { // set by MRIScomputeAvgInterVertexDist + repr->avg_vertex_dist = to; + } + void Surface::set_std_vertex_dist(double to) { + repr->std_vertex_dist = to; + } + void Surface::set_orig_area(float to) { + repr->orig_area = to; + } + void Surface::set_neg_area(float to) { + repr->neg_area = to; + } + void Surface::set_neg_orig_area(float to) { // amount of original surface in folds + repr->neg_orig_area = to; + } + + + } // namespace XYZPositionConsequencesM + + + namespace DistortM { + Face::Face ( ) {} + Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Face::Face ( Face const & src ) : Repr_Elt(src) {} + Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} + + Vertex Face::v(size_t i) const { + return Vertex(repr,repr->f_v[idx][i]); + } + float Face::area() const { + return repr->f_area[idx]; + } + angles_per_triangle_t Face::angle() const { + return repr->f_angle[idx]; + } + angles_per_triangle_t Face::orig_angle() const { + return repr->f_orig_angle[idx]; + } + char Face::ripflag() const { + return repr->f_ripflag[idx]; + } + FloatXYZ Face::norm() const { + return repr->f_norm[idx]; + } + + void Face::set_orig_angle(angles_per_triangle_t to) { + repr->f_orig_angle[idx] = to; + } + void Face::set_ripflag(char to) { + repr->f_ripflag[idx] = to; + } + + + Vertex::Vertex ( ) {} + Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} + + float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz + return repr->v_dist[idx][i]; + } + float Vertex::dist_orig(size_t i) const { // size() is vtotal. distance to neighboring vertices based on origxyz + return repr->v_dist_orig[idx][i]; + } + int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_capacity[idx]; + } + float Vertex::x() const { // current coordinates + return repr->v_x[idx]; + } + float Vertex::y() const { // use MRISsetXYZ() to set + return repr->v_y[idx]; + } + float Vertex::z() const { + return repr->v_z[idx]; + } + float Vertex::origx() const { // original coordinates, see also MRIS::origxyz_status + return repr->v_origx[idx]; + } + float Vertex::origy() const { // use MRISsetOriginalXYZ(, + return repr->v_origy[idx]; + } + float Vertex::origz() const { // or MRISsetOriginalXYZfromXYZ to set + return repr->v_origz[idx]; + } + float Vertex::nx() const { + return repr->v_nx[idx]; + } + float Vertex::ny() const { + return repr->v_ny[idx]; + } + float Vertex::nz() const { // curr normal + return repr->v_nz[idx]; + } + float Vertex::wnx() const { + return repr->v_wnx[idx]; + } + float Vertex::wny() const { + return repr->v_wny[idx]; + } + float Vertex::wnz() const { // white normal + return repr->v_wnz[idx]; + } + float Vertex::dx() const { + return repr->v_dx[idx]; + } + float Vertex::dy() const { + return repr->v_dy[idx]; + } + float Vertex::dz() const { // current change in position + return repr->v_dz[idx]; + } + float Vertex::curv() const { // curr curvature + return repr->v_curv[idx]; + } + float Vertex::cx() const { + return repr->v_cx[idx]; + } + float Vertex::cy() const { + return repr->v_cy[idx]; + } + float Vertex::cz() const { // coordinates in canonical coordinate system + return repr->v_cz[idx]; + } + float Vertex::pialx() const { + return repr->v_pialx[idx]; + } + float Vertex::pialy() const { + return repr->v_pialy[idx]; + } + float Vertex::pialz() const { // pial surface coordinates + return repr->v_pialz[idx]; + } + float Vertex::whitex() const { + return repr->v_whitex[idx]; + } + float Vertex::whitey() const { + return repr->v_whitey[idx]; + } + float Vertex::whitez() const { // white surface coordinates + return repr->v_whitez[idx]; + } + float Vertex::area() const { + return repr->v_area[idx]; + } + float Vertex::origarea() const { + return repr->v_origarea[idx]; + } + int Vertex::fno() const { // face that this vertex is in + return repr->v_fno[idx]; + } + char Vertex::neg() const { // 1 if the normal vector is inverted + return repr->v_neg[idx]; + } + char Vertex::border() const { // flag + return repr->v_border[idx]; + } + char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache + return repr->v_ripflag[idx]; + } + void Vertex::which_coords(int which, float *x, float *y, float *z) const { + + #define CASE(WHICH, FIELD) \ + case WHICH: \ + *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ + break; + + switch (which) { + CASE(CURRENT_VERTICES,) + CASE(ORIGINAL_VERTICES,orig) + CASE(VERTEX_NORMALS,n) + CASE(WHITE_NORMALS,wn) + CASE(CANONICAL_VERTICES,c) + CASE(PIAL_VERTICES,pial) + CASE(WHITE_VERTICES,white) + default: + *x = *y = *z = 0.0; + ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); + break; + } + + #undef CASE + } + + void Vertex::set_nx(float to) { + repr->v_nx[idx] = to; + } + void Vertex::set_ny(float to) { + repr->v_ny[idx] = to; + } + void Vertex::set_nz(float to) { // curr normal + repr->v_nz[idx] = to; + } + void Vertex::set_wnx(float to) { + repr->v_wnx[idx] = to; + } + void Vertex::set_wny(float to) { + repr->v_wny[idx] = to; + } + void Vertex::set_wnz(float to) { // white normal + repr->v_wnz[idx] = to; + } + void Vertex::set_dx(float to) { + repr->v_dx[idx] = to; + } + void Vertex::set_dy(float to) { + repr->v_dy[idx] = to; + } + void Vertex::set_dz(float to) { // current change in position + repr->v_dz[idx] = to; + } + void Vertex::set_curv(float to) { // curr curvature + repr->v_curv[idx] = to; + } + void Vertex::set_cx(float to) { + repr->v_cx[idx] = to; + } + void Vertex::set_cy(float to) { + repr->v_cy[idx] = to; + } + void Vertex::set_cz(float to) { // coordinates in canonical coordinate system + repr->v_cz[idx] = to; + } + void Vertex::set_pialx(float to) { + repr->v_pialx[idx] = to; + } + void Vertex::set_pialy(float to) { + repr->v_pialy[idx] = to; + } + void Vertex::set_pialz(float to) { // pial surface coordinates + repr->v_pialz[idx] = to; + } + void Vertex::set_whitex(float to) { + repr->v_whitex[idx] = to; + } + void Vertex::set_whitey(float to) { + repr->v_whitey[idx] = to; + } + void Vertex::set_whitez(float to) { // white surface coordinates + repr->v_whitez[idx] = to; + } + void Vertex::set_origarea(float to) { + repr->v_origarea[idx] = to; + } + void Vertex::set_fno(int to) { // face that this vertex is in + repr->v_fno[idx] = to; + } + void Vertex::set_neg(char to) { // 1 if the normal vector is inverted + repr->v_neg[idx] = to; + } + void Vertex::set_border(char to) { // flag + repr->v_border[idx] = to; + } + void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache + repr->v_ripflag[idx] = to; + } + + + MRIS_MP::MRIS_MP ( ) {} + MRIS_MP::MRIS_MP ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + MRIS_MP::MRIS_MP ( MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( AllM::MRIS_MP const & src ) : Repr_Elt(src) {} + + + + Surface::Surface ( ) {} + Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} + Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + + int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nvertices; + } + int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nfaces; + } + Vertex Surface::vertices(size_t i) const { + return Vertex(repr, i); + } + Face Surface::faces(size_t i) const { + return Face(repr, i); + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + float Surface::xctr() const { + return repr->xctr; + } + float Surface::yctr() const { + return repr->yctr; + } + float Surface::zctr() const { + return repr->zctr; + } + float Surface::xlo() const { + return repr->xlo; + } + float Surface::ylo() const { + return repr->ylo; + } + float Surface::zlo() const { + return repr->zlo; + } + float Surface::xhi() const { + return repr->xhi; + } + float Surface::yhi() const { + return repr->yhi; + } + float Surface::zhi() const { + return repr->zhi; + } + float Surface::total_area() const { + return repr->total_area; + } + double Surface::avg_vertex_area() const { + return repr->avg_vertex_area; + } + double Surface::avg_vertex_dist() const { // set by MRIScomputeAvgInterVertexDist + return repr->avg_vertex_dist; + } + double Surface::std_vertex_dist() const { + return repr->std_vertex_dist; + } + float Surface::orig_area() const { + return repr->orig_area; + } + float Surface::neg_area() const { + return repr->neg_area; + } + float Surface::neg_orig_area() const { // amount of original surface in folds + return repr->neg_orig_area; + } + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; + } + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->underlyingMRIS->status; + } + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; + } + int Surface::patch() const { // if a patch of the surface + return repr->underlyingMRIS->patch; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->underlyingMRIS->noscale; + } + + void Surface::set_xctr(float to) { + repr->xctr = to; + } + void Surface::set_yctr(float to) { + repr->yctr = to; + } + void Surface::set_zctr(float to) { + repr->zctr = to; + } + void Surface::set_xlo(float to) { + repr->xlo = to; + } + void Surface::set_ylo(float to) { + repr->ylo = to; + } + void Surface::set_zlo(float to) { + repr->zlo = to; + } + void Surface::set_xhi(float to) { + repr->xhi = to; + } + void Surface::set_yhi(float to) { + repr->yhi = to; + } + void Surface::set_zhi(float to) { + repr->zhi = to; + } + void Surface::set_total_area(float to) { + repr->total_area = to; + } + void Surface::set_avg_vertex_area(double to) { + repr->avg_vertex_area = to; + } + + + } // namespace DistortM + + + namespace AnalysisM { + Face::Face ( ) {} + Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Face::Face ( Face const & src ) : Repr_Elt(src) {} + Face::Face ( AllM::Face const & src ) : Repr_Elt(src) {} + + Vertex Face::v(size_t i) const { + return Vertex(repr,repr->f_v[idx][i]); + } + float Face::area() const { + return repr->f_area[idx]; + } + angles_per_triangle_t Face::angle() const { + return repr->f_angle[idx]; + } + angles_per_triangle_t Face::orig_angle() const { + return repr->f_orig_angle[idx]; + } + char Face::ripflag() const { + return repr->f_ripflag[idx]; + } + FloatXYZ Face::norm() const { + return repr->f_norm[idx]; + } + + void Face::set_orig_angle(angles_per_triangle_t to) { + repr->f_orig_angle[idx] = to; + } + void Face::set_ripflag(char to) { + repr->f_ripflag[idx] = to; + } + + + Vertex::Vertex ( ) {} + Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} + Vertex::Vertex ( AllM::Vertex const & src ) : Repr_Elt(src) {} + + float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz + return repr->v_dist[idx][i]; + } + float Vertex::dist_orig(size_t i) const { // size() is vtotal. distance to neighboring vertices based on origxyz + return repr->v_dist_orig[idx][i]; + } + int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_capacity[idx]; + } + float Vertex::x() const { // current coordinates + return repr->v_x[idx]; + } + float Vertex::y() const { // use MRISsetXYZ() to set + return repr->v_y[idx]; + } + float Vertex::z() const { + return repr->v_z[idx]; + } + float Vertex::origx() const { // original coordinates, see also MRIS::origxyz_status + return repr->v_origx[idx]; + } + float Vertex::origy() const { // use MRISsetOriginalXYZ(, + return repr->v_origy[idx]; + } + float Vertex::origz() const { // or MRISsetOriginalXYZfromXYZ to set + return repr->v_origz[idx]; + } + float Vertex::nx() const { + return repr->v_nx[idx]; + } + float Vertex::ny() const { + return repr->v_ny[idx]; + } + float Vertex::nz() const { // curr normal + return repr->v_nz[idx]; + } + float Vertex::wnx() const { + return repr->v_wnx[idx]; + } + float Vertex::wny() const { + return repr->v_wny[idx]; + } + float Vertex::wnz() const { // white normal + return repr->v_wnz[idx]; + } + float Vertex::dx() const { + return repr->v_dx[idx]; + } + float Vertex::dy() const { + return repr->v_dy[idx]; + } + float Vertex::dz() const { // current change in position + return repr->v_dz[idx]; + } + float Vertex::curv() const { // curr curvature + return repr->v_curv[idx]; + } + float Vertex::cx() const { + return repr->v_cx[idx]; + } + float Vertex::cy() const { + return repr->v_cy[idx]; + } + float Vertex::cz() const { // coordinates in canonical coordinate system + return repr->v_cz[idx]; + } + float Vertex::pialx() const { + return repr->v_pialx[idx]; + } + float Vertex::pialy() const { + return repr->v_pialy[idx]; + } + float Vertex::pialz() const { // pial surface coordinates + return repr->v_pialz[idx]; + } + float Vertex::whitex() const { + return repr->v_whitex[idx]; + } + float Vertex::whitey() const { + return repr->v_whitey[idx]; + } + float Vertex::whitez() const { // white surface coordinates + return repr->v_whitez[idx]; + } + float Vertex::area() const { + return repr->v_area[idx]; + } + float Vertex::origarea() const { + return repr->v_origarea[idx]; + } + int Vertex::fno() const { // face that this vertex is in + return repr->v_fno[idx]; + } + char Vertex::neg() const { // 1 if the normal vector is inverted + return repr->v_neg[idx]; + } + char Vertex::border() const { // flag + return repr->v_border[idx]; + } + char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache + return repr->v_ripflag[idx]; + } + void Vertex::which_coords(int which, float *x, float *y, float *z) const { + + #define CASE(WHICH, FIELD) \ + case WHICH: \ + *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ + break; + + switch (which) { + CASE(CURRENT_VERTICES,) + CASE(ORIGINAL_VERTICES,orig) + CASE(VERTEX_NORMALS,n) + CASE(WHITE_NORMALS,wn) + CASE(CANONICAL_VERTICES,c) + CASE(PIAL_VERTICES,pial) + CASE(WHITE_VERTICES,white) + default: + *x = *y = *z = 0.0; + ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); + break; + } + + #undef CASE + } + + void Vertex::set_nx(float to) { + repr->v_nx[idx] = to; + } + void Vertex::set_ny(float to) { + repr->v_ny[idx] = to; + } + void Vertex::set_nz(float to) { // curr normal + repr->v_nz[idx] = to; + } + void Vertex::set_wnx(float to) { + repr->v_wnx[idx] = to; + } + void Vertex::set_wny(float to) { + repr->v_wny[idx] = to; + } + void Vertex::set_wnz(float to) { // white normal + repr->v_wnz[idx] = to; + } + void Vertex::set_dx(float to) { + repr->v_dx[idx] = to; + } + void Vertex::set_dy(float to) { + repr->v_dy[idx] = to; + } + void Vertex::set_dz(float to) { // current change in position + repr->v_dz[idx] = to; + } + void Vertex::set_curv(float to) { // curr curvature + repr->v_curv[idx] = to; + } + void Vertex::set_cx(float to) { + repr->v_cx[idx] = to; + } + void Vertex::set_cy(float to) { + repr->v_cy[idx] = to; + } + void Vertex::set_cz(float to) { // coordinates in canonical coordinate system + repr->v_cz[idx] = to; + } + void Vertex::set_pialx(float to) { + repr->v_pialx[idx] = to; + } + void Vertex::set_pialy(float to) { + repr->v_pialy[idx] = to; + } + void Vertex::set_pialz(float to) { // pial surface coordinates + repr->v_pialz[idx] = to; + } + void Vertex::set_whitex(float to) { + repr->v_whitex[idx] = to; + } + void Vertex::set_whitey(float to) { + repr->v_whitey[idx] = to; + } + void Vertex::set_whitez(float to) { // white surface coordinates + repr->v_whitez[idx] = to; + } + void Vertex::set_origarea(float to) { + repr->v_origarea[idx] = to; + } + void Vertex::set_fno(int to) { // face that this vertex is in + repr->v_fno[idx] = to; + } + void Vertex::set_neg(char to) { // 1 if the normal vector is inverted + repr->v_neg[idx] = to; + } + void Vertex::set_border(char to) { // flag + repr->v_border[idx] = to; + } + void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache + repr->v_ripflag[idx] = to; + } + + + MRIS_MP::MRIS_MP ( ) {} + MRIS_MP::MRIS_MP ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + MRIS_MP::MRIS_MP ( MRIS_MP const & src ) : Repr_Elt(src) {} + MRIS_MP::MRIS_MP ( AllM::MRIS_MP const & src ) : Repr_Elt(src) {} + + + + Surface::Surface ( ) {} + Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} + Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + Surface::Surface ( AllM::Surface const & src ) : Repr_Elt(src) {} + + int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nvertices; + } + int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nfaces; + } + Vertex Surface::vertices(size_t i) const { + return Vertex(repr, i); + } + Face Surface::faces(size_t i) const { + return Face(repr, i); + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + float Surface::xctr() const { + return repr->xctr; + } + float Surface::yctr() const { + return repr->yctr; + } + float Surface::zctr() const { + return repr->zctr; + } + float Surface::xlo() const { + return repr->xlo; + } + float Surface::ylo() const { + return repr->ylo; + } + float Surface::zlo() const { + return repr->zlo; + } + float Surface::xhi() const { + return repr->xhi; + } + float Surface::yhi() const { + return repr->yhi; + } + float Surface::zhi() const { + return repr->zhi; + } + float Surface::total_area() const { + return repr->total_area; + } + double Surface::avg_vertex_area() const { + return repr->avg_vertex_area; + } + double Surface::avg_vertex_dist() const { // set by MRIScomputeAvgInterVertexDist + return repr->avg_vertex_dist; + } + double Surface::std_vertex_dist() const { + return repr->std_vertex_dist; + } + float Surface::orig_area() const { + return repr->orig_area; + } + float Surface::neg_area() const { + return repr->neg_area; + } + float Surface::neg_orig_area() const { // amount of original surface in folds + return repr->neg_orig_area; + } + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; + } + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->underlyingMRIS->status; + } + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; + } + int Surface::patch() const { // if a patch of the surface + return repr->underlyingMRIS->patch; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->underlyingMRIS->noscale; + } + + void Surface::set_xctr(float to) { + repr->xctr = to; + } + void Surface::set_yctr(float to) { + repr->yctr = to; + } + void Surface::set_zctr(float to) { + repr->zctr = to; + } + void Surface::set_xlo(float to) { + repr->xlo = to; + } + void Surface::set_ylo(float to) { + repr->ylo = to; + } + void Surface::set_zlo(float to) { + repr->zlo = to; + } + void Surface::set_xhi(float to) { + repr->xhi = to; + } + void Surface::set_yhi(float to) { + repr->yhi = to; + } + void Surface::set_zhi(float to) { + repr->zhi = to; + } + void Surface::set_total_area(float to) { + repr->total_area = to; + } + void Surface::set_avg_vertex_area(double to) { + repr->avg_vertex_area = to; + } + + + } // namespace AnalysisM + + + namespace AllM { + Face::Face ( ) {} + Face::Face ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Face::Face ( Face const & src ) : Repr_Elt(src) {} + + Vertex Face::v(size_t i) const { + return Vertex(repr,repr->f_v[idx][i]); + } + float Face::area() const { + return repr->f_area[idx]; + } + angles_per_triangle_t Face::angle() const { + return repr->f_angle[idx]; + } + angles_per_triangle_t Face::orig_angle() const { + return repr->f_orig_angle[idx]; + } + char Face::ripflag() const { + return repr->f_ripflag[idx]; + } + FloatXYZ Face::norm() const { + return repr->f_norm[idx]; + } + + void Face::set_v(size_t i, Vertex to) { + cheapAssert(repr == to.repr); repr->f_v[idx][i] = to.idx; + } + void Face::set_area(float to) { + repr->f_area[idx] = to; + } + void Face::set_angle(angles_per_triangle_t to) { + repr->f_angle[idx] = to; + } + void Face::set_orig_angle(angles_per_triangle_t to) { + repr->f_orig_angle[idx] = to; + } + void Face::set_ripflag(char to) { + repr->f_ripflag[idx] = to; + } + void Face::set_norm(FloatXYZ to) { + repr->f_norm[idx] = to; + } + + + Vertex::Vertex ( ) {} + Vertex::Vertex ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + Vertex::Vertex ( Vertex const & src ) : Repr_Elt(src) {} + + float Vertex::dist(size_t i) const { // size() is vtotal. distance to neighboring vertices based on xyz + return repr->v_dist[idx][i]; + } + float Vertex::dist_orig(size_t i) const { // size() is vtotal. distance to neighboring vertices based on origxyz + return repr->v_dist_orig[idx][i]; + } + int Vertex::dist_capacity() const { // -- should contain at least vtx_vtotal elements + return repr->v_dist_capacity[idx]; + } + float Vertex::x() const { // current coordinates + return repr->v_x[idx]; + } + float Vertex::y() const { // use MRISsetXYZ() to set + return repr->v_y[idx]; + } + float Vertex::z() const { + return repr->v_z[idx]; + } + float Vertex::origx() const { // original coordinates, see also MRIS::origxyz_status + return repr->v_origx[idx]; + } + float Vertex::origy() const { // use MRISsetOriginalXYZ(, + return repr->v_origy[idx]; + } + float Vertex::origz() const { // or MRISsetOriginalXYZfromXYZ to set + return repr->v_origz[idx]; + } + float Vertex::nx() const { + return repr->v_nx[idx]; + } + float Vertex::ny() const { + return repr->v_ny[idx]; + } + float Vertex::nz() const { // curr normal + return repr->v_nz[idx]; + } + float Vertex::wnx() const { + return repr->v_wnx[idx]; + } + float Vertex::wny() const { + return repr->v_wny[idx]; + } + float Vertex::wnz() const { // white normal + return repr->v_wnz[idx]; + } + float Vertex::dx() const { + return repr->v_dx[idx]; + } + float Vertex::dy() const { + return repr->v_dy[idx]; + } + float Vertex::dz() const { // current change in position + return repr->v_dz[idx]; + } + float Vertex::curv() const { // curr curvature + return repr->v_curv[idx]; + } + float Vertex::cx() const { + return repr->v_cx[idx]; + } + float Vertex::cy() const { + return repr->v_cy[idx]; + } + float Vertex::cz() const { // coordinates in canonical coordinate system + return repr->v_cz[idx]; + } + float Vertex::pialx() const { + return repr->v_pialx[idx]; + } + float Vertex::pialy() const { + return repr->v_pialy[idx]; + } + float Vertex::pialz() const { // pial surface coordinates + return repr->v_pialz[idx]; + } + float Vertex::whitex() const { + return repr->v_whitex[idx]; + } + float Vertex::whitey() const { + return repr->v_whitey[idx]; + } + float Vertex::whitez() const { // white surface coordinates + return repr->v_whitez[idx]; + } + float Vertex::area() const { + return repr->v_area[idx]; + } + float Vertex::origarea() const { + return repr->v_origarea[idx]; + } + int Vertex::fno() const { // face that this vertex is in + return repr->v_fno[idx]; + } + char Vertex::neg() const { // 1 if the normal vector is inverted + return repr->v_neg[idx]; + } + char Vertex::border() const { // flag + return repr->v_border[idx]; + } + char Vertex::ripflag() const { // vertex no longer exists - placed last to load the next vertex into cache + return repr->v_ripflag[idx]; + } + void Vertex::which_coords(int which, float *x, float *y, float *z) const { + + #define CASE(WHICH, FIELD) \ + case WHICH: \ + *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \ + break; + + switch (which) { + CASE(CURRENT_VERTICES,) + CASE(ORIGINAL_VERTICES,orig) + CASE(VERTEX_NORMALS,n) + CASE(WHITE_NORMALS,wn) + CASE(CANONICAL_VERTICES,c) + CASE(PIAL_VERTICES,pial) + CASE(WHITE_VERTICES,white) + default: + *x = *y = *z = 0.0; + ErrorExit(ERROR_UNSUPPORTED, "which_coords: unsupported which %d", which); + break; + } + + #undef CASE + } + + void Vertex::set_x(float to) { // current coordinates + repr->v_x[idx] = to; + } + void Vertex::set_y(float to) { // use MRISsetXYZ() to set + repr->v_y[idx] = to; + } + void Vertex::set_z(float to) { + repr->v_z[idx] = to; + } + void Vertex::set_nx(float to) { + repr->v_nx[idx] = to; + } + void Vertex::set_ny(float to) { + repr->v_ny[idx] = to; + } + void Vertex::set_nz(float to) { // curr normal + repr->v_nz[idx] = to; + } + void Vertex::set_wnx(float to) { + repr->v_wnx[idx] = to; + } + void Vertex::set_wny(float to) { + repr->v_wny[idx] = to; + } + void Vertex::set_wnz(float to) { // white normal + repr->v_wnz[idx] = to; + } + void Vertex::set_dx(float to) { + repr->v_dx[idx] = to; + } + void Vertex::set_dy(float to) { + repr->v_dy[idx] = to; + } + void Vertex::set_dz(float to) { // current change in position + repr->v_dz[idx] = to; + } + void Vertex::set_curv(float to) { // curr curvature + repr->v_curv[idx] = to; + } + void Vertex::set_cx(float to) { + repr->v_cx[idx] = to; + } + void Vertex::set_cy(float to) { + repr->v_cy[idx] = to; + } + void Vertex::set_cz(float to) { // coordinates in canonical coordinate system + repr->v_cz[idx] = to; + } + void Vertex::set_pialx(float to) { + repr->v_pialx[idx] = to; + } + void Vertex::set_pialy(float to) { + repr->v_pialy[idx] = to; + } + void Vertex::set_pialz(float to) { // pial surface coordinates + repr->v_pialz[idx] = to; + } + void Vertex::set_whitex(float to) { + repr->v_whitex[idx] = to; + } + void Vertex::set_whitey(float to) { + repr->v_whitey[idx] = to; + } + void Vertex::set_whitez(float to) { // white surface coordinates + repr->v_whitez[idx] = to; + } + void Vertex::set_area(float to) { + repr->v_area[idx] = to; + } + void Vertex::set_origarea(float to) { + repr->v_origarea[idx] = to; + } + void Vertex::set_fno(int to) { // face that this vertex is in + repr->v_fno[idx] = to; + } + void Vertex::set_neg(char to) { // 1 if the normal vector is inverted + repr->v_neg[idx] = to; + } + void Vertex::set_border(char to) { // flag + repr->v_border[idx] = to; + } + void Vertex::set_ripflag(char to) { // vertex no longer exists - placed last to load the next vertex into cache + repr->v_ripflag[idx] = to; + } + + + MRIS_MP::MRIS_MP ( ) {} + MRIS_MP::MRIS_MP ( Representation* representation, size_t idx ) : Repr_Elt(representation,idx) {} + MRIS_MP::MRIS_MP ( MRIS_MP const & src ) : Repr_Elt(src) {} + + + + Surface::Surface ( ) {} + Surface::Surface ( Representation* representation ) : Repr_Elt(representation,0) {} + Surface::Surface ( Surface const & src ) : Repr_Elt(src) {} + + int Surface::nvertices() const { // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nvertices; + } + int Surface::nfaces() const { // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + return repr->nfaces; + } + Vertex Surface::vertices(size_t i) const { + return Vertex(repr, i); + } + Face Surface::faces(size_t i) const { + return Face(repr, i); + } + FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { + return repr->faceNormCacheEntries[i]; + } + FaceNormDeferredEntry Surface::faceNormDeferredEntries(size_t i) const { + return repr->faceNormDeferredEntries[i]; + } + float Surface::xctr() const { + return repr->xctr; + } + float Surface::yctr() const { + return repr->yctr; + } + float Surface::zctr() const { + return repr->zctr; + } + float Surface::xlo() const { + return repr->xlo; + } + float Surface::ylo() const { + return repr->ylo; + } + float Surface::zlo() const { + return repr->zlo; + } + float Surface::xhi() const { + return repr->xhi; + } + float Surface::yhi() const { + return repr->yhi; + } + float Surface::zhi() const { + return repr->zhi; + } + float Surface::total_area() const { + return repr->total_area; + } + double Surface::avg_vertex_area() const { + return repr->avg_vertex_area; + } + double Surface::avg_vertex_dist() const { // set by MRIScomputeAvgInterVertexDist + return repr->avg_vertex_dist; + } + double Surface::std_vertex_dist() const { + return repr->std_vertex_dist; + } + float Surface::orig_area() const { + return repr->orig_area; + } + float Surface::neg_area() const { + return repr->neg_area; + } + float Surface::neg_orig_area() const { // amount of original surface in folds + return repr->neg_orig_area; + } + double Surface::radius() const { // radius (if status==MRIS_SPHERE) + return repr->radius; + } + MRIS_Status Surface::status() const { // type of surface (e.g. sphere, plane) + return repr->underlyingMRIS->status; + } + MRIS_Status Surface::origxyz_status() const { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + return repr->origxyz_status; + } + int Surface::patch() const { // if a patch of the surface + return repr->underlyingMRIS->patch; + } + int Surface::noscale() const { // don't scale by surface area if true + return repr->underlyingMRIS->noscale; + } + + void Surface::set_xctr(float to) { + repr->xctr = to; + } + void Surface::set_yctr(float to) { + repr->yctr = to; + } + void Surface::set_zctr(float to) { + repr->zctr = to; + } + void Surface::set_xlo(float to) { + repr->xlo = to; + } + void Surface::set_ylo(float to) { + repr->ylo = to; + } + void Surface::set_zlo(float to) { + repr->zlo = to; + } + void Surface::set_xhi(float to) { + repr->xhi = to; + } + void Surface::set_yhi(float to) { + repr->yhi = to; + } + void Surface::set_zhi(float to) { + repr->zhi = to; + } + void Surface::set_total_area(float to) { + repr->total_area = to; + } + void Surface::set_avg_vertex_area(double to) { + repr->avg_vertex_area = to; + } + void Surface::set_avg_vertex_dist(double to) { // set by MRIScomputeAvgInterVertexDist + repr->avg_vertex_dist = to; + } + void Surface::set_std_vertex_dist(double to) { + repr->std_vertex_dist = to; + } + void Surface::set_orig_area(float to) { + repr->orig_area = to; + } + void Surface::set_neg_area(float to) { + repr->neg_area = to; + } + void Surface::set_neg_orig_area(float to) { // amount of original surface in folds + repr->neg_orig_area = to; + } + void Surface::set_status(MRIS_Status to) { // type of surface (e.g. sphere, plane) + repr->underlyingMRIS->status = to; + } + void Surface::set_origxyz_status(MRIS_Status to) { // type of surface (e.g. sphere, plane) that this origxyz were obtained from + repr->origxyz_status = to; + } + void Surface::set_patch(int to) { // if a patch of the surface + repr->underlyingMRIS->patch = to; + } + + + } // namespace AllM +} // SurfaceFromMRIS_MP diff --git a/include/mrisurf_SurfaceFromMRIS_generated.h b/include/mrisurf_SurfaceFromMRIS_generated.h index 1e7862296c8..c96684d9413 100644 --- a/include/mrisurf_SurfaceFromMRIS_generated.h +++ b/include/mrisurf_SurfaceFromMRIS_generated.h @@ -1,9 +1,11 @@ #pragma once #include "./mrisurf_SurfaceFromMRIS_generated_prefix.h" +#pragma once // GENERATED SOURCE - DO NOT DIRECTLY EDIT // // ======================================= +#include "mrisurf_aaa.h" namespace SurfaceFromMRIS { typedef MRIS Representation; #include "mrisurf_SurfaceFromMRIS_generated_Existence.h" diff --git a/include/mrisurf_SurfaceFromMRIS_generated_AllM.h b/include/mrisurf_SurfaceFromMRIS_generated_AllM.h index 07546284f06..7f28191939f 100644 --- a/include/mrisurf_SurfaceFromMRIS_generated_AllM.h +++ b/include/mrisurf_SurfaceFromMRIS_generated_AllM.h @@ -1,32 +1,36 @@ namespace AllM { struct Face : public Repr_Elt { + typedef AllM::Surface Surface; + typedef AllM::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline float area ( ) const ; - inline angles_per_triangle_t angle ( ) const ; - inline angles_per_triangle_t orig_angle ( ) const ; - inline char ripflag ( ) const ; - inline char oripflag ( ) const ; - inline int marked ( ) const ; - inline PDMATRIX norm ( ) const ; - inline A3PDMATRIX gradNorm ( ) const ; + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; + inline PDMATRIX norm ( ) const ; + inline A3PDMATRIX gradNorm ( ) const ; - inline void set_v ( size_t i, Vertex to ) ; - inline void set_area ( float to ) ; - inline void set_angle ( angles_per_triangle_t to ) ; - inline void set_orig_angle ( angles_per_triangle_t to ) ; - inline void set_ripflag ( char to ) ; - inline void set_oripflag ( char to ) ; - inline void set_marked ( int to ) ; - inline void set_norm ( PDMATRIX to ) ; - inline void set_gradNorm ( A3PDMATRIX to ) ; - }; + inline void set_v ( size_t i, Vertex to ) ; + inline void set_area ( float to ) ; + inline void set_angle ( angles_per_triangle_t to ) ; + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + inline void set_norm ( PDMATRIX to ) ; + inline void set_gradNorm ( A3PDMATRIX to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef AllM::Surface Surface; + typedef AllM::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -34,416 +38,424 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline int e ( size_t i ) const ; // edge state for neighboring vertices - inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops - inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i, - inline short v2num ( ) const ; // number of 1, or 2-hop neighbors - inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors - inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur - inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num - inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc - inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal - inline uchar num ( ) const ; // number of neighboring faces + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces // managed by MRISfreeDists[_orig] and MRISmakeDists[_orig] - inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz - inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz - inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements - inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements // - inline float x ( ) const ; // current coordinates - inline float y ( ) const ; // use MRISsetXYZ() to set - inline float z ( ) const ; + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; // - inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status - inline float origy ( ) const ; // use MRISsetOriginalXYZ(, - inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set // - inline float nx ( ) const ; - inline float ny ( ) const ; - inline float nz ( ) const ; // curr normal - inline float pnx ( ) const ; - inline float pny ( ) const ; - inline float pnz ( ) const ; // pial normal + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float pnx ( ) const ; + inline float pny ( ) const ; + inline float pnz ( ) const ; // pial normal // - inline float wnx ( ) const ; - inline float wny ( ) const ; - inline float wnz ( ) const ; // white normal - inline float onx ( ) const ; - inline float ony ( ) const ; - inline float onz ( ) const ; // original normal - inline float dx ( ) const ; - inline float dy ( ) const ; - inline float dz ( ) const ; // current change in position - inline float odx ( ) const ; - inline float ody ( ) const ; - inline float odz ( ) const ; // last change of position (for momentum, - inline float tdx ( ) const ; - inline float tdy ( ) const ; - inline float tdz ( ) const ; // temporary storage for averaging gradient - inline float curv ( ) const ; // curr curvature - inline float curvbak ( ) const ; - inline float val ( ) const ; // scalar data value (file: rh.val, sig2-rh.w) - inline float imag_val ( ) const ; // imaginary part of complex data value - inline float cx ( ) const ; - inline float cy ( ) const ; - inline float cz ( ) const ; // coordinates in canonical coordinate system - inline float tx ( ) const ; - inline float ty ( ) const ; - inline float tz ( ) const ; // tmp coordinate storage - inline float t2x ( ) const ; - inline float t2y ( ) const ; - inline float t2z ( ) const ; // another tmp coordinate storage - inline float targx ( ) const ; - inline float targy ( ) const ; - inline float targz ( ) const ; // target coordinates - inline float pialx ( ) const ; - inline float pialy ( ) const ; - inline float pialz ( ) const ; // pial surface coordinates - inline float whitex ( ) const ; - inline float whitey ( ) const ; - inline float whitez ( ) const ; // white surface coordinates - inline float l4x ( ) const ; - inline float l4y ( ) const ; - inline float l4z ( ) const ; // layerIV surface coordinates - inline float infx ( ) const ; - inline float infy ( ) const ; - inline float infz ( ) const ; // inflated coordinates - inline float fx ( ) const ; - inline float fy ( ) const ; - inline float fz ( ) const ; // flattened coordinates - inline int px ( ) const ; - inline int qx ( ) const ; - inline int py ( ) const ; - inline int qy ( ) const ; - inline int pz ( ) const ; - inline int qz ( ) const ; // rational coordinates for exact calculations - inline float e1x ( ) const ; - inline float e1y ( ) const ; - inline float e1z ( ) const ; // 1st basis vector for the local tangent plane - inline float e2x ( ) const ; - inline float e2y ( ) const ; - inline float e2z ( ) const ; // 2nd basis vector for the local tangent plane - inline float pe1x ( ) const ; - inline float pe1y ( ) const ; - inline float pe1z ( ) const ; // 1st basis vector for the local tangent plane - inline float pe2x ( ) const ; - inline float pe2y ( ) const ; - inline float pe2z ( ) const ; // 2nd basis vector for the local tangent plane - inline float nc ( ) const ; // curr length normal comp - inline float val2 ( ) const ; // complex comp data value (file: sig3-rh.w) - inline float valbak ( ) const ; // scalar data stack - inline float val2bak ( ) const ; // complex comp data stack - inline float stat ( ) const ; // statistic + inline float wnx ( ) const ; + inline float wny ( ) const ; + inline float wnz ( ) const ; // white normal + inline float onx ( ) const ; + inline float ony ( ) const ; + inline float onz ( ) const ; // original normal + inline float dx ( ) const ; + inline float dy ( ) const ; + inline float dz ( ) const ; // current change in position + inline float odx ( ) const ; + inline float ody ( ) const ; + inline float odz ( ) const ; // last change of position (for momentum, + inline float tdx ( ) const ; + inline float tdy ( ) const ; + inline float tdz ( ) const ; // temporary storage for averaging gradient + inline float curv ( ) const ; // curr curvature + inline float curvbak ( ) const ; + inline float val ( ) const ; // scalar data value (file: rh.val, sig2-rh.w) + inline float imag_val ( ) const ; // imaginary part of complex data value + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float tx ( ) const ; + inline float ty ( ) const ; + inline float tz ( ) const ; // tmp coordinate storage + inline float t2x ( ) const ; + inline float t2y ( ) const ; + inline float t2z ( ) const ; // another tmp coordinate storage + inline float targx ( ) const ; + inline float targy ( ) const ; + inline float targz ( ) const ; // target coordinates + inline float pialx ( ) const ; + inline float pialy ( ) const ; + inline float pialz ( ) const ; // pial surface coordinates + inline float whitex ( ) const ; + inline float whitey ( ) const ; + inline float whitez ( ) const ; // white surface coordinates + inline float l4x ( ) const ; + inline float l4y ( ) const ; + inline float l4z ( ) const ; // layerIV surface coordinates + inline float infx ( ) const ; + inline float infy ( ) const ; + inline float infz ( ) const ; // inflated coordinates + inline float fx ( ) const ; + inline float fy ( ) const ; + inline float fz ( ) const ; // flattened coordinates + inline int px ( ) const ; + inline int qx ( ) const ; + inline int py ( ) const ; + inline int qy ( ) const ; + inline int pz ( ) const ; + inline int qz ( ) const ; // rational coordinates for exact calculations + inline float e1x ( ) const ; + inline float e1y ( ) const ; + inline float e1z ( ) const ; // 1st basis vector for the local tangent plane + inline float e2x ( ) const ; + inline float e2y ( ) const ; + inline float e2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float pe1x ( ) const ; + inline float pe1y ( ) const ; + inline float pe1z ( ) const ; // 1st basis vector for the local tangent plane + inline float pe2x ( ) const ; + inline float pe2y ( ) const ; + inline float pe2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float nc ( ) const ; // curr length normal comp + inline float val2 ( ) const ; // complex comp data value (file: sig3-rh.w) + inline float valbak ( ) const ; // scalar data stack + inline float val2bak ( ) const ; // complex comp data stack + inline float stat ( ) const ; // statistic // - inline int undefval ( ) const ; // [previously dist=0] - inline int old_undefval ( ) const ; // for smooth_val_sparse - inline int fixedval ( ) const ; // [previously val=0] + inline int undefval ( ) const ; // [previously dist=0] + inline int old_undefval ( ) const ; // for smooth_val_sparse + inline int fixedval ( ) const ; // [previously val=0] // - inline float fieldsign ( ) const ; // fieldsign--final: -1, "0", "1" (file: rh.fs) - inline float fsmask ( ) const ; // significance mask (file: rh.fm) - inline float d ( ) const ; // for distance calculations - inline int annotation ( ) const ; // area label (defunct--now from label file name!) - inline char oripflag ( ) const ; - inline char origripflag ( ) const ; // cuts flags - inline p_void vp ( ) const ; // to store user's information - inline float theta ( ) const ; - inline float phi ( ) const ; // parameterization - inline float area ( ) const ; - inline float origarea ( ) const ; - inline float group_avg_area ( ) const ; - inline float K ( ) const ; // Gaussian curvature - inline float H ( ) const ; // mean curvature - inline float k1 ( ) const ; - inline float k2 ( ) const ; // the principal curvatures - inline float mean ( ) const ; - inline float mean_imag ( ) const ; // imaginary part of complex statistic - inline float std_error ( ) const ; - inline uint flags ( ) const ; - inline int fno ( ) const ; // face that this vertex is in - inline int cropped ( ) const ; - inline short marked ( ) const ; // for a variety of uses - inline short marked2 ( ) const ; - inline short marked3 ( ) const ; - inline char neg ( ) const ; // 1 if the normal vector is inverted - inline char border ( ) const ; // flag - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline float fieldsign ( ) const ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline float fsmask ( ) const ; // significance mask (file: rh.fm) + inline float d ( ) const ; // for distance calculations + inline int annotation ( ) const ; // area label (defunct--now from label file name!) + inline char oripflag ( ) const ; + inline char origripflag ( ) const ; // cuts flags + inline p_void vp ( ) const ; // to store user's information + inline float theta ( ) const ; + inline float phi ( ) const ; // parameterization + inline float area ( ) const ; + inline float origarea ( ) const ; + inline float group_avg_area ( ) const ; + inline float K ( ) const ; // Gaussian curvature + inline float H ( ) const ; // mean curvature + inline float k1 ( ) const ; + inline float k2 ( ) const ; // the principal curvatures + inline float mean ( ) const ; + inline float mean_imag ( ) const ; // imaginary part of complex statistic + inline float std_error ( ) const ; + inline uint flags ( ) const ; + inline int fno ( ) const ; // face that this vertex is in + inline int cropped ( ) const ; + inline short marked ( ) const ; // for a variety of uses + inline short marked2 ( ) const ; + inline short marked3 ( ) const ; + inline char neg ( ) const ; // 1 if the normal vector is inverted + inline char border ( ) const ; // flag + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces - inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices - inline void set_v ( size_t i, Vertex to ) ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops - inline void set_vnum ( short to ) ; // number of 1-hop neighbors should use [p]VERTEXvnum(i, - inline void set_v2num ( short to ) ; // number of 1, or 2-hop neighbors - inline void set_v3num ( short to ) ; // number of 1,2,or 3-hop neighbors - inline void set_vtotal ( short to ) ; // total # of neighbors. copy of vnum.nsizeCur - inline void set_nsizeMaxClock ( short to ) ; // copy of mris->nsizeMaxClock when v#num - inline void set_nsizeMax ( uchar to ) ; // the max nsize that was used to fill in vnum etc - inline void set_nsizeCur ( uchar to ) ; // index of the current v#num in vtotal - inline void set_num ( uchar to ) ; // number of neighboring faces + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices + inline void set_v ( size_t i, Vertex to ) ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline void set_vnum ( short to ) ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline void set_v2num ( short to ) ; // number of 1, or 2-hop neighbors + inline void set_v3num ( short to ) ; // number of 1,2,or 3-hop neighbors + inline void set_vtotal ( short to ) ; // total # of neighbors. copy of vnum.nsizeCur + inline void set_nsizeMaxClock ( short to ) ; // copy of mris->nsizeMaxClock when v#num + inline void set_nsizeMax ( uchar to ) ; // the max nsize that was used to fill in vnum etc + inline void set_nsizeCur ( uchar to ) ; // index of the current v#num in vtotal + inline void set_num ( uchar to ) ; // number of neighboring faces // - inline void set_x ( float to ) ; // current coordinates - inline void set_y ( float to ) ; // use MRISsetXYZ() to set - inline void set_z ( float to ) ; + inline void set_x ( float to ) ; // current coordinates + inline void set_y ( float to ) ; // use MRISsetXYZ() to set + inline void set_z ( float to ) ; // - inline void set_nx ( float to ) ; - inline void set_ny ( float to ) ; - inline void set_nz ( float to ) ; // curr normal - inline void set_pnx ( float to ) ; - inline void set_pny ( float to ) ; - inline void set_pnz ( float to ) ; // pial normal + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_pnx ( float to ) ; + inline void set_pny ( float to ) ; + inline void set_pnz ( float to ) ; // pial normal // - inline void set_wnx ( float to ) ; - inline void set_wny ( float to ) ; - inline void set_wnz ( float to ) ; // white normal - inline void set_onx ( float to ) ; - inline void set_ony ( float to ) ; - inline void set_onz ( float to ) ; // original normal - inline void set_dx ( float to ) ; - inline void set_dy ( float to ) ; - inline void set_dz ( float to ) ; // current change in position - inline void set_odx ( float to ) ; - inline void set_ody ( float to ) ; - inline void set_odz ( float to ) ; // last change of position (for momentum, - inline void set_tdx ( float to ) ; - inline void set_tdy ( float to ) ; - inline void set_tdz ( float to ) ; // temporary storage for averaging gradient - inline void set_curv ( float to ) ; // curr curvature - inline void set_curvbak ( float to ) ; - inline void set_val ( float to ) ; // scalar data value (file: rh.val, sig2-rh.w) - inline void set_imag_val ( float to ) ; // imaginary part of complex data value - inline void set_cx ( float to ) ; - inline void set_cy ( float to ) ; - inline void set_cz ( float to ) ; // coordinates in canonical coordinate system - inline void set_tx ( float to ) ; - inline void set_ty ( float to ) ; - inline void set_tz ( float to ) ; // tmp coordinate storage - inline void set_t2x ( float to ) ; - inline void set_t2y ( float to ) ; - inline void set_t2z ( float to ) ; // another tmp coordinate storage - inline void set_targx ( float to ) ; - inline void set_targy ( float to ) ; - inline void set_targz ( float to ) ; // target coordinates - inline void set_pialx ( float to ) ; - inline void set_pialy ( float to ) ; - inline void set_pialz ( float to ) ; // pial surface coordinates - inline void set_whitex ( float to ) ; - inline void set_whitey ( float to ) ; - inline void set_whitez ( float to ) ; // white surface coordinates - inline void set_l4x ( float to ) ; - inline void set_l4y ( float to ) ; - inline void set_l4z ( float to ) ; // layerIV surface coordinates - inline void set_infx ( float to ) ; - inline void set_infy ( float to ) ; - inline void set_infz ( float to ) ; // inflated coordinates - inline void set_fx ( float to ) ; - inline void set_fy ( float to ) ; - inline void set_fz ( float to ) ; // flattened coordinates - inline void set_px ( int to ) ; - inline void set_qx ( int to ) ; - inline void set_py ( int to ) ; - inline void set_qy ( int to ) ; - inline void set_pz ( int to ) ; - inline void set_qz ( int to ) ; // rational coordinates for exact calculations - inline void set_e1x ( float to ) ; - inline void set_e1y ( float to ) ; - inline void set_e1z ( float to ) ; // 1st basis vector for the local tangent plane - inline void set_e2x ( float to ) ; - inline void set_e2y ( float to ) ; - inline void set_e2z ( float to ) ; // 2nd basis vector for the local tangent plane - inline void set_pe1x ( float to ) ; - inline void set_pe1y ( float to ) ; - inline void set_pe1z ( float to ) ; // 1st basis vector for the local tangent plane - inline void set_pe2x ( float to ) ; - inline void set_pe2y ( float to ) ; - inline void set_pe2z ( float to ) ; // 2nd basis vector for the local tangent plane - inline void set_nc ( float to ) ; // curr length normal comp - inline void set_val2 ( float to ) ; // complex comp data value (file: sig3-rh.w) - inline void set_valbak ( float to ) ; // scalar data stack - inline void set_val2bak ( float to ) ; // complex comp data stack - inline void set_stat ( float to ) ; // statistic + inline void set_wnx ( float to ) ; + inline void set_wny ( float to ) ; + inline void set_wnz ( float to ) ; // white normal + inline void set_onx ( float to ) ; + inline void set_ony ( float to ) ; + inline void set_onz ( float to ) ; // original normal + inline void set_dx ( float to ) ; + inline void set_dy ( float to ) ; + inline void set_dz ( float to ) ; // current change in position + inline void set_odx ( float to ) ; + inline void set_ody ( float to ) ; + inline void set_odz ( float to ) ; // last change of position (for momentum, + inline void set_tdx ( float to ) ; + inline void set_tdy ( float to ) ; + inline void set_tdz ( float to ) ; // temporary storage for averaging gradient + inline void set_curv ( float to ) ; // curr curvature + inline void set_curvbak ( float to ) ; + inline void set_val ( float to ) ; // scalar data value (file: rh.val, sig2-rh.w) + inline void set_imag_val ( float to ) ; // imaginary part of complex data value + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_tx ( float to ) ; + inline void set_ty ( float to ) ; + inline void set_tz ( float to ) ; // tmp coordinate storage + inline void set_t2x ( float to ) ; + inline void set_t2y ( float to ) ; + inline void set_t2z ( float to ) ; // another tmp coordinate storage + inline void set_targx ( float to ) ; + inline void set_targy ( float to ) ; + inline void set_targz ( float to ) ; // target coordinates + inline void set_pialx ( float to ) ; + inline void set_pialy ( float to ) ; + inline void set_pialz ( float to ) ; // pial surface coordinates + inline void set_whitex ( float to ) ; + inline void set_whitey ( float to ) ; + inline void set_whitez ( float to ) ; // white surface coordinates + inline void set_l4x ( float to ) ; + inline void set_l4y ( float to ) ; + inline void set_l4z ( float to ) ; // layerIV surface coordinates + inline void set_infx ( float to ) ; + inline void set_infy ( float to ) ; + inline void set_infz ( float to ) ; // inflated coordinates + inline void set_fx ( float to ) ; + inline void set_fy ( float to ) ; + inline void set_fz ( float to ) ; // flattened coordinates + inline void set_px ( int to ) ; + inline void set_qx ( int to ) ; + inline void set_py ( int to ) ; + inline void set_qy ( int to ) ; + inline void set_pz ( int to ) ; + inline void set_qz ( int to ) ; // rational coordinates for exact calculations + inline void set_e1x ( float to ) ; + inline void set_e1y ( float to ) ; + inline void set_e1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_e2x ( float to ) ; + inline void set_e2y ( float to ) ; + inline void set_e2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_pe1x ( float to ) ; + inline void set_pe1y ( float to ) ; + inline void set_pe1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_pe2x ( float to ) ; + inline void set_pe2y ( float to ) ; + inline void set_pe2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_nc ( float to ) ; // curr length normal comp + inline void set_val2 ( float to ) ; // complex comp data value (file: sig3-rh.w) + inline void set_valbak ( float to ) ; // scalar data stack + inline void set_val2bak ( float to ) ; // complex comp data stack + inline void set_stat ( float to ) ; // statistic // - inline void set_undefval ( int to ) ; // [previously dist=0] - inline void set_old_undefval ( int to ) ; // for smooth_val_sparse - inline void set_fixedval ( int to ) ; // [previously val=0] + inline void set_undefval ( int to ) ; // [previously dist=0] + inline void set_old_undefval ( int to ) ; // for smooth_val_sparse + inline void set_fixedval ( int to ) ; // [previously val=0] // - inline void set_fieldsign ( float to ) ; // fieldsign--final: -1, "0", "1" (file: rh.fs) - inline void set_fsmask ( float to ) ; // significance mask (file: rh.fm) - inline void set_d ( float to ) ; // for distance calculations - inline void set_annotation ( int to ) ; // area label (defunct--now from label file name!) - inline void set_oripflag ( char to ) ; - inline void set_origripflag ( char to ) ; // cuts flags - inline void set_vp ( p_void to ) ; // to store user's information - inline void set_theta ( float to ) ; - inline void set_phi ( float to ) ; // parameterization - inline void set_area ( float to ) ; - inline void set_origarea ( float to ) ; - inline void set_group_avg_area ( float to ) ; - inline void set_K ( float to ) ; // Gaussian curvature - inline void set_H ( float to ) ; // mean curvature - inline void set_k1 ( float to ) ; - inline void set_k2 ( float to ) ; // the principal curvatures - inline void set_mean ( float to ) ; - inline void set_mean_imag ( float to ) ; // imaginary part of complex statistic - inline void set_std_error ( float to ) ; - inline void set_flags ( uint to ) ; - inline void set_fno ( int to ) ; // face that this vertex is in - inline void set_cropped ( int to ) ; - inline void set_marked ( short to ) ; // for a variety of uses - inline void set_marked2 ( short to ) ; - inline void set_marked3 ( short to ) ; - inline void set_neg ( char to ) ; // 1 if the normal vector is inverted - inline void set_border ( char to ) ; // flag - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_fieldsign ( float to ) ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline void set_fsmask ( float to ) ; // significance mask (file: rh.fm) + inline void set_d ( float to ) ; // for distance calculations + inline void set_annotation ( int to ) ; // area label (defunct--now from label file name!) + inline void set_oripflag ( char to ) ; + inline void set_origripflag ( char to ) ; // cuts flags + inline void set_vp ( p_void to ) ; // to store user's information + inline void set_theta ( float to ) ; + inline void set_phi ( float to ) ; // parameterization + inline void set_area ( float to ) ; + inline void set_origarea ( float to ) ; + inline void set_group_avg_area ( float to ) ; + inline void set_K ( float to ) ; // Gaussian curvature + inline void set_H ( float to ) ; // mean curvature + inline void set_k1 ( float to ) ; + inline void set_k2 ( float to ) ; // the principal curvatures + inline void set_mean ( float to ) ; + inline void set_mean_imag ( float to ) ; // imaginary part of complex statistic + inline void set_std_error ( float to ) ; + inline void set_flags ( uint to ) ; + inline void set_fno ( int to ) ; // face that this vertex is in + inline void set_cropped ( int to ) ; + inline void set_marked ( short to ) ; // for a variety of uses + inline void set_marked2 ( short to ) ; + inline void set_marked3 ( short to ) ; + inline void set_neg ( char to ) ; // 1 if the normal vector is inverted + inline void set_border ( char to ) ; // flag + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef AllM::Face Face; + typedef AllM::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); // Fields being maintained by specialist functions - inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons - inline int nedges ( ) const ; // # of edges on surface - inline int nstrips ( ) const ; - inline Vertex vertices ( size_t i ) const ; - inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored - inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored - inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use - inline Face faces ( size_t i ) const ; - inline MRI_EDGE edges ( size_t i ) const ; - inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; - inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; - inline STRIP strips ( size_t i ) const ; - inline float xctr ( ) const ; - inline float yctr ( ) const ; - inline float zctr ( ) const ; - inline float xlo ( ) const ; - inline float ylo ( ) const ; - inline float zlo ( ) const ; - inline float xhi ( ) const ; - inline float yhi ( ) const ; - inline float zhi ( ) const ; - inline float x0 ( ) const ; // center of spherical expansion - inline float y0 ( ) const ; - inline float z0 ( ) const ; - inline Vertex v_temporal_pole ( ) const ; - inline Vertex v_frontal_pole ( ) const ; - inline Vertex v_occipital_pole ( ) const ; - inline float max_curv ( ) const ; - inline float min_curv ( ) const ; - inline float total_area ( ) const ; - inline double avg_vertex_area ( ) const ; - inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist - inline double std_vertex_dist ( ) const ; - inline float orig_area ( ) const ; - inline float neg_area ( ) const ; - inline float neg_orig_area ( ) const ; // amount of original surface in folds - inline int zeros ( ) const ; - inline int hemisphere ( ) const ; // which hemisphere - inline int initialized ( ) const ; - inline PLTA lta ( ) const ; - inline PMATRIX SRASToTalSRAS_ ( ) const ; - inline PMATRIX TalSRASToSRAS_ ( ) const ; - inline int free_transform ( ) const ; - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline float a ( ) const ; - inline float b ( ) const ; - inline float c ( ) const ; // ellipsoid parameters - inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from - inline float Hmin ( ) const ; // min mean curvature - inline float Hmax ( ) const ; // max mean curvature - inline float Kmin ( ) const ; // min Gaussian curvature - inline float Kmax ( ) const ; // max Gaussian curvature - inline double Ktotal ( ) const ; // total Gaussian curvature - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - inline int patch ( ) const ; // if a patch of the surface - inline int nlabels ( ) const ; - inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) - inline p_void vp ( ) const ; // for misc. use - inline float alpha ( ) const ; // rotation around z-axis - inline float beta ( ) const ; // rotation around y-axis - inline float gamma ( ) const ; // rotation around x-axis - inline float da ( ) const ; - inline float db ( ) const ; - inline float dg ( ) const ; // old deltas - inline int type ( ) const ; // what type of surface was this initially - inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces - inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces - inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject - inline float canon_area ( ) const ; - inline int noscale ( ) const ; // don't scale by surface area if true - inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) - inline float dy2 ( size_t i ) const ; - inline float dz2 ( size_t i ) const ; - inline PCOLOR_TABLE ct ( ) const ; - inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) - inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 - inline MRIS_cmdlines_t cmdlines ( ) const ; - inline int ncmds ( ) const ; - inline float group_avg_surface_area ( ) const ; // average of total surface area for group - inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex - inline int triangle_links_removed ( ) const ; // for quad surfaces - inline p_void user_parms ( ) const ; // for whatever the user wants to hang here - inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel - inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for - inline p_void mht ( ) const ; - inline p_void temps ( ) const ; + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline STRIP strips ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float x0 ( ) const ; // center of spherical expansion + inline float y0 ( ) const ; + inline float z0 ( ) const ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + inline Vertex v_temporal_pole ( ) const ; + inline Vertex v_frontal_pole ( ) const ; + inline Vertex v_occipital_pole ( ) const ; + // + inline float max_curv ( ) const ; + inline float min_curv ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline int zeros ( ) const ; + inline int hemisphere ( ) const ; // which hemisphere + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline float Hmin ( ) const ; // min mean curvature + inline float Hmax ( ) const ; // max mean curvature + inline float Kmin ( ) const ; // min Gaussian curvature + inline float Kmax ( ) const ; // max Gaussian curvature + inline double Ktotal ( ) const ; // total Gaussian curvature + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int nlabels ( ) const ; + inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) + inline p_void vp ( ) const ; // for misc. use + inline float alpha ( ) const ; // rotation around z-axis + inline float beta ( ) const ; // rotation around y-axis + inline float gamma ( ) const ; // rotation around x-axis + inline float da ( ) const ; + inline float db ( ) const ; + inline float dg ( ) const ; // old deltas + inline int type ( ) const ; // what type of surface was this initially + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; - inline void set_strips ( size_t i, STRIP to ) ; - inline void set_xctr ( float to ) ; - inline void set_yctr ( float to ) ; - inline void set_zctr ( float to ) ; - inline void set_xlo ( float to ) ; - inline void set_ylo ( float to ) ; - inline void set_zlo ( float to ) ; - inline void set_xhi ( float to ) ; - inline void set_yhi ( float to ) ; - inline void set_zhi ( float to ) ; - inline void set_x0 ( float to ) ; // center of spherical expansion - inline void set_y0 ( float to ) ; - inline void set_z0 ( float to ) ; - inline void set_v_temporal_pole ( Vertex to ) ; - inline void set_v_frontal_pole ( Vertex to ) ; - inline void set_v_occipital_pole ( Vertex to ) ; - inline void set_max_curv ( float to ) ; - inline void set_min_curv ( float to ) ; - inline void set_total_area ( float to ) ; - inline void set_avg_vertex_area ( double to ) ; - inline void set_avg_vertex_dist ( double to ) ; // set by MRIScomputeAvgInterVertexDist - inline void set_std_vertex_dist ( double to ) ; - inline void set_orig_area ( float to ) ; - inline void set_neg_area ( float to ) ; - inline void set_neg_orig_area ( float to ) ; // amount of original surface in folds - inline void set_zeros ( int to ) ; - inline void set_hemisphere ( int to ) ; // which hemisphere - inline void set_fname ( MRIS_fname_t to ) ; // file it was originally loaded from - inline void set_Hmin ( float to ) ; // min mean curvature - inline void set_Hmax ( float to ) ; // max mean curvature - inline void set_Kmin ( float to ) ; // min Gaussian curvature - inline void set_Kmax ( float to ) ; // max Gaussian curvature - inline void set_Ktotal ( double to ) ; // total Gaussian curvature - inline void set_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) - inline void set_origxyz_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - inline void set_patch ( int to ) ; // if a patch of the surface - inline void set_nlabels ( int to ) ; - inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) - inline void set_vp ( p_void to ) ; // for misc. use - inline void set_alpha ( float to ) ; // rotation around z-axis - inline void set_beta ( float to ) ; // rotation around y-axis - inline void set_gamma ( float to ) ; // rotation around x-axis - inline void set_da ( float to ) ; - inline void set_db ( float to ) ; - inline void set_dg ( float to ) ; // old deltas - inline void set_type ( int to ) ; // what type of surface was this initially - }; + inline void set_strips ( size_t i, STRIP to ) ; + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_x0 ( float to ) ; // center of spherical expansion + inline void set_y0 ( float to ) ; + inline void set_z0 ( float to ) ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + inline void set_v_temporal_pole ( Vertex to ) ; + inline void set_v_frontal_pole ( Vertex to ) ; + inline void set_v_occipital_pole ( Vertex to ) ; + // + inline void set_max_curv ( float to ) ; + inline void set_min_curv ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + inline void set_avg_vertex_dist ( double to ) ; // set by MRIScomputeAvgInterVertexDist + inline void set_std_vertex_dist ( double to ) ; + inline void set_orig_area ( float to ) ; + inline void set_neg_area ( float to ) ; + inline void set_neg_orig_area ( float to ) ; // amount of original surface in folds + inline void set_zeros ( int to ) ; + inline void set_hemisphere ( int to ) ; // which hemisphere + inline void set_fname ( MRIS_fname_t to ) ; // file it was originally loaded from + inline void set_Hmin ( float to ) ; // min mean curvature + inline void set_Hmax ( float to ) ; // max mean curvature + inline void set_Kmin ( float to ) ; // min Gaussian curvature + inline void set_Kmax ( float to ) ; // max Gaussian curvature + inline void set_Ktotal ( double to ) ; // total Gaussian curvature + inline void set_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) + inline void set_origxyz_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline void set_patch ( int to ) ; // if a patch of the surface + inline void set_nlabels ( int to ) ; + inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) + inline void set_vp ( p_void to ) ; // for misc. use + inline void set_alpha ( float to ) ; // rotation around z-axis + inline void set_beta ( float to ) ; // rotation around y-axis + inline void set_gamma ( float to ) ; // rotation around x-axis + inline void set_da ( float to ) ; + inline void set_db ( float to ) ; + inline void set_dg ( float to ) ; // old deltas + inline void set_type ( int to ) ; // what type of surface was this initially + }; // Surface } // namespace AllM diff --git a/include/mrisurf_SurfaceFromMRIS_generated_Analysis.h b/include/mrisurf_SurfaceFromMRIS_generated_Analysis.h index c73370e6769..eb51f4f462c 100644 --- a/include/mrisurf_SurfaceFromMRIS_generated_Analysis.h +++ b/include/mrisurf_SurfaceFromMRIS_generated_Analysis.h @@ -1,28 +1,32 @@ namespace Analysis { struct Face : public Repr_Elt { + typedef Analysis::Surface Surface; + typedef Analysis::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline float area ( ) const ; - inline angles_per_triangle_t angle ( ) const ; - inline angles_per_triangle_t orig_angle ( ) const ; - inline char ripflag ( ) const ; - inline char oripflag ( ) const ; - inline int marked ( ) const ; - inline PDMATRIX norm ( ) const ; - inline A3PDMATRIX gradNorm ( ) const ; + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; + inline PDMATRIX norm ( ) const ; + inline A3PDMATRIX gradNorm ( ) const ; - inline void set_orig_angle ( angles_per_triangle_t to ) ; - inline void set_ripflag ( char to ) ; - inline void set_oripflag ( char to ) ; - inline void set_marked ( int to ) ; - }; + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef Analysis::Surface Surface; + typedef Analysis::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -31,394 +35,402 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline int e ( size_t i ) const ; // edge state for neighboring vertices - inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops - inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i, - inline short v2num ( ) const ; // number of 1, or 2-hop neighbors - inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors - inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur - inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num - inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc - inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal - inline uchar num ( ) const ; // number of neighboring faces + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces // managed by MRISfreeDists[_orig] and MRISmakeDists[_orig] - inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz - inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz - inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements - inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements // - inline float x ( ) const ; // current coordinates - inline float y ( ) const ; // use MRISsetXYZ() to set - inline float z ( ) const ; + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; // - inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status - inline float origy ( ) const ; // use MRISsetOriginalXYZ(, - inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set // - inline float nx ( ) const ; - inline float ny ( ) const ; - inline float nz ( ) const ; // curr normal - inline float pnx ( ) const ; - inline float pny ( ) const ; - inline float pnz ( ) const ; // pial normal + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float pnx ( ) const ; + inline float pny ( ) const ; + inline float pnz ( ) const ; // pial normal // - inline float wnx ( ) const ; - inline float wny ( ) const ; - inline float wnz ( ) const ; // white normal - inline float onx ( ) const ; - inline float ony ( ) const ; - inline float onz ( ) const ; // original normal - inline float dx ( ) const ; - inline float dy ( ) const ; - inline float dz ( ) const ; // current change in position - inline float odx ( ) const ; - inline float ody ( ) const ; - inline float odz ( ) const ; // last change of position (for momentum, - inline float tdx ( ) const ; - inline float tdy ( ) const ; - inline float tdz ( ) const ; // temporary storage for averaging gradient - inline float curv ( ) const ; // curr curvature - inline float curvbak ( ) const ; - inline float val ( ) const ; // scalar data value (file: rh.val, sig2-rh.w) - inline float imag_val ( ) const ; // imaginary part of complex data value - inline float cx ( ) const ; - inline float cy ( ) const ; - inline float cz ( ) const ; // coordinates in canonical coordinate system - inline float tx ( ) const ; - inline float ty ( ) const ; - inline float tz ( ) const ; // tmp coordinate storage - inline float t2x ( ) const ; - inline float t2y ( ) const ; - inline float t2z ( ) const ; // another tmp coordinate storage - inline float targx ( ) const ; - inline float targy ( ) const ; - inline float targz ( ) const ; // target coordinates - inline float pialx ( ) const ; - inline float pialy ( ) const ; - inline float pialz ( ) const ; // pial surface coordinates - inline float whitex ( ) const ; - inline float whitey ( ) const ; - inline float whitez ( ) const ; // white surface coordinates - inline float l4x ( ) const ; - inline float l4y ( ) const ; - inline float l4z ( ) const ; // layerIV surface coordinates - inline float infx ( ) const ; - inline float infy ( ) const ; - inline float infz ( ) const ; // inflated coordinates - inline float fx ( ) const ; - inline float fy ( ) const ; - inline float fz ( ) const ; // flattened coordinates - inline int px ( ) const ; - inline int qx ( ) const ; - inline int py ( ) const ; - inline int qy ( ) const ; - inline int pz ( ) const ; - inline int qz ( ) const ; // rational coordinates for exact calculations - inline float e1x ( ) const ; - inline float e1y ( ) const ; - inline float e1z ( ) const ; // 1st basis vector for the local tangent plane - inline float e2x ( ) const ; - inline float e2y ( ) const ; - inline float e2z ( ) const ; // 2nd basis vector for the local tangent plane - inline float pe1x ( ) const ; - inline float pe1y ( ) const ; - inline float pe1z ( ) const ; // 1st basis vector for the local tangent plane - inline float pe2x ( ) const ; - inline float pe2y ( ) const ; - inline float pe2z ( ) const ; // 2nd basis vector for the local tangent plane - inline float nc ( ) const ; // curr length normal comp - inline float val2 ( ) const ; // complex comp data value (file: sig3-rh.w) - inline float valbak ( ) const ; // scalar data stack - inline float val2bak ( ) const ; // complex comp data stack - inline float stat ( ) const ; // statistic + inline float wnx ( ) const ; + inline float wny ( ) const ; + inline float wnz ( ) const ; // white normal + inline float onx ( ) const ; + inline float ony ( ) const ; + inline float onz ( ) const ; // original normal + inline float dx ( ) const ; + inline float dy ( ) const ; + inline float dz ( ) const ; // current change in position + inline float odx ( ) const ; + inline float ody ( ) const ; + inline float odz ( ) const ; // last change of position (for momentum, + inline float tdx ( ) const ; + inline float tdy ( ) const ; + inline float tdz ( ) const ; // temporary storage for averaging gradient + inline float curv ( ) const ; // curr curvature + inline float curvbak ( ) const ; + inline float val ( ) const ; // scalar data value (file: rh.val, sig2-rh.w) + inline float imag_val ( ) const ; // imaginary part of complex data value + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float tx ( ) const ; + inline float ty ( ) const ; + inline float tz ( ) const ; // tmp coordinate storage + inline float t2x ( ) const ; + inline float t2y ( ) const ; + inline float t2z ( ) const ; // another tmp coordinate storage + inline float targx ( ) const ; + inline float targy ( ) const ; + inline float targz ( ) const ; // target coordinates + inline float pialx ( ) const ; + inline float pialy ( ) const ; + inline float pialz ( ) const ; // pial surface coordinates + inline float whitex ( ) const ; + inline float whitey ( ) const ; + inline float whitez ( ) const ; // white surface coordinates + inline float l4x ( ) const ; + inline float l4y ( ) const ; + inline float l4z ( ) const ; // layerIV surface coordinates + inline float infx ( ) const ; + inline float infy ( ) const ; + inline float infz ( ) const ; // inflated coordinates + inline float fx ( ) const ; + inline float fy ( ) const ; + inline float fz ( ) const ; // flattened coordinates + inline int px ( ) const ; + inline int qx ( ) const ; + inline int py ( ) const ; + inline int qy ( ) const ; + inline int pz ( ) const ; + inline int qz ( ) const ; // rational coordinates for exact calculations + inline float e1x ( ) const ; + inline float e1y ( ) const ; + inline float e1z ( ) const ; // 1st basis vector for the local tangent plane + inline float e2x ( ) const ; + inline float e2y ( ) const ; + inline float e2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float pe1x ( ) const ; + inline float pe1y ( ) const ; + inline float pe1z ( ) const ; // 1st basis vector for the local tangent plane + inline float pe2x ( ) const ; + inline float pe2y ( ) const ; + inline float pe2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float nc ( ) const ; // curr length normal comp + inline float val2 ( ) const ; // complex comp data value (file: sig3-rh.w) + inline float valbak ( ) const ; // scalar data stack + inline float val2bak ( ) const ; // complex comp data stack + inline float stat ( ) const ; // statistic // - inline int undefval ( ) const ; // [previously dist=0] - inline int old_undefval ( ) const ; // for smooth_val_sparse - inline int fixedval ( ) const ; // [previously val=0] + inline int undefval ( ) const ; // [previously dist=0] + inline int old_undefval ( ) const ; // for smooth_val_sparse + inline int fixedval ( ) const ; // [previously val=0] // - inline float fieldsign ( ) const ; // fieldsign--final: -1, "0", "1" (file: rh.fs) - inline float fsmask ( ) const ; // significance mask (file: rh.fm) - inline float d ( ) const ; // for distance calculations - inline int annotation ( ) const ; // area label (defunct--now from label file name!) - inline char oripflag ( ) const ; - inline char origripflag ( ) const ; // cuts flags - inline p_void vp ( ) const ; // to store user's information - inline float theta ( ) const ; - inline float phi ( ) const ; // parameterization - inline float area ( ) const ; - inline float origarea ( ) const ; - inline float group_avg_area ( ) const ; - inline float K ( ) const ; // Gaussian curvature - inline float H ( ) const ; // mean curvature - inline float k1 ( ) const ; - inline float k2 ( ) const ; // the principal curvatures - inline float mean ( ) const ; - inline float mean_imag ( ) const ; // imaginary part of complex statistic - inline float std_error ( ) const ; - inline uint flags ( ) const ; - inline int fno ( ) const ; // face that this vertex is in - inline int cropped ( ) const ; - inline short marked ( ) const ; // for a variety of uses - inline short marked2 ( ) const ; - inline short marked3 ( ) const ; - inline char neg ( ) const ; // 1 if the normal vector is inverted - inline char border ( ) const ; // flag - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline float fieldsign ( ) const ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline float fsmask ( ) const ; // significance mask (file: rh.fm) + inline float d ( ) const ; // for distance calculations + inline int annotation ( ) const ; // area label (defunct--now from label file name!) + inline char oripflag ( ) const ; + inline char origripflag ( ) const ; // cuts flags + inline p_void vp ( ) const ; // to store user's information + inline float theta ( ) const ; + inline float phi ( ) const ; // parameterization + inline float area ( ) const ; + inline float origarea ( ) const ; + inline float group_avg_area ( ) const ; + inline float K ( ) const ; // Gaussian curvature + inline float H ( ) const ; // mean curvature + inline float k1 ( ) const ; + inline float k2 ( ) const ; // the principal curvatures + inline float mean ( ) const ; + inline float mean_imag ( ) const ; // imaginary part of complex statistic + inline float std_error ( ) const ; + inline uint flags ( ) const ; + inline int fno ( ) const ; // face that this vertex is in + inline int cropped ( ) const ; + inline short marked ( ) const ; // for a variety of uses + inline short marked2 ( ) const ; + inline short marked3 ( ) const ; + inline char neg ( ) const ; // 1 if the normal vector is inverted + inline char border ( ) const ; // flag + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces - inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices // - inline void set_nx ( float to ) ; - inline void set_ny ( float to ) ; - inline void set_nz ( float to ) ; // curr normal - inline void set_pnx ( float to ) ; - inline void set_pny ( float to ) ; - inline void set_pnz ( float to ) ; // pial normal + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_pnx ( float to ) ; + inline void set_pny ( float to ) ; + inline void set_pnz ( float to ) ; // pial normal // - inline void set_wnx ( float to ) ; - inline void set_wny ( float to ) ; - inline void set_wnz ( float to ) ; // white normal - inline void set_onx ( float to ) ; - inline void set_ony ( float to ) ; - inline void set_onz ( float to ) ; // original normal - inline void set_dx ( float to ) ; - inline void set_dy ( float to ) ; - inline void set_dz ( float to ) ; // current change in position - inline void set_odx ( float to ) ; - inline void set_ody ( float to ) ; - inline void set_odz ( float to ) ; // last change of position (for momentum, - inline void set_tdx ( float to ) ; - inline void set_tdy ( float to ) ; - inline void set_tdz ( float to ) ; // temporary storage for averaging gradient - inline void set_curv ( float to ) ; // curr curvature - inline void set_curvbak ( float to ) ; - inline void set_val ( float to ) ; // scalar data value (file: rh.val, sig2-rh.w) - inline void set_imag_val ( float to ) ; // imaginary part of complex data value - inline void set_cx ( float to ) ; - inline void set_cy ( float to ) ; - inline void set_cz ( float to ) ; // coordinates in canonical coordinate system - inline void set_tx ( float to ) ; - inline void set_ty ( float to ) ; - inline void set_tz ( float to ) ; // tmp coordinate storage - inline void set_t2x ( float to ) ; - inline void set_t2y ( float to ) ; - inline void set_t2z ( float to ) ; // another tmp coordinate storage - inline void set_targx ( float to ) ; - inline void set_targy ( float to ) ; - inline void set_targz ( float to ) ; // target coordinates - inline void set_pialx ( float to ) ; - inline void set_pialy ( float to ) ; - inline void set_pialz ( float to ) ; // pial surface coordinates - inline void set_whitex ( float to ) ; - inline void set_whitey ( float to ) ; - inline void set_whitez ( float to ) ; // white surface coordinates - inline void set_l4x ( float to ) ; - inline void set_l4y ( float to ) ; - inline void set_l4z ( float to ) ; // layerIV surface coordinates - inline void set_infx ( float to ) ; - inline void set_infy ( float to ) ; - inline void set_infz ( float to ) ; // inflated coordinates - inline void set_fx ( float to ) ; - inline void set_fy ( float to ) ; - inline void set_fz ( float to ) ; // flattened coordinates - inline void set_px ( int to ) ; - inline void set_qx ( int to ) ; - inline void set_py ( int to ) ; - inline void set_qy ( int to ) ; - inline void set_pz ( int to ) ; - inline void set_qz ( int to ) ; // rational coordinates for exact calculations - inline void set_e1x ( float to ) ; - inline void set_e1y ( float to ) ; - inline void set_e1z ( float to ) ; // 1st basis vector for the local tangent plane - inline void set_e2x ( float to ) ; - inline void set_e2y ( float to ) ; - inline void set_e2z ( float to ) ; // 2nd basis vector for the local tangent plane - inline void set_pe1x ( float to ) ; - inline void set_pe1y ( float to ) ; - inline void set_pe1z ( float to ) ; // 1st basis vector for the local tangent plane - inline void set_pe2x ( float to ) ; - inline void set_pe2y ( float to ) ; - inline void set_pe2z ( float to ) ; // 2nd basis vector for the local tangent plane - inline void set_nc ( float to ) ; // curr length normal comp - inline void set_val2 ( float to ) ; // complex comp data value (file: sig3-rh.w) - inline void set_valbak ( float to ) ; // scalar data stack - inline void set_val2bak ( float to ) ; // complex comp data stack - inline void set_stat ( float to ) ; // statistic + inline void set_wnx ( float to ) ; + inline void set_wny ( float to ) ; + inline void set_wnz ( float to ) ; // white normal + inline void set_onx ( float to ) ; + inline void set_ony ( float to ) ; + inline void set_onz ( float to ) ; // original normal + inline void set_dx ( float to ) ; + inline void set_dy ( float to ) ; + inline void set_dz ( float to ) ; // current change in position + inline void set_odx ( float to ) ; + inline void set_ody ( float to ) ; + inline void set_odz ( float to ) ; // last change of position (for momentum, + inline void set_tdx ( float to ) ; + inline void set_tdy ( float to ) ; + inline void set_tdz ( float to ) ; // temporary storage for averaging gradient + inline void set_curv ( float to ) ; // curr curvature + inline void set_curvbak ( float to ) ; + inline void set_val ( float to ) ; // scalar data value (file: rh.val, sig2-rh.w) + inline void set_imag_val ( float to ) ; // imaginary part of complex data value + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_tx ( float to ) ; + inline void set_ty ( float to ) ; + inline void set_tz ( float to ) ; // tmp coordinate storage + inline void set_t2x ( float to ) ; + inline void set_t2y ( float to ) ; + inline void set_t2z ( float to ) ; // another tmp coordinate storage + inline void set_targx ( float to ) ; + inline void set_targy ( float to ) ; + inline void set_targz ( float to ) ; // target coordinates + inline void set_pialx ( float to ) ; + inline void set_pialy ( float to ) ; + inline void set_pialz ( float to ) ; // pial surface coordinates + inline void set_whitex ( float to ) ; + inline void set_whitey ( float to ) ; + inline void set_whitez ( float to ) ; // white surface coordinates + inline void set_l4x ( float to ) ; + inline void set_l4y ( float to ) ; + inline void set_l4z ( float to ) ; // layerIV surface coordinates + inline void set_infx ( float to ) ; + inline void set_infy ( float to ) ; + inline void set_infz ( float to ) ; // inflated coordinates + inline void set_fx ( float to ) ; + inline void set_fy ( float to ) ; + inline void set_fz ( float to ) ; // flattened coordinates + inline void set_px ( int to ) ; + inline void set_qx ( int to ) ; + inline void set_py ( int to ) ; + inline void set_qy ( int to ) ; + inline void set_pz ( int to ) ; + inline void set_qz ( int to ) ; // rational coordinates for exact calculations + inline void set_e1x ( float to ) ; + inline void set_e1y ( float to ) ; + inline void set_e1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_e2x ( float to ) ; + inline void set_e2y ( float to ) ; + inline void set_e2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_pe1x ( float to ) ; + inline void set_pe1y ( float to ) ; + inline void set_pe1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_pe2x ( float to ) ; + inline void set_pe2y ( float to ) ; + inline void set_pe2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_nc ( float to ) ; // curr length normal comp + inline void set_val2 ( float to ) ; // complex comp data value (file: sig3-rh.w) + inline void set_valbak ( float to ) ; // scalar data stack + inline void set_val2bak ( float to ) ; // complex comp data stack + inline void set_stat ( float to ) ; // statistic // - inline void set_undefval ( int to ) ; // [previously dist=0] - inline void set_old_undefval ( int to ) ; // for smooth_val_sparse - inline void set_fixedval ( int to ) ; // [previously val=0] + inline void set_undefval ( int to ) ; // [previously dist=0] + inline void set_old_undefval ( int to ) ; // for smooth_val_sparse + inline void set_fixedval ( int to ) ; // [previously val=0] // - inline void set_fieldsign ( float to ) ; // fieldsign--final: -1, "0", "1" (file: rh.fs) - inline void set_fsmask ( float to ) ; // significance mask (file: rh.fm) - inline void set_d ( float to ) ; // for distance calculations - inline void set_annotation ( int to ) ; // area label (defunct--now from label file name!) - inline void set_oripflag ( char to ) ; - inline void set_origripflag ( char to ) ; // cuts flags - inline void set_vp ( p_void to ) ; // to store user's information - inline void set_theta ( float to ) ; - inline void set_phi ( float to ) ; // parameterization - inline void set_origarea ( float to ) ; - inline void set_group_avg_area ( float to ) ; - inline void set_K ( float to ) ; // Gaussian curvature - inline void set_H ( float to ) ; // mean curvature - inline void set_k1 ( float to ) ; - inline void set_k2 ( float to ) ; // the principal curvatures - inline void set_mean ( float to ) ; - inline void set_mean_imag ( float to ) ; // imaginary part of complex statistic - inline void set_std_error ( float to ) ; - inline void set_flags ( uint to ) ; - inline void set_fno ( int to ) ; // face that this vertex is in - inline void set_cropped ( int to ) ; - inline void set_marked ( short to ) ; // for a variety of uses - inline void set_marked2 ( short to ) ; - inline void set_marked3 ( short to ) ; - inline void set_neg ( char to ) ; // 1 if the normal vector is inverted - inline void set_border ( char to ) ; // flag - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_fieldsign ( float to ) ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline void set_fsmask ( float to ) ; // significance mask (file: rh.fm) + inline void set_d ( float to ) ; // for distance calculations + inline void set_annotation ( int to ) ; // area label (defunct--now from label file name!) + inline void set_oripflag ( char to ) ; + inline void set_origripflag ( char to ) ; // cuts flags + inline void set_vp ( p_void to ) ; // to store user's information + inline void set_theta ( float to ) ; + inline void set_phi ( float to ) ; // parameterization + inline void set_origarea ( float to ) ; + inline void set_group_avg_area ( float to ) ; + inline void set_K ( float to ) ; // Gaussian curvature + inline void set_H ( float to ) ; // mean curvature + inline void set_k1 ( float to ) ; + inline void set_k2 ( float to ) ; // the principal curvatures + inline void set_mean ( float to ) ; + inline void set_mean_imag ( float to ) ; // imaginary part of complex statistic + inline void set_std_error ( float to ) ; + inline void set_flags ( uint to ) ; + inline void set_fno ( int to ) ; // face that this vertex is in + inline void set_cropped ( int to ) ; + inline void set_marked ( short to ) ; // for a variety of uses + inline void set_marked2 ( short to ) ; + inline void set_marked3 ( short to ) ; + inline void set_neg ( char to ) ; // 1 if the normal vector is inverted + inline void set_border ( char to ) ; // flag + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef Analysis::Face Face; + typedef Analysis::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); inline Surface ( AllM::Surface const & src ); // Fields being maintained by specialist functions - inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons - inline int nedges ( ) const ; // # of edges on surface - inline int nstrips ( ) const ; - inline Vertex vertices ( size_t i ) const ; - inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored - inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored - inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use - inline Face faces ( size_t i ) const ; - inline MRI_EDGE edges ( size_t i ) const ; - inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; - inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; - inline STRIP strips ( size_t i ) const ; - inline float xctr ( ) const ; - inline float yctr ( ) const ; - inline float zctr ( ) const ; - inline float xlo ( ) const ; - inline float ylo ( ) const ; - inline float zlo ( ) const ; - inline float xhi ( ) const ; - inline float yhi ( ) const ; - inline float zhi ( ) const ; - inline float x0 ( ) const ; // center of spherical expansion - inline float y0 ( ) const ; - inline float z0 ( ) const ; - inline Vertex v_temporal_pole ( ) const ; - inline Vertex v_frontal_pole ( ) const ; - inline Vertex v_occipital_pole ( ) const ; - inline float max_curv ( ) const ; - inline float min_curv ( ) const ; - inline float total_area ( ) const ; - inline double avg_vertex_area ( ) const ; - inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist - inline double std_vertex_dist ( ) const ; - inline float orig_area ( ) const ; - inline float neg_area ( ) const ; - inline float neg_orig_area ( ) const ; // amount of original surface in folds - inline int zeros ( ) const ; - inline int hemisphere ( ) const ; // which hemisphere - inline int initialized ( ) const ; - inline PLTA lta ( ) const ; - inline PMATRIX SRASToTalSRAS_ ( ) const ; - inline PMATRIX TalSRASToSRAS_ ( ) const ; - inline int free_transform ( ) const ; - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline float a ( ) const ; - inline float b ( ) const ; - inline float c ( ) const ; // ellipsoid parameters - inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from - inline float Hmin ( ) const ; // min mean curvature - inline float Hmax ( ) const ; // max mean curvature - inline float Kmin ( ) const ; // min Gaussian curvature - inline float Kmax ( ) const ; // max Gaussian curvature - inline double Ktotal ( ) const ; // total Gaussian curvature - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - inline int patch ( ) const ; // if a patch of the surface - inline int nlabels ( ) const ; - inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) - inline p_void vp ( ) const ; // for misc. use - inline float alpha ( ) const ; // rotation around z-axis - inline float beta ( ) const ; // rotation around y-axis - inline float gamma ( ) const ; // rotation around x-axis - inline float da ( ) const ; - inline float db ( ) const ; - inline float dg ( ) const ; // old deltas - inline int type ( ) const ; // what type of surface was this initially - inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces - inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces - inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject - inline float canon_area ( ) const ; - inline int noscale ( ) const ; // don't scale by surface area if true - inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) - inline float dy2 ( size_t i ) const ; - inline float dz2 ( size_t i ) const ; - inline PCOLOR_TABLE ct ( ) const ; - inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) - inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 - inline MRIS_cmdlines_t cmdlines ( ) const ; - inline int ncmds ( ) const ; - inline float group_avg_surface_area ( ) const ; // average of total surface area for group - inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex - inline int triangle_links_removed ( ) const ; // for quad surfaces - inline p_void user_parms ( ) const ; // for whatever the user wants to hang here - inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel - inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for - inline p_void mht ( ) const ; - inline p_void temps ( ) const ; + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline STRIP strips ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float x0 ( ) const ; // center of spherical expansion + inline float y0 ( ) const ; + inline float z0 ( ) const ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + inline Vertex v_temporal_pole ( ) const ; + inline Vertex v_frontal_pole ( ) const ; + inline Vertex v_occipital_pole ( ) const ; + // + inline float max_curv ( ) const ; + inline float min_curv ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline int zeros ( ) const ; + inline int hemisphere ( ) const ; // which hemisphere + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline float Hmin ( ) const ; // min mean curvature + inline float Hmax ( ) const ; // max mean curvature + inline float Kmin ( ) const ; // min Gaussian curvature + inline float Kmax ( ) const ; // max Gaussian curvature + inline double Ktotal ( ) const ; // total Gaussian curvature + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int nlabels ( ) const ; + inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) + inline p_void vp ( ) const ; // for misc. use + inline float alpha ( ) const ; // rotation around z-axis + inline float beta ( ) const ; // rotation around y-axis + inline float gamma ( ) const ; // rotation around x-axis + inline float da ( ) const ; + inline float db ( ) const ; + inline float dg ( ) const ; // old deltas + inline int type ( ) const ; // what type of surface was this initially + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; - inline void set_strips ( size_t i, STRIP to ) ; - inline void set_xctr ( float to ) ; - inline void set_yctr ( float to ) ; - inline void set_zctr ( float to ) ; - inline void set_xlo ( float to ) ; - inline void set_ylo ( float to ) ; - inline void set_zlo ( float to ) ; - inline void set_xhi ( float to ) ; - inline void set_yhi ( float to ) ; - inline void set_zhi ( float to ) ; - inline void set_x0 ( float to ) ; // center of spherical expansion - inline void set_y0 ( float to ) ; - inline void set_z0 ( float to ) ; - inline void set_v_temporal_pole ( Vertex to ) ; - inline void set_v_frontal_pole ( Vertex to ) ; - inline void set_v_occipital_pole ( Vertex to ) ; - inline void set_max_curv ( float to ) ; - inline void set_min_curv ( float to ) ; - inline void set_total_area ( float to ) ; - inline void set_avg_vertex_area ( double to ) ; - inline void set_zeros ( int to ) ; - inline void set_hemisphere ( int to ) ; // which hemisphere - inline void set_Hmin ( float to ) ; // min mean curvature - inline void set_Hmax ( float to ) ; // max mean curvature - inline void set_Kmin ( float to ) ; // min Gaussian curvature - inline void set_Kmax ( float to ) ; // max Gaussian curvature - inline void set_Ktotal ( double to ) ; // total Gaussian curvature - inline void set_nlabels ( int to ) ; - inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) - inline void set_vp ( p_void to ) ; // for misc. use - inline void set_alpha ( float to ) ; // rotation around z-axis - inline void set_beta ( float to ) ; // rotation around y-axis - inline void set_gamma ( float to ) ; // rotation around x-axis - inline void set_da ( float to ) ; - inline void set_db ( float to ) ; - inline void set_dg ( float to ) ; // old deltas - inline void set_type ( int to ) ; // what type of surface was this initially - }; + inline void set_strips ( size_t i, STRIP to ) ; + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_x0 ( float to ) ; // center of spherical expansion + inline void set_y0 ( float to ) ; + inline void set_z0 ( float to ) ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + inline void set_v_temporal_pole ( Vertex to ) ; + inline void set_v_frontal_pole ( Vertex to ) ; + inline void set_v_occipital_pole ( Vertex to ) ; + // + inline void set_max_curv ( float to ) ; + inline void set_min_curv ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + inline void set_zeros ( int to ) ; + inline void set_hemisphere ( int to ) ; // which hemisphere + inline void set_Hmin ( float to ) ; // min mean curvature + inline void set_Hmax ( float to ) ; // max mean curvature + inline void set_Kmin ( float to ) ; // min Gaussian curvature + inline void set_Kmax ( float to ) ; // max Gaussian curvature + inline void set_Ktotal ( double to ) ; // total Gaussian curvature + inline void set_nlabels ( int to ) ; + inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) + inline void set_vp ( p_void to ) ; // for misc. use + inline void set_alpha ( float to ) ; // rotation around z-axis + inline void set_beta ( float to ) ; // rotation around y-axis + inline void set_gamma ( float to ) ; // rotation around x-axis + inline void set_da ( float to ) ; + inline void set_db ( float to ) ; + inline void set_dg ( float to ) ; // old deltas + inline void set_type ( int to ) ; // what type of surface was this initially + }; // Surface } // namespace Analysis diff --git a/include/mrisurf_SurfaceFromMRIS_generated_AnalysisM.h b/include/mrisurf_SurfaceFromMRIS_generated_AnalysisM.h index 59e95217693..034c92f5a74 100644 --- a/include/mrisurf_SurfaceFromMRIS_generated_AnalysisM.h +++ b/include/mrisurf_SurfaceFromMRIS_generated_AnalysisM.h @@ -1,28 +1,32 @@ namespace AnalysisM { struct Face : public Repr_Elt { + typedef AnalysisM::Surface Surface; + typedef AnalysisM::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline float area ( ) const ; - inline angles_per_triangle_t angle ( ) const ; - inline angles_per_triangle_t orig_angle ( ) const ; - inline char ripflag ( ) const ; - inline char oripflag ( ) const ; - inline int marked ( ) const ; - inline PDMATRIX norm ( ) const ; - inline A3PDMATRIX gradNorm ( ) const ; + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; + inline PDMATRIX norm ( ) const ; + inline A3PDMATRIX gradNorm ( ) const ; - inline void set_orig_angle ( angles_per_triangle_t to ) ; - inline void set_ripflag ( char to ) ; - inline void set_oripflag ( char to ) ; - inline void set_marked ( int to ) ; - }; + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef AnalysisM::Surface Surface; + typedef AnalysisM::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -31,394 +35,402 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline int e ( size_t i ) const ; // edge state for neighboring vertices - inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops - inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i, - inline short v2num ( ) const ; // number of 1, or 2-hop neighbors - inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors - inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur - inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num - inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc - inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal - inline uchar num ( ) const ; // number of neighboring faces + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces // managed by MRISfreeDists[_orig] and MRISmakeDists[_orig] - inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz - inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz - inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements - inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements // - inline float x ( ) const ; // current coordinates - inline float y ( ) const ; // use MRISsetXYZ() to set - inline float z ( ) const ; + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; // - inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status - inline float origy ( ) const ; // use MRISsetOriginalXYZ(, - inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set // - inline float nx ( ) const ; - inline float ny ( ) const ; - inline float nz ( ) const ; // curr normal - inline float pnx ( ) const ; - inline float pny ( ) const ; - inline float pnz ( ) const ; // pial normal + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float pnx ( ) const ; + inline float pny ( ) const ; + inline float pnz ( ) const ; // pial normal // - inline float wnx ( ) const ; - inline float wny ( ) const ; - inline float wnz ( ) const ; // white normal - inline float onx ( ) const ; - inline float ony ( ) const ; - inline float onz ( ) const ; // original normal - inline float dx ( ) const ; - inline float dy ( ) const ; - inline float dz ( ) const ; // current change in position - inline float odx ( ) const ; - inline float ody ( ) const ; - inline float odz ( ) const ; // last change of position (for momentum, - inline float tdx ( ) const ; - inline float tdy ( ) const ; - inline float tdz ( ) const ; // temporary storage for averaging gradient - inline float curv ( ) const ; // curr curvature - inline float curvbak ( ) const ; - inline float val ( ) const ; // scalar data value (file: rh.val, sig2-rh.w) - inline float imag_val ( ) const ; // imaginary part of complex data value - inline float cx ( ) const ; - inline float cy ( ) const ; - inline float cz ( ) const ; // coordinates in canonical coordinate system - inline float tx ( ) const ; - inline float ty ( ) const ; - inline float tz ( ) const ; // tmp coordinate storage - inline float t2x ( ) const ; - inline float t2y ( ) const ; - inline float t2z ( ) const ; // another tmp coordinate storage - inline float targx ( ) const ; - inline float targy ( ) const ; - inline float targz ( ) const ; // target coordinates - inline float pialx ( ) const ; - inline float pialy ( ) const ; - inline float pialz ( ) const ; // pial surface coordinates - inline float whitex ( ) const ; - inline float whitey ( ) const ; - inline float whitez ( ) const ; // white surface coordinates - inline float l4x ( ) const ; - inline float l4y ( ) const ; - inline float l4z ( ) const ; // layerIV surface coordinates - inline float infx ( ) const ; - inline float infy ( ) const ; - inline float infz ( ) const ; // inflated coordinates - inline float fx ( ) const ; - inline float fy ( ) const ; - inline float fz ( ) const ; // flattened coordinates - inline int px ( ) const ; - inline int qx ( ) const ; - inline int py ( ) const ; - inline int qy ( ) const ; - inline int pz ( ) const ; - inline int qz ( ) const ; // rational coordinates for exact calculations - inline float e1x ( ) const ; - inline float e1y ( ) const ; - inline float e1z ( ) const ; // 1st basis vector for the local tangent plane - inline float e2x ( ) const ; - inline float e2y ( ) const ; - inline float e2z ( ) const ; // 2nd basis vector for the local tangent plane - inline float pe1x ( ) const ; - inline float pe1y ( ) const ; - inline float pe1z ( ) const ; // 1st basis vector for the local tangent plane - inline float pe2x ( ) const ; - inline float pe2y ( ) const ; - inline float pe2z ( ) const ; // 2nd basis vector for the local tangent plane - inline float nc ( ) const ; // curr length normal comp - inline float val2 ( ) const ; // complex comp data value (file: sig3-rh.w) - inline float valbak ( ) const ; // scalar data stack - inline float val2bak ( ) const ; // complex comp data stack - inline float stat ( ) const ; // statistic + inline float wnx ( ) const ; + inline float wny ( ) const ; + inline float wnz ( ) const ; // white normal + inline float onx ( ) const ; + inline float ony ( ) const ; + inline float onz ( ) const ; // original normal + inline float dx ( ) const ; + inline float dy ( ) const ; + inline float dz ( ) const ; // current change in position + inline float odx ( ) const ; + inline float ody ( ) const ; + inline float odz ( ) const ; // last change of position (for momentum, + inline float tdx ( ) const ; + inline float tdy ( ) const ; + inline float tdz ( ) const ; // temporary storage for averaging gradient + inline float curv ( ) const ; // curr curvature + inline float curvbak ( ) const ; + inline float val ( ) const ; // scalar data value (file: rh.val, sig2-rh.w) + inline float imag_val ( ) const ; // imaginary part of complex data value + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float tx ( ) const ; + inline float ty ( ) const ; + inline float tz ( ) const ; // tmp coordinate storage + inline float t2x ( ) const ; + inline float t2y ( ) const ; + inline float t2z ( ) const ; // another tmp coordinate storage + inline float targx ( ) const ; + inline float targy ( ) const ; + inline float targz ( ) const ; // target coordinates + inline float pialx ( ) const ; + inline float pialy ( ) const ; + inline float pialz ( ) const ; // pial surface coordinates + inline float whitex ( ) const ; + inline float whitey ( ) const ; + inline float whitez ( ) const ; // white surface coordinates + inline float l4x ( ) const ; + inline float l4y ( ) const ; + inline float l4z ( ) const ; // layerIV surface coordinates + inline float infx ( ) const ; + inline float infy ( ) const ; + inline float infz ( ) const ; // inflated coordinates + inline float fx ( ) const ; + inline float fy ( ) const ; + inline float fz ( ) const ; // flattened coordinates + inline int px ( ) const ; + inline int qx ( ) const ; + inline int py ( ) const ; + inline int qy ( ) const ; + inline int pz ( ) const ; + inline int qz ( ) const ; // rational coordinates for exact calculations + inline float e1x ( ) const ; + inline float e1y ( ) const ; + inline float e1z ( ) const ; // 1st basis vector for the local tangent plane + inline float e2x ( ) const ; + inline float e2y ( ) const ; + inline float e2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float pe1x ( ) const ; + inline float pe1y ( ) const ; + inline float pe1z ( ) const ; // 1st basis vector for the local tangent plane + inline float pe2x ( ) const ; + inline float pe2y ( ) const ; + inline float pe2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float nc ( ) const ; // curr length normal comp + inline float val2 ( ) const ; // complex comp data value (file: sig3-rh.w) + inline float valbak ( ) const ; // scalar data stack + inline float val2bak ( ) const ; // complex comp data stack + inline float stat ( ) const ; // statistic // - inline int undefval ( ) const ; // [previously dist=0] - inline int old_undefval ( ) const ; // for smooth_val_sparse - inline int fixedval ( ) const ; // [previously val=0] + inline int undefval ( ) const ; // [previously dist=0] + inline int old_undefval ( ) const ; // for smooth_val_sparse + inline int fixedval ( ) const ; // [previously val=0] // - inline float fieldsign ( ) const ; // fieldsign--final: -1, "0", "1" (file: rh.fs) - inline float fsmask ( ) const ; // significance mask (file: rh.fm) - inline float d ( ) const ; // for distance calculations - inline int annotation ( ) const ; // area label (defunct--now from label file name!) - inline char oripflag ( ) const ; - inline char origripflag ( ) const ; // cuts flags - inline p_void vp ( ) const ; // to store user's information - inline float theta ( ) const ; - inline float phi ( ) const ; // parameterization - inline float area ( ) const ; - inline float origarea ( ) const ; - inline float group_avg_area ( ) const ; - inline float K ( ) const ; // Gaussian curvature - inline float H ( ) const ; // mean curvature - inline float k1 ( ) const ; - inline float k2 ( ) const ; // the principal curvatures - inline float mean ( ) const ; - inline float mean_imag ( ) const ; // imaginary part of complex statistic - inline float std_error ( ) const ; - inline uint flags ( ) const ; - inline int fno ( ) const ; // face that this vertex is in - inline int cropped ( ) const ; - inline short marked ( ) const ; // for a variety of uses - inline short marked2 ( ) const ; - inline short marked3 ( ) const ; - inline char neg ( ) const ; // 1 if the normal vector is inverted - inline char border ( ) const ; // flag - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline float fieldsign ( ) const ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline float fsmask ( ) const ; // significance mask (file: rh.fm) + inline float d ( ) const ; // for distance calculations + inline int annotation ( ) const ; // area label (defunct--now from label file name!) + inline char oripflag ( ) const ; + inline char origripflag ( ) const ; // cuts flags + inline p_void vp ( ) const ; // to store user's information + inline float theta ( ) const ; + inline float phi ( ) const ; // parameterization + inline float area ( ) const ; + inline float origarea ( ) const ; + inline float group_avg_area ( ) const ; + inline float K ( ) const ; // Gaussian curvature + inline float H ( ) const ; // mean curvature + inline float k1 ( ) const ; + inline float k2 ( ) const ; // the principal curvatures + inline float mean ( ) const ; + inline float mean_imag ( ) const ; // imaginary part of complex statistic + inline float std_error ( ) const ; + inline uint flags ( ) const ; + inline int fno ( ) const ; // face that this vertex is in + inline int cropped ( ) const ; + inline short marked ( ) const ; // for a variety of uses + inline short marked2 ( ) const ; + inline short marked3 ( ) const ; + inline char neg ( ) const ; // 1 if the normal vector is inverted + inline char border ( ) const ; // flag + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces - inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices // - inline void set_nx ( float to ) ; - inline void set_ny ( float to ) ; - inline void set_nz ( float to ) ; // curr normal - inline void set_pnx ( float to ) ; - inline void set_pny ( float to ) ; - inline void set_pnz ( float to ) ; // pial normal + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_pnx ( float to ) ; + inline void set_pny ( float to ) ; + inline void set_pnz ( float to ) ; // pial normal // - inline void set_wnx ( float to ) ; - inline void set_wny ( float to ) ; - inline void set_wnz ( float to ) ; // white normal - inline void set_onx ( float to ) ; - inline void set_ony ( float to ) ; - inline void set_onz ( float to ) ; // original normal - inline void set_dx ( float to ) ; - inline void set_dy ( float to ) ; - inline void set_dz ( float to ) ; // current change in position - inline void set_odx ( float to ) ; - inline void set_ody ( float to ) ; - inline void set_odz ( float to ) ; // last change of position (for momentum, - inline void set_tdx ( float to ) ; - inline void set_tdy ( float to ) ; - inline void set_tdz ( float to ) ; // temporary storage for averaging gradient - inline void set_curv ( float to ) ; // curr curvature - inline void set_curvbak ( float to ) ; - inline void set_val ( float to ) ; // scalar data value (file: rh.val, sig2-rh.w) - inline void set_imag_val ( float to ) ; // imaginary part of complex data value - inline void set_cx ( float to ) ; - inline void set_cy ( float to ) ; - inline void set_cz ( float to ) ; // coordinates in canonical coordinate system - inline void set_tx ( float to ) ; - inline void set_ty ( float to ) ; - inline void set_tz ( float to ) ; // tmp coordinate storage - inline void set_t2x ( float to ) ; - inline void set_t2y ( float to ) ; - inline void set_t2z ( float to ) ; // another tmp coordinate storage - inline void set_targx ( float to ) ; - inline void set_targy ( float to ) ; - inline void set_targz ( float to ) ; // target coordinates - inline void set_pialx ( float to ) ; - inline void set_pialy ( float to ) ; - inline void set_pialz ( float to ) ; // pial surface coordinates - inline void set_whitex ( float to ) ; - inline void set_whitey ( float to ) ; - inline void set_whitez ( float to ) ; // white surface coordinates - inline void set_l4x ( float to ) ; - inline void set_l4y ( float to ) ; - inline void set_l4z ( float to ) ; // layerIV surface coordinates - inline void set_infx ( float to ) ; - inline void set_infy ( float to ) ; - inline void set_infz ( float to ) ; // inflated coordinates - inline void set_fx ( float to ) ; - inline void set_fy ( float to ) ; - inline void set_fz ( float to ) ; // flattened coordinates - inline void set_px ( int to ) ; - inline void set_qx ( int to ) ; - inline void set_py ( int to ) ; - inline void set_qy ( int to ) ; - inline void set_pz ( int to ) ; - inline void set_qz ( int to ) ; // rational coordinates for exact calculations - inline void set_e1x ( float to ) ; - inline void set_e1y ( float to ) ; - inline void set_e1z ( float to ) ; // 1st basis vector for the local tangent plane - inline void set_e2x ( float to ) ; - inline void set_e2y ( float to ) ; - inline void set_e2z ( float to ) ; // 2nd basis vector for the local tangent plane - inline void set_pe1x ( float to ) ; - inline void set_pe1y ( float to ) ; - inline void set_pe1z ( float to ) ; // 1st basis vector for the local tangent plane - inline void set_pe2x ( float to ) ; - inline void set_pe2y ( float to ) ; - inline void set_pe2z ( float to ) ; // 2nd basis vector for the local tangent plane - inline void set_nc ( float to ) ; // curr length normal comp - inline void set_val2 ( float to ) ; // complex comp data value (file: sig3-rh.w) - inline void set_valbak ( float to ) ; // scalar data stack - inline void set_val2bak ( float to ) ; // complex comp data stack - inline void set_stat ( float to ) ; // statistic + inline void set_wnx ( float to ) ; + inline void set_wny ( float to ) ; + inline void set_wnz ( float to ) ; // white normal + inline void set_onx ( float to ) ; + inline void set_ony ( float to ) ; + inline void set_onz ( float to ) ; // original normal + inline void set_dx ( float to ) ; + inline void set_dy ( float to ) ; + inline void set_dz ( float to ) ; // current change in position + inline void set_odx ( float to ) ; + inline void set_ody ( float to ) ; + inline void set_odz ( float to ) ; // last change of position (for momentum, + inline void set_tdx ( float to ) ; + inline void set_tdy ( float to ) ; + inline void set_tdz ( float to ) ; // temporary storage for averaging gradient + inline void set_curv ( float to ) ; // curr curvature + inline void set_curvbak ( float to ) ; + inline void set_val ( float to ) ; // scalar data value (file: rh.val, sig2-rh.w) + inline void set_imag_val ( float to ) ; // imaginary part of complex data value + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_tx ( float to ) ; + inline void set_ty ( float to ) ; + inline void set_tz ( float to ) ; // tmp coordinate storage + inline void set_t2x ( float to ) ; + inline void set_t2y ( float to ) ; + inline void set_t2z ( float to ) ; // another tmp coordinate storage + inline void set_targx ( float to ) ; + inline void set_targy ( float to ) ; + inline void set_targz ( float to ) ; // target coordinates + inline void set_pialx ( float to ) ; + inline void set_pialy ( float to ) ; + inline void set_pialz ( float to ) ; // pial surface coordinates + inline void set_whitex ( float to ) ; + inline void set_whitey ( float to ) ; + inline void set_whitez ( float to ) ; // white surface coordinates + inline void set_l4x ( float to ) ; + inline void set_l4y ( float to ) ; + inline void set_l4z ( float to ) ; // layerIV surface coordinates + inline void set_infx ( float to ) ; + inline void set_infy ( float to ) ; + inline void set_infz ( float to ) ; // inflated coordinates + inline void set_fx ( float to ) ; + inline void set_fy ( float to ) ; + inline void set_fz ( float to ) ; // flattened coordinates + inline void set_px ( int to ) ; + inline void set_qx ( int to ) ; + inline void set_py ( int to ) ; + inline void set_qy ( int to ) ; + inline void set_pz ( int to ) ; + inline void set_qz ( int to ) ; // rational coordinates for exact calculations + inline void set_e1x ( float to ) ; + inline void set_e1y ( float to ) ; + inline void set_e1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_e2x ( float to ) ; + inline void set_e2y ( float to ) ; + inline void set_e2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_pe1x ( float to ) ; + inline void set_pe1y ( float to ) ; + inline void set_pe1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_pe2x ( float to ) ; + inline void set_pe2y ( float to ) ; + inline void set_pe2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_nc ( float to ) ; // curr length normal comp + inline void set_val2 ( float to ) ; // complex comp data value (file: sig3-rh.w) + inline void set_valbak ( float to ) ; // scalar data stack + inline void set_val2bak ( float to ) ; // complex comp data stack + inline void set_stat ( float to ) ; // statistic // - inline void set_undefval ( int to ) ; // [previously dist=0] - inline void set_old_undefval ( int to ) ; // for smooth_val_sparse - inline void set_fixedval ( int to ) ; // [previously val=0] + inline void set_undefval ( int to ) ; // [previously dist=0] + inline void set_old_undefval ( int to ) ; // for smooth_val_sparse + inline void set_fixedval ( int to ) ; // [previously val=0] // - inline void set_fieldsign ( float to ) ; // fieldsign--final: -1, "0", "1" (file: rh.fs) - inline void set_fsmask ( float to ) ; // significance mask (file: rh.fm) - inline void set_d ( float to ) ; // for distance calculations - inline void set_annotation ( int to ) ; // area label (defunct--now from label file name!) - inline void set_oripflag ( char to ) ; - inline void set_origripflag ( char to ) ; // cuts flags - inline void set_vp ( p_void to ) ; // to store user's information - inline void set_theta ( float to ) ; - inline void set_phi ( float to ) ; // parameterization - inline void set_origarea ( float to ) ; - inline void set_group_avg_area ( float to ) ; - inline void set_K ( float to ) ; // Gaussian curvature - inline void set_H ( float to ) ; // mean curvature - inline void set_k1 ( float to ) ; - inline void set_k2 ( float to ) ; // the principal curvatures - inline void set_mean ( float to ) ; - inline void set_mean_imag ( float to ) ; // imaginary part of complex statistic - inline void set_std_error ( float to ) ; - inline void set_flags ( uint to ) ; - inline void set_fno ( int to ) ; // face that this vertex is in - inline void set_cropped ( int to ) ; - inline void set_marked ( short to ) ; // for a variety of uses - inline void set_marked2 ( short to ) ; - inline void set_marked3 ( short to ) ; - inline void set_neg ( char to ) ; // 1 if the normal vector is inverted - inline void set_border ( char to ) ; // flag - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_fieldsign ( float to ) ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline void set_fsmask ( float to ) ; // significance mask (file: rh.fm) + inline void set_d ( float to ) ; // for distance calculations + inline void set_annotation ( int to ) ; // area label (defunct--now from label file name!) + inline void set_oripflag ( char to ) ; + inline void set_origripflag ( char to ) ; // cuts flags + inline void set_vp ( p_void to ) ; // to store user's information + inline void set_theta ( float to ) ; + inline void set_phi ( float to ) ; // parameterization + inline void set_origarea ( float to ) ; + inline void set_group_avg_area ( float to ) ; + inline void set_K ( float to ) ; // Gaussian curvature + inline void set_H ( float to ) ; // mean curvature + inline void set_k1 ( float to ) ; + inline void set_k2 ( float to ) ; // the principal curvatures + inline void set_mean ( float to ) ; + inline void set_mean_imag ( float to ) ; // imaginary part of complex statistic + inline void set_std_error ( float to ) ; + inline void set_flags ( uint to ) ; + inline void set_fno ( int to ) ; // face that this vertex is in + inline void set_cropped ( int to ) ; + inline void set_marked ( short to ) ; // for a variety of uses + inline void set_marked2 ( short to ) ; + inline void set_marked3 ( short to ) ; + inline void set_neg ( char to ) ; // 1 if the normal vector is inverted + inline void set_border ( char to ) ; // flag + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef AnalysisM::Face Face; + typedef AnalysisM::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); inline Surface ( AllM::Surface const & src ); // Fields being maintained by specialist functions - inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons - inline int nedges ( ) const ; // # of edges on surface - inline int nstrips ( ) const ; - inline Vertex vertices ( size_t i ) const ; - inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored - inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored - inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use - inline Face faces ( size_t i ) const ; - inline MRI_EDGE edges ( size_t i ) const ; - inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; - inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; - inline STRIP strips ( size_t i ) const ; - inline float xctr ( ) const ; - inline float yctr ( ) const ; - inline float zctr ( ) const ; - inline float xlo ( ) const ; - inline float ylo ( ) const ; - inline float zlo ( ) const ; - inline float xhi ( ) const ; - inline float yhi ( ) const ; - inline float zhi ( ) const ; - inline float x0 ( ) const ; // center of spherical expansion - inline float y0 ( ) const ; - inline float z0 ( ) const ; - inline Vertex v_temporal_pole ( ) const ; - inline Vertex v_frontal_pole ( ) const ; - inline Vertex v_occipital_pole ( ) const ; - inline float max_curv ( ) const ; - inline float min_curv ( ) const ; - inline float total_area ( ) const ; - inline double avg_vertex_area ( ) const ; - inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist - inline double std_vertex_dist ( ) const ; - inline float orig_area ( ) const ; - inline float neg_area ( ) const ; - inline float neg_orig_area ( ) const ; // amount of original surface in folds - inline int zeros ( ) const ; - inline int hemisphere ( ) const ; // which hemisphere - inline int initialized ( ) const ; - inline PLTA lta ( ) const ; - inline PMATRIX SRASToTalSRAS_ ( ) const ; - inline PMATRIX TalSRASToSRAS_ ( ) const ; - inline int free_transform ( ) const ; - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline float a ( ) const ; - inline float b ( ) const ; - inline float c ( ) const ; // ellipsoid parameters - inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from - inline float Hmin ( ) const ; // min mean curvature - inline float Hmax ( ) const ; // max mean curvature - inline float Kmin ( ) const ; // min Gaussian curvature - inline float Kmax ( ) const ; // max Gaussian curvature - inline double Ktotal ( ) const ; // total Gaussian curvature - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - inline int patch ( ) const ; // if a patch of the surface - inline int nlabels ( ) const ; - inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) - inline p_void vp ( ) const ; // for misc. use - inline float alpha ( ) const ; // rotation around z-axis - inline float beta ( ) const ; // rotation around y-axis - inline float gamma ( ) const ; // rotation around x-axis - inline float da ( ) const ; - inline float db ( ) const ; - inline float dg ( ) const ; // old deltas - inline int type ( ) const ; // what type of surface was this initially - inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces - inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces - inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject - inline float canon_area ( ) const ; - inline int noscale ( ) const ; // don't scale by surface area if true - inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) - inline float dy2 ( size_t i ) const ; - inline float dz2 ( size_t i ) const ; - inline PCOLOR_TABLE ct ( ) const ; - inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) - inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 - inline MRIS_cmdlines_t cmdlines ( ) const ; - inline int ncmds ( ) const ; - inline float group_avg_surface_area ( ) const ; // average of total surface area for group - inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex - inline int triangle_links_removed ( ) const ; // for quad surfaces - inline p_void user_parms ( ) const ; // for whatever the user wants to hang here - inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel - inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for - inline p_void mht ( ) const ; - inline p_void temps ( ) const ; + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline STRIP strips ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float x0 ( ) const ; // center of spherical expansion + inline float y0 ( ) const ; + inline float z0 ( ) const ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + inline Vertex v_temporal_pole ( ) const ; + inline Vertex v_frontal_pole ( ) const ; + inline Vertex v_occipital_pole ( ) const ; + // + inline float max_curv ( ) const ; + inline float min_curv ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline int zeros ( ) const ; + inline int hemisphere ( ) const ; // which hemisphere + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline float Hmin ( ) const ; // min mean curvature + inline float Hmax ( ) const ; // max mean curvature + inline float Kmin ( ) const ; // min Gaussian curvature + inline float Kmax ( ) const ; // max Gaussian curvature + inline double Ktotal ( ) const ; // total Gaussian curvature + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int nlabels ( ) const ; + inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) + inline p_void vp ( ) const ; // for misc. use + inline float alpha ( ) const ; // rotation around z-axis + inline float beta ( ) const ; // rotation around y-axis + inline float gamma ( ) const ; // rotation around x-axis + inline float da ( ) const ; + inline float db ( ) const ; + inline float dg ( ) const ; // old deltas + inline int type ( ) const ; // what type of surface was this initially + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; - inline void set_strips ( size_t i, STRIP to ) ; - inline void set_xctr ( float to ) ; - inline void set_yctr ( float to ) ; - inline void set_zctr ( float to ) ; - inline void set_xlo ( float to ) ; - inline void set_ylo ( float to ) ; - inline void set_zlo ( float to ) ; - inline void set_xhi ( float to ) ; - inline void set_yhi ( float to ) ; - inline void set_zhi ( float to ) ; - inline void set_x0 ( float to ) ; // center of spherical expansion - inline void set_y0 ( float to ) ; - inline void set_z0 ( float to ) ; - inline void set_v_temporal_pole ( Vertex to ) ; - inline void set_v_frontal_pole ( Vertex to ) ; - inline void set_v_occipital_pole ( Vertex to ) ; - inline void set_max_curv ( float to ) ; - inline void set_min_curv ( float to ) ; - inline void set_total_area ( float to ) ; - inline void set_avg_vertex_area ( double to ) ; - inline void set_zeros ( int to ) ; - inline void set_hemisphere ( int to ) ; // which hemisphere - inline void set_Hmin ( float to ) ; // min mean curvature - inline void set_Hmax ( float to ) ; // max mean curvature - inline void set_Kmin ( float to ) ; // min Gaussian curvature - inline void set_Kmax ( float to ) ; // max Gaussian curvature - inline void set_Ktotal ( double to ) ; // total Gaussian curvature - inline void set_nlabels ( int to ) ; - inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) - inline void set_vp ( p_void to ) ; // for misc. use - inline void set_alpha ( float to ) ; // rotation around z-axis - inline void set_beta ( float to ) ; // rotation around y-axis - inline void set_gamma ( float to ) ; // rotation around x-axis - inline void set_da ( float to ) ; - inline void set_db ( float to ) ; - inline void set_dg ( float to ) ; // old deltas - inline void set_type ( int to ) ; // what type of surface was this initially - }; + inline void set_strips ( size_t i, STRIP to ) ; + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_x0 ( float to ) ; // center of spherical expansion + inline void set_y0 ( float to ) ; + inline void set_z0 ( float to ) ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + inline void set_v_temporal_pole ( Vertex to ) ; + inline void set_v_frontal_pole ( Vertex to ) ; + inline void set_v_occipital_pole ( Vertex to ) ; + // + inline void set_max_curv ( float to ) ; + inline void set_min_curv ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + inline void set_zeros ( int to ) ; + inline void set_hemisphere ( int to ) ; // which hemisphere + inline void set_Hmin ( float to ) ; // min mean curvature + inline void set_Hmax ( float to ) ; // max mean curvature + inline void set_Kmin ( float to ) ; // min Gaussian curvature + inline void set_Kmax ( float to ) ; // max Gaussian curvature + inline void set_Ktotal ( double to ) ; // total Gaussian curvature + inline void set_nlabels ( int to ) ; + inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) + inline void set_vp ( p_void to ) ; // for misc. use + inline void set_alpha ( float to ) ; // rotation around z-axis + inline void set_beta ( float to ) ; // rotation around y-axis + inline void set_gamma ( float to ) ; // rotation around x-axis + inline void set_da ( float to ) ; + inline void set_db ( float to ) ; + inline void set_dg ( float to ) ; // old deltas + inline void set_type ( int to ) ; // what type of surface was this initially + }; // Surface } // namespace AnalysisM diff --git a/include/mrisurf_SurfaceFromMRIS_generated_Distort.h b/include/mrisurf_SurfaceFromMRIS_generated_Distort.h index e31cfb1233f..8ae535bb690 100644 --- a/include/mrisurf_SurfaceFromMRIS_generated_Distort.h +++ b/include/mrisurf_SurfaceFromMRIS_generated_Distort.h @@ -1,5 +1,7 @@ namespace Distort { struct Face : public Repr_Elt { + typedef Distort::Surface Surface; + typedef Distort::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); @@ -8,23 +10,25 @@ inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline float area ( ) const ; - inline angles_per_triangle_t angle ( ) const ; - inline angles_per_triangle_t orig_angle ( ) const ; - inline char ripflag ( ) const ; - inline char oripflag ( ) const ; - inline int marked ( ) const ; - inline PDMATRIX norm ( ) const ; - inline A3PDMATRIX gradNorm ( ) const ; + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; + inline PDMATRIX norm ( ) const ; + inline A3PDMATRIX gradNorm ( ) const ; - inline void set_orig_angle ( angles_per_triangle_t to ) ; - inline void set_ripflag ( char to ) ; - inline void set_oripflag ( char to ) ; - inline void set_marked ( int to ) ; - }; + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef Distort::Surface Surface; + typedef Distort::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -35,260 +39,262 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline int e ( size_t i ) const ; // edge state for neighboring vertices - inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops - inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i, - inline short v2num ( ) const ; // number of 1, or 2-hop neighbors - inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors - inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur - inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num - inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc - inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal - inline uchar num ( ) const ; // number of neighboring faces + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces // managed by MRISfreeDists[_orig] and MRISmakeDists[_orig] - inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz - inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz - inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements - inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements // - inline float x ( ) const ; // current coordinates - inline float y ( ) const ; // use MRISsetXYZ() to set - inline float z ( ) const ; + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; // - inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status - inline float origy ( ) const ; // use MRISsetOriginalXYZ(, - inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set // - inline float nx ( ) const ; - inline float ny ( ) const ; - inline float nz ( ) const ; // curr normal - inline float pnx ( ) const ; - inline float pny ( ) const ; - inline float pnz ( ) const ; // pial normal + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float pnx ( ) const ; + inline float pny ( ) const ; + inline float pnz ( ) const ; // pial normal // - inline float wnx ( ) const ; - inline float wny ( ) const ; - inline float wnz ( ) const ; // white normal - inline float onx ( ) const ; - inline float ony ( ) const ; - inline float onz ( ) const ; // original normal - inline float dx ( ) const ; - inline float dy ( ) const ; - inline float dz ( ) const ; // current change in position - inline float odx ( ) const ; - inline float ody ( ) const ; - inline float odz ( ) const ; // last change of position (for momentum, - inline float tdx ( ) const ; - inline float tdy ( ) const ; - inline float tdz ( ) const ; // temporary storage for averaging gradient - inline float curv ( ) const ; // curr curvature - inline float curvbak ( ) const ; - inline float val ( ) const ; // scalar data value (file: rh.val, sig2-rh.w) - inline float imag_val ( ) const ; // imaginary part of complex data value - inline float cx ( ) const ; - inline float cy ( ) const ; - inline float cz ( ) const ; // coordinates in canonical coordinate system - inline float tx ( ) const ; - inline float ty ( ) const ; - inline float tz ( ) const ; // tmp coordinate storage - inline float t2x ( ) const ; - inline float t2y ( ) const ; - inline float t2z ( ) const ; // another tmp coordinate storage - inline float targx ( ) const ; - inline float targy ( ) const ; - inline float targz ( ) const ; // target coordinates - inline float pialx ( ) const ; - inline float pialy ( ) const ; - inline float pialz ( ) const ; // pial surface coordinates - inline float whitex ( ) const ; - inline float whitey ( ) const ; - inline float whitez ( ) const ; // white surface coordinates - inline float l4x ( ) const ; - inline float l4y ( ) const ; - inline float l4z ( ) const ; // layerIV surface coordinates - inline float infx ( ) const ; - inline float infy ( ) const ; - inline float infz ( ) const ; // inflated coordinates - inline float fx ( ) const ; - inline float fy ( ) const ; - inline float fz ( ) const ; // flattened coordinates - inline int px ( ) const ; - inline int qx ( ) const ; - inline int py ( ) const ; - inline int qy ( ) const ; - inline int pz ( ) const ; - inline int qz ( ) const ; // rational coordinates for exact calculations - inline float e1x ( ) const ; - inline float e1y ( ) const ; - inline float e1z ( ) const ; // 1st basis vector for the local tangent plane - inline float e2x ( ) const ; - inline float e2y ( ) const ; - inline float e2z ( ) const ; // 2nd basis vector for the local tangent plane - inline float pe1x ( ) const ; - inline float pe1y ( ) const ; - inline float pe1z ( ) const ; // 1st basis vector for the local tangent plane - inline float pe2x ( ) const ; - inline float pe2y ( ) const ; - inline float pe2z ( ) const ; // 2nd basis vector for the local tangent plane - inline float nc ( ) const ; // curr length normal comp - inline float val2 ( ) const ; // complex comp data value (file: sig3-rh.w) - inline float valbak ( ) const ; // scalar data stack - inline float val2bak ( ) const ; // complex comp data stack - inline float stat ( ) const ; // statistic + inline float wnx ( ) const ; + inline float wny ( ) const ; + inline float wnz ( ) const ; // white normal + inline float onx ( ) const ; + inline float ony ( ) const ; + inline float onz ( ) const ; // original normal + inline float dx ( ) const ; + inline float dy ( ) const ; + inline float dz ( ) const ; // current change in position + inline float odx ( ) const ; + inline float ody ( ) const ; + inline float odz ( ) const ; // last change of position (for momentum, + inline float tdx ( ) const ; + inline float tdy ( ) const ; + inline float tdz ( ) const ; // temporary storage for averaging gradient + inline float curv ( ) const ; // curr curvature + inline float curvbak ( ) const ; + inline float val ( ) const ; // scalar data value (file: rh.val, sig2-rh.w) + inline float imag_val ( ) const ; // imaginary part of complex data value + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float tx ( ) const ; + inline float ty ( ) const ; + inline float tz ( ) const ; // tmp coordinate storage + inline float t2x ( ) const ; + inline float t2y ( ) const ; + inline float t2z ( ) const ; // another tmp coordinate storage + inline float targx ( ) const ; + inline float targy ( ) const ; + inline float targz ( ) const ; // target coordinates + inline float pialx ( ) const ; + inline float pialy ( ) const ; + inline float pialz ( ) const ; // pial surface coordinates + inline float whitex ( ) const ; + inline float whitey ( ) const ; + inline float whitez ( ) const ; // white surface coordinates + inline float l4x ( ) const ; + inline float l4y ( ) const ; + inline float l4z ( ) const ; // layerIV surface coordinates + inline float infx ( ) const ; + inline float infy ( ) const ; + inline float infz ( ) const ; // inflated coordinates + inline float fx ( ) const ; + inline float fy ( ) const ; + inline float fz ( ) const ; // flattened coordinates + inline int px ( ) const ; + inline int qx ( ) const ; + inline int py ( ) const ; + inline int qy ( ) const ; + inline int pz ( ) const ; + inline int qz ( ) const ; // rational coordinates for exact calculations + inline float e1x ( ) const ; + inline float e1y ( ) const ; + inline float e1z ( ) const ; // 1st basis vector for the local tangent plane + inline float e2x ( ) const ; + inline float e2y ( ) const ; + inline float e2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float pe1x ( ) const ; + inline float pe1y ( ) const ; + inline float pe1z ( ) const ; // 1st basis vector for the local tangent plane + inline float pe2x ( ) const ; + inline float pe2y ( ) const ; + inline float pe2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float nc ( ) const ; // curr length normal comp + inline float val2 ( ) const ; // complex comp data value (file: sig3-rh.w) + inline float valbak ( ) const ; // scalar data stack + inline float val2bak ( ) const ; // complex comp data stack + inline float stat ( ) const ; // statistic // - inline int undefval ( ) const ; // [previously dist=0] - inline int old_undefval ( ) const ; // for smooth_val_sparse - inline int fixedval ( ) const ; // [previously val=0] + inline int undefval ( ) const ; // [previously dist=0] + inline int old_undefval ( ) const ; // for smooth_val_sparse + inline int fixedval ( ) const ; // [previously val=0] // - inline float fieldsign ( ) const ; // fieldsign--final: -1, "0", "1" (file: rh.fs) - inline float fsmask ( ) const ; // significance mask (file: rh.fm) - inline float d ( ) const ; // for distance calculations - inline int annotation ( ) const ; // area label (defunct--now from label file name!) - inline char oripflag ( ) const ; - inline char origripflag ( ) const ; // cuts flags - inline p_void vp ( ) const ; // to store user's information - inline float theta ( ) const ; - inline float phi ( ) const ; // parameterization - inline float area ( ) const ; - inline float origarea ( ) const ; - inline float group_avg_area ( ) const ; - inline float K ( ) const ; // Gaussian curvature - inline float H ( ) const ; // mean curvature - inline float k1 ( ) const ; - inline float k2 ( ) const ; // the principal curvatures - inline float mean ( ) const ; - inline float mean_imag ( ) const ; // imaginary part of complex statistic - inline float std_error ( ) const ; - inline uint flags ( ) const ; - inline int fno ( ) const ; // face that this vertex is in - inline int cropped ( ) const ; - inline short marked ( ) const ; // for a variety of uses - inline short marked2 ( ) const ; - inline short marked3 ( ) const ; - inline char neg ( ) const ; // 1 if the normal vector is inverted - inline char border ( ) const ; // flag - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline float fieldsign ( ) const ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline float fsmask ( ) const ; // significance mask (file: rh.fm) + inline float d ( ) const ; // for distance calculations + inline int annotation ( ) const ; // area label (defunct--now from label file name!) + inline char oripflag ( ) const ; + inline char origripflag ( ) const ; // cuts flags + inline p_void vp ( ) const ; // to store user's information + inline float theta ( ) const ; + inline float phi ( ) const ; // parameterization + inline float area ( ) const ; + inline float origarea ( ) const ; + inline float group_avg_area ( ) const ; + inline float K ( ) const ; // Gaussian curvature + inline float H ( ) const ; // mean curvature + inline float k1 ( ) const ; + inline float k2 ( ) const ; // the principal curvatures + inline float mean ( ) const ; + inline float mean_imag ( ) const ; // imaginary part of complex statistic + inline float std_error ( ) const ; + inline uint flags ( ) const ; + inline int fno ( ) const ; // face that this vertex is in + inline int cropped ( ) const ; + inline short marked ( ) const ; // for a variety of uses + inline short marked2 ( ) const ; + inline short marked3 ( ) const ; + inline char neg ( ) const ; // 1 if the normal vector is inverted + inline char border ( ) const ; // flag + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces - inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices // - inline void set_nx ( float to ) ; - inline void set_ny ( float to ) ; - inline void set_nz ( float to ) ; // curr normal - inline void set_pnx ( float to ) ; - inline void set_pny ( float to ) ; - inline void set_pnz ( float to ) ; // pial normal + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_pnx ( float to ) ; + inline void set_pny ( float to ) ; + inline void set_pnz ( float to ) ; // pial normal // - inline void set_wnx ( float to ) ; - inline void set_wny ( float to ) ; - inline void set_wnz ( float to ) ; // white normal - inline void set_onx ( float to ) ; - inline void set_ony ( float to ) ; - inline void set_onz ( float to ) ; // original normal - inline void set_dx ( float to ) ; - inline void set_dy ( float to ) ; - inline void set_dz ( float to ) ; // current change in position - inline void set_odx ( float to ) ; - inline void set_ody ( float to ) ; - inline void set_odz ( float to ) ; // last change of position (for momentum, - inline void set_tdx ( float to ) ; - inline void set_tdy ( float to ) ; - inline void set_tdz ( float to ) ; // temporary storage for averaging gradient - inline void set_curv ( float to ) ; // curr curvature - inline void set_curvbak ( float to ) ; - inline void set_val ( float to ) ; // scalar data value (file: rh.val, sig2-rh.w) - inline void set_imag_val ( float to ) ; // imaginary part of complex data value - inline void set_cx ( float to ) ; - inline void set_cy ( float to ) ; - inline void set_cz ( float to ) ; // coordinates in canonical coordinate system - inline void set_tx ( float to ) ; - inline void set_ty ( float to ) ; - inline void set_tz ( float to ) ; // tmp coordinate storage - inline void set_t2x ( float to ) ; - inline void set_t2y ( float to ) ; - inline void set_t2z ( float to ) ; // another tmp coordinate storage - inline void set_targx ( float to ) ; - inline void set_targy ( float to ) ; - inline void set_targz ( float to ) ; // target coordinates - inline void set_pialx ( float to ) ; - inline void set_pialy ( float to ) ; - inline void set_pialz ( float to ) ; // pial surface coordinates - inline void set_whitex ( float to ) ; - inline void set_whitey ( float to ) ; - inline void set_whitez ( float to ) ; // white surface coordinates - inline void set_l4x ( float to ) ; - inline void set_l4y ( float to ) ; - inline void set_l4z ( float to ) ; // layerIV surface coordinates - inline void set_infx ( float to ) ; - inline void set_infy ( float to ) ; - inline void set_infz ( float to ) ; // inflated coordinates - inline void set_fx ( float to ) ; - inline void set_fy ( float to ) ; - inline void set_fz ( float to ) ; // flattened coordinates - inline void set_px ( int to ) ; - inline void set_qx ( int to ) ; - inline void set_py ( int to ) ; - inline void set_qy ( int to ) ; - inline void set_pz ( int to ) ; - inline void set_qz ( int to ) ; // rational coordinates for exact calculations - inline void set_e1x ( float to ) ; - inline void set_e1y ( float to ) ; - inline void set_e1z ( float to ) ; // 1st basis vector for the local tangent plane - inline void set_e2x ( float to ) ; - inline void set_e2y ( float to ) ; - inline void set_e2z ( float to ) ; // 2nd basis vector for the local tangent plane - inline void set_pe1x ( float to ) ; - inline void set_pe1y ( float to ) ; - inline void set_pe1z ( float to ) ; // 1st basis vector for the local tangent plane - inline void set_pe2x ( float to ) ; - inline void set_pe2y ( float to ) ; - inline void set_pe2z ( float to ) ; // 2nd basis vector for the local tangent plane - inline void set_nc ( float to ) ; // curr length normal comp - inline void set_val2 ( float to ) ; // complex comp data value (file: sig3-rh.w) - inline void set_valbak ( float to ) ; // scalar data stack - inline void set_val2bak ( float to ) ; // complex comp data stack - inline void set_stat ( float to ) ; // statistic + inline void set_wnx ( float to ) ; + inline void set_wny ( float to ) ; + inline void set_wnz ( float to ) ; // white normal + inline void set_onx ( float to ) ; + inline void set_ony ( float to ) ; + inline void set_onz ( float to ) ; // original normal + inline void set_dx ( float to ) ; + inline void set_dy ( float to ) ; + inline void set_dz ( float to ) ; // current change in position + inline void set_odx ( float to ) ; + inline void set_ody ( float to ) ; + inline void set_odz ( float to ) ; // last change of position (for momentum, + inline void set_tdx ( float to ) ; + inline void set_tdy ( float to ) ; + inline void set_tdz ( float to ) ; // temporary storage for averaging gradient + inline void set_curv ( float to ) ; // curr curvature + inline void set_curvbak ( float to ) ; + inline void set_val ( float to ) ; // scalar data value (file: rh.val, sig2-rh.w) + inline void set_imag_val ( float to ) ; // imaginary part of complex data value + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_tx ( float to ) ; + inline void set_ty ( float to ) ; + inline void set_tz ( float to ) ; // tmp coordinate storage + inline void set_t2x ( float to ) ; + inline void set_t2y ( float to ) ; + inline void set_t2z ( float to ) ; // another tmp coordinate storage + inline void set_targx ( float to ) ; + inline void set_targy ( float to ) ; + inline void set_targz ( float to ) ; // target coordinates + inline void set_pialx ( float to ) ; + inline void set_pialy ( float to ) ; + inline void set_pialz ( float to ) ; // pial surface coordinates + inline void set_whitex ( float to ) ; + inline void set_whitey ( float to ) ; + inline void set_whitez ( float to ) ; // white surface coordinates + inline void set_l4x ( float to ) ; + inline void set_l4y ( float to ) ; + inline void set_l4z ( float to ) ; // layerIV surface coordinates + inline void set_infx ( float to ) ; + inline void set_infy ( float to ) ; + inline void set_infz ( float to ) ; // inflated coordinates + inline void set_fx ( float to ) ; + inline void set_fy ( float to ) ; + inline void set_fz ( float to ) ; // flattened coordinates + inline void set_px ( int to ) ; + inline void set_qx ( int to ) ; + inline void set_py ( int to ) ; + inline void set_qy ( int to ) ; + inline void set_pz ( int to ) ; + inline void set_qz ( int to ) ; // rational coordinates for exact calculations + inline void set_e1x ( float to ) ; + inline void set_e1y ( float to ) ; + inline void set_e1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_e2x ( float to ) ; + inline void set_e2y ( float to ) ; + inline void set_e2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_pe1x ( float to ) ; + inline void set_pe1y ( float to ) ; + inline void set_pe1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_pe2x ( float to ) ; + inline void set_pe2y ( float to ) ; + inline void set_pe2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_nc ( float to ) ; // curr length normal comp + inline void set_val2 ( float to ) ; // complex comp data value (file: sig3-rh.w) + inline void set_valbak ( float to ) ; // scalar data stack + inline void set_val2bak ( float to ) ; // complex comp data stack + inline void set_stat ( float to ) ; // statistic // - inline void set_undefval ( int to ) ; // [previously dist=0] - inline void set_old_undefval ( int to ) ; // for smooth_val_sparse - inline void set_fixedval ( int to ) ; // [previously val=0] + inline void set_undefval ( int to ) ; // [previously dist=0] + inline void set_old_undefval ( int to ) ; // for smooth_val_sparse + inline void set_fixedval ( int to ) ; // [previously val=0] // - inline void set_fieldsign ( float to ) ; // fieldsign--final: -1, "0", "1" (file: rh.fs) - inline void set_fsmask ( float to ) ; // significance mask (file: rh.fm) - inline void set_d ( float to ) ; // for distance calculations - inline void set_annotation ( int to ) ; // area label (defunct--now from label file name!) - inline void set_oripflag ( char to ) ; - inline void set_origripflag ( char to ) ; // cuts flags - inline void set_vp ( p_void to ) ; // to store user's information - inline void set_theta ( float to ) ; - inline void set_phi ( float to ) ; // parameterization - inline void set_origarea ( float to ) ; - inline void set_group_avg_area ( float to ) ; - inline void set_K ( float to ) ; // Gaussian curvature - inline void set_H ( float to ) ; // mean curvature - inline void set_k1 ( float to ) ; - inline void set_k2 ( float to ) ; // the principal curvatures - inline void set_mean ( float to ) ; - inline void set_mean_imag ( float to ) ; // imaginary part of complex statistic - inline void set_std_error ( float to ) ; - inline void set_flags ( uint to ) ; - inline void set_fno ( int to ) ; // face that this vertex is in - inline void set_cropped ( int to ) ; - inline void set_marked ( short to ) ; // for a variety of uses - inline void set_marked2 ( short to ) ; - inline void set_marked3 ( short to ) ; - inline void set_neg ( char to ) ; // 1 if the normal vector is inverted - inline void set_border ( char to ) ; // flag - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_fieldsign ( float to ) ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline void set_fsmask ( float to ) ; // significance mask (file: rh.fm) + inline void set_d ( float to ) ; // for distance calculations + inline void set_annotation ( int to ) ; // area label (defunct--now from label file name!) + inline void set_oripflag ( char to ) ; + inline void set_origripflag ( char to ) ; // cuts flags + inline void set_vp ( p_void to ) ; // to store user's information + inline void set_theta ( float to ) ; + inline void set_phi ( float to ) ; // parameterization + inline void set_origarea ( float to ) ; + inline void set_group_avg_area ( float to ) ; + inline void set_K ( float to ) ; // Gaussian curvature + inline void set_H ( float to ) ; // mean curvature + inline void set_k1 ( float to ) ; + inline void set_k2 ( float to ) ; // the principal curvatures + inline void set_mean ( float to ) ; + inline void set_mean_imag ( float to ) ; // imaginary part of complex statistic + inline void set_std_error ( float to ) ; + inline void set_flags ( uint to ) ; + inline void set_fno ( int to ) ; // face that this vertex is in + inline void set_cropped ( int to ) ; + inline void set_marked ( short to ) ; // for a variety of uses + inline void set_marked2 ( short to ) ; + inline void set_marked3 ( short to ) ; + inline void set_neg ( char to ) ; // 1 if the normal vector is inverted + inline void set_border ( char to ) ; // flag + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef Distort::Face Face; + typedef Distort::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); @@ -297,134 +303,140 @@ inline Surface ( AllM::Surface const & src ); // Fields being maintained by specialist functions - inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons - inline int nedges ( ) const ; // # of edges on surface - inline int nstrips ( ) const ; - inline Vertex vertices ( size_t i ) const ; - inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored - inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored - inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use - inline Face faces ( size_t i ) const ; - inline MRI_EDGE edges ( size_t i ) const ; - inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; - inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; - inline STRIP strips ( size_t i ) const ; - inline float xctr ( ) const ; - inline float yctr ( ) const ; - inline float zctr ( ) const ; - inline float xlo ( ) const ; - inline float ylo ( ) const ; - inline float zlo ( ) const ; - inline float xhi ( ) const ; - inline float yhi ( ) const ; - inline float zhi ( ) const ; - inline float x0 ( ) const ; // center of spherical expansion - inline float y0 ( ) const ; - inline float z0 ( ) const ; - inline Vertex v_temporal_pole ( ) const ; - inline Vertex v_frontal_pole ( ) const ; - inline Vertex v_occipital_pole ( ) const ; - inline float max_curv ( ) const ; - inline float min_curv ( ) const ; - inline float total_area ( ) const ; - inline double avg_vertex_area ( ) const ; - inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist - inline double std_vertex_dist ( ) const ; - inline float orig_area ( ) const ; - inline float neg_area ( ) const ; - inline float neg_orig_area ( ) const ; // amount of original surface in folds - inline int zeros ( ) const ; - inline int hemisphere ( ) const ; // which hemisphere - inline int initialized ( ) const ; - inline PLTA lta ( ) const ; - inline PMATRIX SRASToTalSRAS_ ( ) const ; - inline PMATRIX TalSRASToSRAS_ ( ) const ; - inline int free_transform ( ) const ; - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline float a ( ) const ; - inline float b ( ) const ; - inline float c ( ) const ; // ellipsoid parameters - inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from - inline float Hmin ( ) const ; // min mean curvature - inline float Hmax ( ) const ; // max mean curvature - inline float Kmin ( ) const ; // min Gaussian curvature - inline float Kmax ( ) const ; // max Gaussian curvature - inline double Ktotal ( ) const ; // total Gaussian curvature - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - inline int patch ( ) const ; // if a patch of the surface - inline int nlabels ( ) const ; - inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) - inline p_void vp ( ) const ; // for misc. use - inline float alpha ( ) const ; // rotation around z-axis - inline float beta ( ) const ; // rotation around y-axis - inline float gamma ( ) const ; // rotation around x-axis - inline float da ( ) const ; - inline float db ( ) const ; - inline float dg ( ) const ; // old deltas - inline int type ( ) const ; // what type of surface was this initially - inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces - inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces - inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject - inline float canon_area ( ) const ; - inline int noscale ( ) const ; // don't scale by surface area if true - inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) - inline float dy2 ( size_t i ) const ; - inline float dz2 ( size_t i ) const ; - inline PCOLOR_TABLE ct ( ) const ; - inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) - inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 - inline MRIS_cmdlines_t cmdlines ( ) const ; - inline int ncmds ( ) const ; - inline float group_avg_surface_area ( ) const ; // average of total surface area for group - inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex - inline int triangle_links_removed ( ) const ; // for quad surfaces - inline p_void user_parms ( ) const ; // for whatever the user wants to hang here - inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel - inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for - inline p_void mht ( ) const ; - inline p_void temps ( ) const ; + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline STRIP strips ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float x0 ( ) const ; // center of spherical expansion + inline float y0 ( ) const ; + inline float z0 ( ) const ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + inline Vertex v_temporal_pole ( ) const ; + inline Vertex v_frontal_pole ( ) const ; + inline Vertex v_occipital_pole ( ) const ; + // + inline float max_curv ( ) const ; + inline float min_curv ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline int zeros ( ) const ; + inline int hemisphere ( ) const ; // which hemisphere + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline float Hmin ( ) const ; // min mean curvature + inline float Hmax ( ) const ; // max mean curvature + inline float Kmin ( ) const ; // min Gaussian curvature + inline float Kmax ( ) const ; // max Gaussian curvature + inline double Ktotal ( ) const ; // total Gaussian curvature + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int nlabels ( ) const ; + inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) + inline p_void vp ( ) const ; // for misc. use + inline float alpha ( ) const ; // rotation around z-axis + inline float beta ( ) const ; // rotation around y-axis + inline float gamma ( ) const ; // rotation around x-axis + inline float da ( ) const ; + inline float db ( ) const ; + inline float dg ( ) const ; // old deltas + inline int type ( ) const ; // what type of surface was this initially + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; - inline void set_strips ( size_t i, STRIP to ) ; - inline void set_xctr ( float to ) ; - inline void set_yctr ( float to ) ; - inline void set_zctr ( float to ) ; - inline void set_xlo ( float to ) ; - inline void set_ylo ( float to ) ; - inline void set_zlo ( float to ) ; - inline void set_xhi ( float to ) ; - inline void set_yhi ( float to ) ; - inline void set_zhi ( float to ) ; - inline void set_x0 ( float to ) ; // center of spherical expansion - inline void set_y0 ( float to ) ; - inline void set_z0 ( float to ) ; - inline void set_v_temporal_pole ( Vertex to ) ; - inline void set_v_frontal_pole ( Vertex to ) ; - inline void set_v_occipital_pole ( Vertex to ) ; - inline void set_max_curv ( float to ) ; - inline void set_min_curv ( float to ) ; - inline void set_total_area ( float to ) ; - inline void set_avg_vertex_area ( double to ) ; - inline void set_zeros ( int to ) ; - inline void set_hemisphere ( int to ) ; // which hemisphere - inline void set_Hmin ( float to ) ; // min mean curvature - inline void set_Hmax ( float to ) ; // max mean curvature - inline void set_Kmin ( float to ) ; // min Gaussian curvature - inline void set_Kmax ( float to ) ; // max Gaussian curvature - inline void set_Ktotal ( double to ) ; // total Gaussian curvature - inline void set_nlabels ( int to ) ; - inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) - inline void set_vp ( p_void to ) ; // for misc. use - inline void set_alpha ( float to ) ; // rotation around z-axis - inline void set_beta ( float to ) ; // rotation around y-axis - inline void set_gamma ( float to ) ; // rotation around x-axis - inline void set_da ( float to ) ; - inline void set_db ( float to ) ; - inline void set_dg ( float to ) ; // old deltas - inline void set_type ( int to ) ; // what type of surface was this initially - }; + inline void set_strips ( size_t i, STRIP to ) ; + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_x0 ( float to ) ; // center of spherical expansion + inline void set_y0 ( float to ) ; + inline void set_z0 ( float to ) ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + inline void set_v_temporal_pole ( Vertex to ) ; + inline void set_v_frontal_pole ( Vertex to ) ; + inline void set_v_occipital_pole ( Vertex to ) ; + // + inline void set_max_curv ( float to ) ; + inline void set_min_curv ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + inline void set_zeros ( int to ) ; + inline void set_hemisphere ( int to ) ; // which hemisphere + inline void set_Hmin ( float to ) ; // min mean curvature + inline void set_Hmax ( float to ) ; // max mean curvature + inline void set_Kmin ( float to ) ; // min Gaussian curvature + inline void set_Kmax ( float to ) ; // max Gaussian curvature + inline void set_Ktotal ( double to ) ; // total Gaussian curvature + inline void set_nlabels ( int to ) ; + inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) + inline void set_vp ( p_void to ) ; // for misc. use + inline void set_alpha ( float to ) ; // rotation around z-axis + inline void set_beta ( float to ) ; // rotation around y-axis + inline void set_gamma ( float to ) ; // rotation around x-axis + inline void set_da ( float to ) ; + inline void set_db ( float to ) ; + inline void set_dg ( float to ) ; // old deltas + inline void set_type ( int to ) ; // what type of surface was this initially + }; // Surface } // namespace Distort diff --git a/include/mrisurf_SurfaceFromMRIS_generated_DistortM.h b/include/mrisurf_SurfaceFromMRIS_generated_DistortM.h index ed6ea77d3ff..9a66e440473 100644 --- a/include/mrisurf_SurfaceFromMRIS_generated_DistortM.h +++ b/include/mrisurf_SurfaceFromMRIS_generated_DistortM.h @@ -1,28 +1,32 @@ namespace DistortM { struct Face : public Repr_Elt { + typedef DistortM::Surface Surface; + typedef DistortM::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline float area ( ) const ; - inline angles_per_triangle_t angle ( ) const ; - inline angles_per_triangle_t orig_angle ( ) const ; - inline char ripflag ( ) const ; - inline char oripflag ( ) const ; - inline int marked ( ) const ; - inline PDMATRIX norm ( ) const ; - inline A3PDMATRIX gradNorm ( ) const ; + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; + inline PDMATRIX norm ( ) const ; + inline A3PDMATRIX gradNorm ( ) const ; - inline void set_orig_angle ( angles_per_triangle_t to ) ; - inline void set_ripflag ( char to ) ; - inline void set_oripflag ( char to ) ; - inline void set_marked ( int to ) ; - }; + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef DistortM::Surface Surface; + typedef DistortM::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -31,394 +35,403 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline int e ( size_t i ) const ; // edge state for neighboring vertices - inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops - inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i, - inline short v2num ( ) const ; // number of 1, or 2-hop neighbors - inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors - inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur - inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num - inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc - inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal - inline uchar num ( ) const ; // number of neighboring faces + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces // managed by MRISfreeDists[_orig] and MRISmakeDists[_orig] - inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz - inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz - inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements - inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements // - inline float x ( ) const ; // current coordinates - inline float y ( ) const ; // use MRISsetXYZ() to set - inline float z ( ) const ; + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; // - inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status - inline float origy ( ) const ; // use MRISsetOriginalXYZ(, - inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set // - inline float nx ( ) const ; - inline float ny ( ) const ; - inline float nz ( ) const ; // curr normal - inline float pnx ( ) const ; - inline float pny ( ) const ; - inline float pnz ( ) const ; // pial normal + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float pnx ( ) const ; + inline float pny ( ) const ; + inline float pnz ( ) const ; // pial normal // - inline float wnx ( ) const ; - inline float wny ( ) const ; - inline float wnz ( ) const ; // white normal - inline float onx ( ) const ; - inline float ony ( ) const ; - inline float onz ( ) const ; // original normal - inline float dx ( ) const ; - inline float dy ( ) const ; - inline float dz ( ) const ; // current change in position - inline float odx ( ) const ; - inline float ody ( ) const ; - inline float odz ( ) const ; // last change of position (for momentum, - inline float tdx ( ) const ; - inline float tdy ( ) const ; - inline float tdz ( ) const ; // temporary storage for averaging gradient - inline float curv ( ) const ; // curr curvature - inline float curvbak ( ) const ; - inline float val ( ) const ; // scalar data value (file: rh.val, sig2-rh.w) - inline float imag_val ( ) const ; // imaginary part of complex data value - inline float cx ( ) const ; - inline float cy ( ) const ; - inline float cz ( ) const ; // coordinates in canonical coordinate system - inline float tx ( ) const ; - inline float ty ( ) const ; - inline float tz ( ) const ; // tmp coordinate storage - inline float t2x ( ) const ; - inline float t2y ( ) const ; - inline float t2z ( ) const ; // another tmp coordinate storage - inline float targx ( ) const ; - inline float targy ( ) const ; - inline float targz ( ) const ; // target coordinates - inline float pialx ( ) const ; - inline float pialy ( ) const ; - inline float pialz ( ) const ; // pial surface coordinates - inline float whitex ( ) const ; - inline float whitey ( ) const ; - inline float whitez ( ) const ; // white surface coordinates - inline float l4x ( ) const ; - inline float l4y ( ) const ; - inline float l4z ( ) const ; // layerIV surface coordinates - inline float infx ( ) const ; - inline float infy ( ) const ; - inline float infz ( ) const ; // inflated coordinates - inline float fx ( ) const ; - inline float fy ( ) const ; - inline float fz ( ) const ; // flattened coordinates - inline int px ( ) const ; - inline int qx ( ) const ; - inline int py ( ) const ; - inline int qy ( ) const ; - inline int pz ( ) const ; - inline int qz ( ) const ; // rational coordinates for exact calculations - inline float e1x ( ) const ; - inline float e1y ( ) const ; - inline float e1z ( ) const ; // 1st basis vector for the local tangent plane - inline float e2x ( ) const ; - inline float e2y ( ) const ; - inline float e2z ( ) const ; // 2nd basis vector for the local tangent plane - inline float pe1x ( ) const ; - inline float pe1y ( ) const ; - inline float pe1z ( ) const ; // 1st basis vector for the local tangent plane - inline float pe2x ( ) const ; - inline float pe2y ( ) const ; - inline float pe2z ( ) const ; // 2nd basis vector for the local tangent plane - inline float nc ( ) const ; // curr length normal comp - inline float val2 ( ) const ; // complex comp data value (file: sig3-rh.w) - inline float valbak ( ) const ; // scalar data stack - inline float val2bak ( ) const ; // complex comp data stack - inline float stat ( ) const ; // statistic + inline float wnx ( ) const ; + inline float wny ( ) const ; + inline float wnz ( ) const ; // white normal + inline float onx ( ) const ; + inline float ony ( ) const ; + inline float onz ( ) const ; // original normal + inline float dx ( ) const ; + inline float dy ( ) const ; + inline float dz ( ) const ; // current change in position + inline float odx ( ) const ; + inline float ody ( ) const ; + inline float odz ( ) const ; // last change of position (for momentum, + inline float tdx ( ) const ; + inline float tdy ( ) const ; + inline float tdz ( ) const ; // temporary storage for averaging gradient + inline float curv ( ) const ; // curr curvature + inline float curvbak ( ) const ; + inline float val ( ) const ; // scalar data value (file: rh.val, sig2-rh.w) + inline float imag_val ( ) const ; // imaginary part of complex data value + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float tx ( ) const ; + inline float ty ( ) const ; + inline float tz ( ) const ; // tmp coordinate storage + inline float t2x ( ) const ; + inline float t2y ( ) const ; + inline float t2z ( ) const ; // another tmp coordinate storage + inline float targx ( ) const ; + inline float targy ( ) const ; + inline float targz ( ) const ; // target coordinates + inline float pialx ( ) const ; + inline float pialy ( ) const ; + inline float pialz ( ) const ; // pial surface coordinates + inline float whitex ( ) const ; + inline float whitey ( ) const ; + inline float whitez ( ) const ; // white surface coordinates + inline float l4x ( ) const ; + inline float l4y ( ) const ; + inline float l4z ( ) const ; // layerIV surface coordinates + inline float infx ( ) const ; + inline float infy ( ) const ; + inline float infz ( ) const ; // inflated coordinates + inline float fx ( ) const ; + inline float fy ( ) const ; + inline float fz ( ) const ; // flattened coordinates + inline int px ( ) const ; + inline int qx ( ) const ; + inline int py ( ) const ; + inline int qy ( ) const ; + inline int pz ( ) const ; + inline int qz ( ) const ; // rational coordinates for exact calculations + inline float e1x ( ) const ; + inline float e1y ( ) const ; + inline float e1z ( ) const ; // 1st basis vector for the local tangent plane + inline float e2x ( ) const ; + inline float e2y ( ) const ; + inline float e2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float pe1x ( ) const ; + inline float pe1y ( ) const ; + inline float pe1z ( ) const ; // 1st basis vector for the local tangent plane + inline float pe2x ( ) const ; + inline float pe2y ( ) const ; + inline float pe2z ( ) const ; // 2nd basis vector for the local tangent plane + inline float nc ( ) const ; // curr length normal comp + inline float val2 ( ) const ; // complex comp data value (file: sig3-rh.w) + inline float valbak ( ) const ; // scalar data stack + inline float val2bak ( ) const ; // complex comp data stack + inline float stat ( ) const ; // statistic // - inline int undefval ( ) const ; // [previously dist=0] - inline int old_undefval ( ) const ; // for smooth_val_sparse - inline int fixedval ( ) const ; // [previously val=0] + inline int undefval ( ) const ; // [previously dist=0] + inline int old_undefval ( ) const ; // for smooth_val_sparse + inline int fixedval ( ) const ; // [previously val=0] // - inline float fieldsign ( ) const ; // fieldsign--final: -1, "0", "1" (file: rh.fs) - inline float fsmask ( ) const ; // significance mask (file: rh.fm) - inline float d ( ) const ; // for distance calculations - inline int annotation ( ) const ; // area label (defunct--now from label file name!) - inline char oripflag ( ) const ; - inline char origripflag ( ) const ; // cuts flags - inline p_void vp ( ) const ; // to store user's information - inline float theta ( ) const ; - inline float phi ( ) const ; // parameterization - inline float area ( ) const ; - inline float origarea ( ) const ; - inline float group_avg_area ( ) const ; - inline float K ( ) const ; // Gaussian curvature - inline float H ( ) const ; // mean curvature - inline float k1 ( ) const ; - inline float k2 ( ) const ; // the principal curvatures - inline float mean ( ) const ; - inline float mean_imag ( ) const ; // imaginary part of complex statistic - inline float std_error ( ) const ; - inline uint flags ( ) const ; - inline int fno ( ) const ; // face that this vertex is in - inline int cropped ( ) const ; - inline short marked ( ) const ; // for a variety of uses - inline short marked2 ( ) const ; - inline short marked3 ( ) const ; - inline char neg ( ) const ; // 1 if the normal vector is inverted - inline char border ( ) const ; // flag - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline float fieldsign ( ) const ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline float fsmask ( ) const ; // significance mask (file: rh.fm) + inline float d ( ) const ; // for distance calculations + inline int annotation ( ) const ; // area label (defunct--now from label file name!) + inline char oripflag ( ) const ; + inline char origripflag ( ) const ; // cuts flags + inline p_void vp ( ) const ; // to store user's information + inline float theta ( ) const ; + inline float phi ( ) const ; // parameterization + inline float area ( ) const ; + inline float origarea ( ) const ; + inline float group_avg_area ( ) const ; + inline float K ( ) const ; // Gaussian curvature + inline float H ( ) const ; // mean curvature + inline float k1 ( ) const ; + inline float k2 ( ) const ; // the principal curvatures + inline float mean ( ) const ; + inline float mean_imag ( ) const ; // imaginary part of complex statistic + inline float std_error ( ) const ; + inline uint flags ( ) const ; + inline int fno ( ) const ; // face that this vertex is in + inline int cropped ( ) const ; + inline short marked ( ) const ; // for a variety of uses + inline short marked2 ( ) const ; + inline short marked3 ( ) const ; + inline char neg ( ) const ; // 1 if the normal vector is inverted + inline char border ( ) const ; // flag + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces - inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices // - inline void set_nx ( float to ) ; - inline void set_ny ( float to ) ; - inline void set_nz ( float to ) ; // curr normal - inline void set_pnx ( float to ) ; - inline void set_pny ( float to ) ; - inline void set_pnz ( float to ) ; // pial normal + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_pnx ( float to ) ; + inline void set_pny ( float to ) ; + inline void set_pnz ( float to ) ; // pial normal // - inline void set_wnx ( float to ) ; - inline void set_wny ( float to ) ; - inline void set_wnz ( float to ) ; // white normal - inline void set_onx ( float to ) ; - inline void set_ony ( float to ) ; - inline void set_onz ( float to ) ; // original normal - inline void set_dx ( float to ) ; - inline void set_dy ( float to ) ; - inline void set_dz ( float to ) ; // current change in position - inline void set_odx ( float to ) ; - inline void set_ody ( float to ) ; - inline void set_odz ( float to ) ; // last change of position (for momentum, - inline void set_tdx ( float to ) ; - inline void set_tdy ( float to ) ; - inline void set_tdz ( float to ) ; // temporary storage for averaging gradient - inline void set_curv ( float to ) ; // curr curvature - inline void set_curvbak ( float to ) ; - inline void set_val ( float to ) ; // scalar data value (file: rh.val, sig2-rh.w) - inline void set_imag_val ( float to ) ; // imaginary part of complex data value - inline void set_cx ( float to ) ; - inline void set_cy ( float to ) ; - inline void set_cz ( float to ) ; // coordinates in canonical coordinate system - inline void set_tx ( float to ) ; - inline void set_ty ( float to ) ; - inline void set_tz ( float to ) ; // tmp coordinate storage - inline void set_t2x ( float to ) ; - inline void set_t2y ( float to ) ; - inline void set_t2z ( float to ) ; // another tmp coordinate storage - inline void set_targx ( float to ) ; - inline void set_targy ( float to ) ; - inline void set_targz ( float to ) ; // target coordinates - inline void set_pialx ( float to ) ; - inline void set_pialy ( float to ) ; - inline void set_pialz ( float to ) ; // pial surface coordinates - inline void set_whitex ( float to ) ; - inline void set_whitey ( float to ) ; - inline void set_whitez ( float to ) ; // white surface coordinates - inline void set_l4x ( float to ) ; - inline void set_l4y ( float to ) ; - inline void set_l4z ( float to ) ; // layerIV surface coordinates - inline void set_infx ( float to ) ; - inline void set_infy ( float to ) ; - inline void set_infz ( float to ) ; // inflated coordinates - inline void set_fx ( float to ) ; - inline void set_fy ( float to ) ; - inline void set_fz ( float to ) ; // flattened coordinates - inline void set_px ( int to ) ; - inline void set_qx ( int to ) ; - inline void set_py ( int to ) ; - inline void set_qy ( int to ) ; - inline void set_pz ( int to ) ; - inline void set_qz ( int to ) ; // rational coordinates for exact calculations - inline void set_e1x ( float to ) ; - inline void set_e1y ( float to ) ; - inline void set_e1z ( float to ) ; // 1st basis vector for the local tangent plane - inline void set_e2x ( float to ) ; - inline void set_e2y ( float to ) ; - inline void set_e2z ( float to ) ; // 2nd basis vector for the local tangent plane - inline void set_pe1x ( float to ) ; - inline void set_pe1y ( float to ) ; - inline void set_pe1z ( float to ) ; // 1st basis vector for the local tangent plane - inline void set_pe2x ( float to ) ; - inline void set_pe2y ( float to ) ; - inline void set_pe2z ( float to ) ; // 2nd basis vector for the local tangent plane - inline void set_nc ( float to ) ; // curr length normal comp - inline void set_val2 ( float to ) ; // complex comp data value (file: sig3-rh.w) - inline void set_valbak ( float to ) ; // scalar data stack - inline void set_val2bak ( float to ) ; // complex comp data stack - inline void set_stat ( float to ) ; // statistic + inline void set_wnx ( float to ) ; + inline void set_wny ( float to ) ; + inline void set_wnz ( float to ) ; // white normal + inline void set_onx ( float to ) ; + inline void set_ony ( float to ) ; + inline void set_onz ( float to ) ; // original normal + inline void set_dx ( float to ) ; + inline void set_dy ( float to ) ; + inline void set_dz ( float to ) ; // current change in position + inline void set_odx ( float to ) ; + inline void set_ody ( float to ) ; + inline void set_odz ( float to ) ; // last change of position (for momentum, + inline void set_tdx ( float to ) ; + inline void set_tdy ( float to ) ; + inline void set_tdz ( float to ) ; // temporary storage for averaging gradient + inline void set_curv ( float to ) ; // curr curvature + inline void set_curvbak ( float to ) ; + inline void set_val ( float to ) ; // scalar data value (file: rh.val, sig2-rh.w) + inline void set_imag_val ( float to ) ; // imaginary part of complex data value + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_tx ( float to ) ; + inline void set_ty ( float to ) ; + inline void set_tz ( float to ) ; // tmp coordinate storage + inline void set_t2x ( float to ) ; + inline void set_t2y ( float to ) ; + inline void set_t2z ( float to ) ; // another tmp coordinate storage + inline void set_targx ( float to ) ; + inline void set_targy ( float to ) ; + inline void set_targz ( float to ) ; // target coordinates + inline void set_pialx ( float to ) ; + inline void set_pialy ( float to ) ; + inline void set_pialz ( float to ) ; // pial surface coordinates + inline void set_whitex ( float to ) ; + inline void set_whitey ( float to ) ; + inline void set_whitez ( float to ) ; // white surface coordinates + inline void set_l4x ( float to ) ; + inline void set_l4y ( float to ) ; + inline void set_l4z ( float to ) ; // layerIV surface coordinates + inline void set_infx ( float to ) ; + inline void set_infy ( float to ) ; + inline void set_infz ( float to ) ; // inflated coordinates + inline void set_fx ( float to ) ; + inline void set_fy ( float to ) ; + inline void set_fz ( float to ) ; // flattened coordinates + inline void set_px ( int to ) ; + inline void set_qx ( int to ) ; + inline void set_py ( int to ) ; + inline void set_qy ( int to ) ; + inline void set_pz ( int to ) ; + inline void set_qz ( int to ) ; // rational coordinates for exact calculations + inline void set_e1x ( float to ) ; + inline void set_e1y ( float to ) ; + inline void set_e1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_e2x ( float to ) ; + inline void set_e2y ( float to ) ; + inline void set_e2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_pe1x ( float to ) ; + inline void set_pe1y ( float to ) ; + inline void set_pe1z ( float to ) ; // 1st basis vector for the local tangent plane + inline void set_pe2x ( float to ) ; + inline void set_pe2y ( float to ) ; + inline void set_pe2z ( float to ) ; // 2nd basis vector for the local tangent plane + inline void set_nc ( float to ) ; // curr length normal comp + inline void set_val2 ( float to ) ; // complex comp data value (file: sig3-rh.w) + inline void set_valbak ( float to ) ; // scalar data stack + inline void set_val2bak ( float to ) ; // complex comp data stack + inline void set_stat ( float to ) ; // statistic // - inline void set_undefval ( int to ) ; // [previously dist=0] - inline void set_old_undefval ( int to ) ; // for smooth_val_sparse - inline void set_fixedval ( int to ) ; // [previously val=0] + inline void set_undefval ( int to ) ; // [previously dist=0] + inline void set_old_undefval ( int to ) ; // for smooth_val_sparse + inline void set_fixedval ( int to ) ; // [previously val=0] // - inline void set_fieldsign ( float to ) ; // fieldsign--final: -1, "0", "1" (file: rh.fs) - inline void set_fsmask ( float to ) ; // significance mask (file: rh.fm) - inline void set_d ( float to ) ; // for distance calculations - inline void set_annotation ( int to ) ; // area label (defunct--now from label file name!) - inline void set_oripflag ( char to ) ; - inline void set_origripflag ( char to ) ; // cuts flags - inline void set_vp ( p_void to ) ; // to store user's information - inline void set_theta ( float to ) ; - inline void set_phi ( float to ) ; // parameterization - inline void set_origarea ( float to ) ; - inline void set_group_avg_area ( float to ) ; - inline void set_K ( float to ) ; // Gaussian curvature - inline void set_H ( float to ) ; // mean curvature - inline void set_k1 ( float to ) ; - inline void set_k2 ( float to ) ; // the principal curvatures - inline void set_mean ( float to ) ; - inline void set_mean_imag ( float to ) ; // imaginary part of complex statistic - inline void set_std_error ( float to ) ; - inline void set_flags ( uint to ) ; - inline void set_fno ( int to ) ; // face that this vertex is in - inline void set_cropped ( int to ) ; - inline void set_marked ( short to ) ; // for a variety of uses - inline void set_marked2 ( short to ) ; - inline void set_marked3 ( short to ) ; - inline void set_neg ( char to ) ; // 1 if the normal vector is inverted - inline void set_border ( char to ) ; // flag - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_fieldsign ( float to ) ; // fieldsign--final: -1, "0", "1" (file: rh.fs) + inline void set_fsmask ( float to ) ; // significance mask (file: rh.fm) + inline void set_d ( float to ) ; // for distance calculations + inline void set_annotation ( int to ) ; // area label (defunct--now from label file name!) + inline void set_oripflag ( char to ) ; + inline void set_origripflag ( char to ) ; // cuts flags + inline void set_vp ( p_void to ) ; // to store user's information + inline void set_theta ( float to ) ; + inline void set_phi ( float to ) ; // parameterization + inline void set_origarea ( float to ) ; + inline void set_group_avg_area ( float to ) ; + inline void set_K ( float to ) ; // Gaussian curvature + inline void set_H ( float to ) ; // mean curvature + inline void set_k1 ( float to ) ; + inline void set_k2 ( float to ) ; // the principal curvatures + inline void set_mean ( float to ) ; + inline void set_mean_imag ( float to ) ; // imaginary part of complex statistic + inline void set_std_error ( float to ) ; + inline void set_flags ( uint to ) ; + inline void set_fno ( int to ) ; // face that this vertex is in + inline void set_cropped ( int to ) ; + inline void set_marked ( short to ) ; // for a variety of uses + inline void set_marked2 ( short to ) ; + inline void set_marked3 ( short to ) ; + inline void set_neg ( char to ) ; // 1 if the normal vector is inverted + inline void set_border ( char to ) ; // flag + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { - inline Surface ( ); - inline Surface ( Surface const & src ); - inline Surface ( Representation* representation ); - inline Surface ( AllM::Surface const & src ); + typedef DistortM::Face Face; + typedef DistortM::Vertex Vertex; + inline Surface ( ); + inline Surface ( Surface const & src ); + inline Surface ( Representation* representation ); + inline Surface ( AllM::Surface const & src ); + void freeDistsButNotOrig() { MRISfreeDistsButNotOrig(repr); } // Fields being maintained by specialist functions - inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons - inline int nedges ( ) const ; // # of edges on surface - inline int nstrips ( ) const ; - inline Vertex vertices ( size_t i ) const ; - inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored - inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored - inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use - inline Face faces ( size_t i ) const ; - inline MRI_EDGE edges ( size_t i ) const ; - inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; - inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; - inline STRIP strips ( size_t i ) const ; - inline float xctr ( ) const ; - inline float yctr ( ) const ; - inline float zctr ( ) const ; - inline float xlo ( ) const ; - inline float ylo ( ) const ; - inline float zlo ( ) const ; - inline float xhi ( ) const ; - inline float yhi ( ) const ; - inline float zhi ( ) const ; - inline float x0 ( ) const ; // center of spherical expansion - inline float y0 ( ) const ; - inline float z0 ( ) const ; - inline Vertex v_temporal_pole ( ) const ; - inline Vertex v_frontal_pole ( ) const ; - inline Vertex v_occipital_pole ( ) const ; - inline float max_curv ( ) const ; - inline float min_curv ( ) const ; - inline float total_area ( ) const ; - inline double avg_vertex_area ( ) const ; - inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist - inline double std_vertex_dist ( ) const ; - inline float orig_area ( ) const ; - inline float neg_area ( ) const ; - inline float neg_orig_area ( ) const ; // amount of original surface in folds - inline int zeros ( ) const ; - inline int hemisphere ( ) const ; // which hemisphere - inline int initialized ( ) const ; - inline PLTA lta ( ) const ; - inline PMATRIX SRASToTalSRAS_ ( ) const ; - inline PMATRIX TalSRASToSRAS_ ( ) const ; - inline int free_transform ( ) const ; - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline float a ( ) const ; - inline float b ( ) const ; - inline float c ( ) const ; // ellipsoid parameters - inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from - inline float Hmin ( ) const ; // min mean curvature - inline float Hmax ( ) const ; // max mean curvature - inline float Kmin ( ) const ; // min Gaussian curvature - inline float Kmax ( ) const ; // max Gaussian curvature - inline double Ktotal ( ) const ; // total Gaussian curvature - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - inline int patch ( ) const ; // if a patch of the surface - inline int nlabels ( ) const ; - inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) - inline p_void vp ( ) const ; // for misc. use - inline float alpha ( ) const ; // rotation around z-axis - inline float beta ( ) const ; // rotation around y-axis - inline float gamma ( ) const ; // rotation around x-axis - inline float da ( ) const ; - inline float db ( ) const ; - inline float dg ( ) const ; // old deltas - inline int type ( ) const ; // what type of surface was this initially - inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces - inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces - inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject - inline float canon_area ( ) const ; - inline int noscale ( ) const ; // don't scale by surface area if true - inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) - inline float dy2 ( size_t i ) const ; - inline float dz2 ( size_t i ) const ; - inline PCOLOR_TABLE ct ( ) const ; - inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) - inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 - inline MRIS_cmdlines_t cmdlines ( ) const ; - inline int ncmds ( ) const ; - inline float group_avg_surface_area ( ) const ; // average of total surface area for group - inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex - inline int triangle_links_removed ( ) const ; // for quad surfaces - inline p_void user_parms ( ) const ; // for whatever the user wants to hang here - inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel - inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for - inline p_void mht ( ) const ; - inline p_void temps ( ) const ; + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline STRIP strips ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float x0 ( ) const ; // center of spherical expansion + inline float y0 ( ) const ; + inline float z0 ( ) const ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + inline Vertex v_temporal_pole ( ) const ; + inline Vertex v_frontal_pole ( ) const ; + inline Vertex v_occipital_pole ( ) const ; + // + inline float max_curv ( ) const ; + inline float min_curv ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline int zeros ( ) const ; + inline int hemisphere ( ) const ; // which hemisphere + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline float Hmin ( ) const ; // min mean curvature + inline float Hmax ( ) const ; // max mean curvature + inline float Kmin ( ) const ; // min Gaussian curvature + inline float Kmax ( ) const ; // max Gaussian curvature + inline double Ktotal ( ) const ; // total Gaussian curvature + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int nlabels ( ) const ; + inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) + inline p_void vp ( ) const ; // for misc. use + inline float alpha ( ) const ; // rotation around z-axis + inline float beta ( ) const ; // rotation around y-axis + inline float gamma ( ) const ; // rotation around x-axis + inline float da ( ) const ; + inline float db ( ) const ; + inline float dg ( ) const ; // old deltas + inline int type ( ) const ; // what type of surface was this initially + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; - inline void set_strips ( size_t i, STRIP to ) ; - inline void set_xctr ( float to ) ; - inline void set_yctr ( float to ) ; - inline void set_zctr ( float to ) ; - inline void set_xlo ( float to ) ; - inline void set_ylo ( float to ) ; - inline void set_zlo ( float to ) ; - inline void set_xhi ( float to ) ; - inline void set_yhi ( float to ) ; - inline void set_zhi ( float to ) ; - inline void set_x0 ( float to ) ; // center of spherical expansion - inline void set_y0 ( float to ) ; - inline void set_z0 ( float to ) ; - inline void set_v_temporal_pole ( Vertex to ) ; - inline void set_v_frontal_pole ( Vertex to ) ; - inline void set_v_occipital_pole ( Vertex to ) ; - inline void set_max_curv ( float to ) ; - inline void set_min_curv ( float to ) ; - inline void set_total_area ( float to ) ; - inline void set_avg_vertex_area ( double to ) ; - inline void set_zeros ( int to ) ; - inline void set_hemisphere ( int to ) ; // which hemisphere - inline void set_Hmin ( float to ) ; // min mean curvature - inline void set_Hmax ( float to ) ; // max mean curvature - inline void set_Kmin ( float to ) ; // min Gaussian curvature - inline void set_Kmax ( float to ) ; // max Gaussian curvature - inline void set_Ktotal ( double to ) ; // total Gaussian curvature - inline void set_nlabels ( int to ) ; - inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) - inline void set_vp ( p_void to ) ; // for misc. use - inline void set_alpha ( float to ) ; // rotation around z-axis - inline void set_beta ( float to ) ; // rotation around y-axis - inline void set_gamma ( float to ) ; // rotation around x-axis - inline void set_da ( float to ) ; - inline void set_db ( float to ) ; - inline void set_dg ( float to ) ; // old deltas - inline void set_type ( int to ) ; // what type of surface was this initially - }; + inline void set_strips ( size_t i, STRIP to ) ; + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_x0 ( float to ) ; // center of spherical expansion + inline void set_y0 ( float to ) ; + inline void set_z0 ( float to ) ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + inline void set_v_temporal_pole ( Vertex to ) ; + inline void set_v_frontal_pole ( Vertex to ) ; + inline void set_v_occipital_pole ( Vertex to ) ; + // + inline void set_max_curv ( float to ) ; + inline void set_min_curv ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + inline void set_zeros ( int to ) ; + inline void set_hemisphere ( int to ) ; // which hemisphere + inline void set_Hmin ( float to ) ; // min mean curvature + inline void set_Hmax ( float to ) ; // max mean curvature + inline void set_Kmin ( float to ) ; // min Gaussian curvature + inline void set_Kmax ( float to ) ; // max Gaussian curvature + inline void set_Ktotal ( double to ) ; // total Gaussian curvature + inline void set_nlabels ( int to ) ; + inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) + inline void set_vp ( p_void to ) ; // for misc. use + inline void set_alpha ( float to ) ; // rotation around z-axis + inline void set_beta ( float to ) ; // rotation around y-axis + inline void set_gamma ( float to ) ; // rotation around x-axis + inline void set_da ( float to ) ; + inline void set_db ( float to ) ; + inline void set_dg ( float to ) ; // old deltas + inline void set_type ( int to ) ; // what type of surface was this initially + }; // Surface } // namespace DistortM diff --git a/include/mrisurf_SurfaceFromMRIS_generated_Existence.h b/include/mrisurf_SurfaceFromMRIS_generated_Existence.h index a0a7db4c105..ac183f076d8 100644 --- a/include/mrisurf_SurfaceFromMRIS_generated_Existence.h +++ b/include/mrisurf_SurfaceFromMRIS_generated_Existence.h @@ -1,5 +1,7 @@ namespace Existence { struct Face : public Repr_Elt { + typedef Existence::Surface Surface; + typedef Existence::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); @@ -16,16 +18,18 @@ inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline char ripflag ( ) const ; - inline char oripflag ( ) const ; - inline int marked ( ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; - inline void set_ripflag ( char to ) ; - inline void set_oripflag ( char to ) ; - inline void set_marked ( int to ) ; - }; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef Existence::Surface Surface; + typedef Existence::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -42,13 +46,15 @@ inline Vertex ( AllM::Vertex const & src ); int vno () const { return idx; } - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache inline void which_coords (int which, float *x, float *y, float *z) const ; - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef Existence::Face Face; + typedef Existence::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); @@ -98,6 +104,6 @@ inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for inline p_void mht ( ) const ; inline p_void temps ( ) const ; - }; + }; // Surface } // namespace Existence diff --git a/include/mrisurf_SurfaceFromMRIS_generated_ExistenceM.h b/include/mrisurf_SurfaceFromMRIS_generated_ExistenceM.h index 7a322b18d39..85e2528e9cb 100644 --- a/include/mrisurf_SurfaceFromMRIS_generated_ExistenceM.h +++ b/include/mrisurf_SurfaceFromMRIS_generated_ExistenceM.h @@ -1,78 +1,84 @@ namespace ExistenceM { struct Face : public Repr_Elt { + typedef ExistenceM::Surface Surface; + typedef ExistenceM::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline char ripflag ( ) const ; - inline char oripflag ( ) const ; - inline int marked ( ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; - inline void set_ripflag ( char to ) ; - inline void set_oripflag ( char to ) ; - inline void set_marked ( int to ) ; - }; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef ExistenceM::Surface Surface; + typedef ExistenceM::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); inline Vertex ( AllM::Vertex const & src ); int vno () const { return idx; } - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache inline void which_coords (int which, float *x, float *y, float *z) const ; - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef ExistenceM::Face Face; + typedef ExistenceM::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); inline Surface ( AllM::Surface const & src ); - inline int initialized ( ) const ; - inline PLTA lta ( ) const ; - inline PMATRIX SRASToTalSRAS_ ( ) const ; - inline PMATRIX TalSRASToSRAS_ ( ) const ; - inline int free_transform ( ) const ; - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline float a ( ) const ; - inline float b ( ) const ; - inline float c ( ) const ; // ellipsoid parameters - inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - inline int patch ( ) const ; // if a patch of the surface - inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces - inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces - inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject - inline float canon_area ( ) const ; - inline int noscale ( ) const ; // don't scale by surface area if true - inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) - inline float dy2 ( size_t i ) const ; - inline float dz2 ( size_t i ) const ; - inline PCOLOR_TABLE ct ( ) const ; - inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) - inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 - inline MRIS_cmdlines_t cmdlines ( ) const ; - inline int ncmds ( ) const ; - inline float group_avg_surface_area ( ) const ; // average of total surface area for group - inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex - inline int triangle_links_removed ( ) const ; // for quad surfaces - inline p_void user_parms ( ) const ; // for whatever the user wants to hang here - inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel - inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for - inline p_void mht ( ) const ; - inline p_void temps ( ) const ; + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; - inline void set_fname ( MRIS_fname_t to ) ; // file it was originally loaded from - inline void set_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) - inline void set_origxyz_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - inline void set_patch ( int to ) ; // if a patch of the surface - }; + inline void set_fname ( MRIS_fname_t to ) ; // file it was originally loaded from + inline void set_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) + inline void set_origxyz_status ( MRIS_Status to ) ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline void set_patch ( int to ) ; // if a patch of the surface + }; // Surface } // namespace ExistenceM diff --git a/include/mrisurf_SurfaceFromMRIS_generated_Topology.h b/include/mrisurf_SurfaceFromMRIS_generated_Topology.h index 5d54ff32a21..faeac330e67 100644 --- a/include/mrisurf_SurfaceFromMRIS_generated_Topology.h +++ b/include/mrisurf_SurfaceFromMRIS_generated_Topology.h @@ -1,5 +1,7 @@ namespace Topology { struct Face : public Repr_Elt { + typedef Topology::Surface Surface; + typedef Topology::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); @@ -14,17 +16,19 @@ inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline char ripflag ( ) const ; - inline char oripflag ( ) const ; - inline int marked ( ) const ; + inline Vertex v ( size_t i ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; - inline void set_ripflag ( char to ) ; - inline void set_oripflag ( char to ) ; - inline void set_marked ( int to ) ; - }; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef Topology::Surface Surface; + typedef Topology::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -41,30 +45,32 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline int e ( size_t i ) const ; // edge state for neighboring vertices - inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops - inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i, - inline short v2num ( ) const ; // number of 1, or 2-hop neighbors - inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors - inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur - inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num - inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc - inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal - inline uchar num ( ) const ; // number of neighboring faces - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces - inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef Topology::Face Face; + typedef Topology::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); @@ -84,6 +90,7 @@ inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners inline int nstrips ( ) const ; inline Vertex vertices ( size_t i ) const ; inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored @@ -91,6 +98,7 @@ inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use inline Face faces ( size_t i ) const ; inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; inline int initialized ( ) const ; @@ -127,6 +135,6 @@ inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for inline p_void mht ( ) const ; inline p_void temps ( ) const ; - }; + }; // Surface } // namespace Topology diff --git a/include/mrisurf_SurfaceFromMRIS_generated_TopologyM.h b/include/mrisurf_SurfaceFromMRIS_generated_TopologyM.h index 9fd06947f4c..716bf16f83c 100644 --- a/include/mrisurf_SurfaceFromMRIS_generated_TopologyM.h +++ b/include/mrisurf_SurfaceFromMRIS_generated_TopologyM.h @@ -1,23 +1,27 @@ namespace TopologyM { struct Face : public Repr_Elt { + typedef TopologyM::Surface Surface; + typedef TopologyM::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline char ripflag ( ) const ; - inline char oripflag ( ) const ; - inline int marked ( ) const ; + inline Vertex v ( size_t i ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; - inline void set_v ( size_t i, Vertex to ) ; - inline void set_ripflag ( char to ) ; - inline void set_oripflag ( char to ) ; - inline void set_marked ( int to ) ; - }; + inline void set_v ( size_t i, Vertex to ) ; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef TopologyM::Surface Surface; + typedef TopologyM::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -26,39 +30,41 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline int e ( size_t i ) const ; // edge state for neighboring vertices - inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops - inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i, - inline short v2num ( ) const ; // number of 1, or 2-hop neighbors - inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors - inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur - inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num - inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc - inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal - inline uchar num ( ) const ; // number of neighboring faces - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache - inline void which_coords (int which, float *x, float *y, float *z) const ; + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces - inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices - inline void set_v ( size_t i, Vertex to ) ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops - inline void set_vnum ( short to ) ; // number of 1-hop neighbors should use [p]VERTEXvnum(i, - inline void set_v2num ( short to ) ; // number of 1, or 2-hop neighbors - inline void set_v3num ( short to ) ; // number of 1,2,or 3-hop neighbors - inline void set_vtotal ( short to ) ; // total # of neighbors. copy of vnum.nsizeCur - inline void set_nsizeMaxClock ( short to ) ; // copy of mris->nsizeMaxClock when v#num - inline void set_nsizeMax ( uchar to ) ; // the max nsize that was used to fill in vnum etc - inline void set_nsizeCur ( uchar to ) ; // index of the current v#num in vtotal - inline void set_num ( uchar to ) ; // number of neighboring faces - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices + inline void set_v ( size_t i, Vertex to ) ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline void set_vnum ( short to ) ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline void set_v2num ( short to ) ; // number of 1, or 2-hop neighbors + inline void set_v3num ( short to ) ; // number of 1,2,or 3-hop neighbors + inline void set_vtotal ( short to ) ; // total # of neighbors. copy of vnum.nsizeCur + inline void set_nsizeMaxClock ( short to ) ; // copy of mris->nsizeMaxClock when v#num + inline void set_nsizeMax ( uchar to ) ; // the max nsize that was used to fill in vnum etc + inline void set_nsizeCur ( uchar to ) ; // index of the current v#num in vtotal + inline void set_num ( uchar to ) ; // number of neighboring faces + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef TopologyM::Face Face; + typedef TopologyM::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); @@ -70,6 +76,7 @@ inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners inline int nstrips ( ) const ; inline Vertex vertices ( size_t i ) const ; inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored @@ -77,6 +84,7 @@ inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use inline Face faces ( size_t i ) const ; inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; inline int initialized ( ) const ; @@ -113,6 +121,6 @@ inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for inline p_void mht ( ) const ; inline p_void temps ( ) const ; - }; + }; // Surface } // namespace TopologyM diff --git a/include/mrisurf_SurfaceFromMRIS_generated_XYZPosition.h b/include/mrisurf_SurfaceFromMRIS_generated_XYZPosition.h index 8ed9832400d..6ff8d4d95c4 100644 --- a/include/mrisurf_SurfaceFromMRIS_generated_XYZPosition.h +++ b/include/mrisurf_SurfaceFromMRIS_generated_XYZPosition.h @@ -1,5 +1,7 @@ namespace XYZPosition { struct Face : public Repr_Elt { + typedef XYZPosition::Surface Surface; + typedef XYZPosition::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); @@ -12,17 +14,19 @@ inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline char ripflag ( ) const ; - inline char oripflag ( ) const ; - inline int marked ( ) const ; + inline Vertex v ( size_t i ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; - inline void set_ripflag ( char to ) ; - inline void set_oripflag ( char to ) ; - inline void set_marked ( int to ) ; - }; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef XYZPosition::Surface Surface; + typedef XYZPosition::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -37,49 +41,51 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline int e ( size_t i ) const ; // edge state for neighboring vertices - inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops - inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i, - inline short v2num ( ) const ; // number of 1, or 2-hop neighbors - inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors - inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur - inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num - inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc - inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal - inline uchar num ( ) const ; // number of neighboring faces + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces // managed by MRISfreeDists[_orig] and MRISmakeDists[_orig] - inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz - inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz - inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements - inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements // - inline float x ( ) const ; // current coordinates - inline float y ( ) const ; // use MRISsetXYZ() to set - inline float z ( ) const ; + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; // - inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status - inline float origy ( ) const ; // use MRISsetOriginalXYZ(, - inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set - inline float cx ( ) const ; - inline float cy ( ) const ; - inline float cz ( ) const ; // coordinates in canonical coordinate system - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces - inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices - inline void set_cx ( float to ) ; - inline void set_cy ( float to ) ; - inline void set_cz ( float to ) ; // coordinates in canonical coordinate system - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef XYZPosition::Face Face; + typedef XYZPosition::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); @@ -92,71 +98,73 @@ inline Surface ( AllM::Surface const & src ); // Fields being maintained by specialist functions - inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons - inline int nedges ( ) const ; // # of edges on surface - inline int nstrips ( ) const ; - inline Vertex vertices ( size_t i ) const ; - inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored - inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored - inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use - inline Face faces ( size_t i ) const ; - inline MRI_EDGE edges ( size_t i ) const ; - inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; - inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; - inline int initialized ( ) const ; - inline PLTA lta ( ) const ; - inline PMATRIX SRASToTalSRAS_ ( ) const ; - inline PMATRIX TalSRASToSRAS_ ( ) const ; - inline int free_transform ( ) const ; - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline float a ( ) const ; - inline float b ( ) const ; - inline float c ( ) const ; // ellipsoid parameters - inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - inline int patch ( ) const ; // if a patch of the surface - inline p_void vp ( ) const ; // for misc. use - inline float alpha ( ) const ; // rotation around z-axis - inline float beta ( ) const ; // rotation around y-axis - inline float gamma ( ) const ; // rotation around x-axis - inline float da ( ) const ; - inline float db ( ) const ; - inline float dg ( ) const ; // old deltas - inline int type ( ) const ; // what type of surface was this initially - inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces - inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces - inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject - inline float canon_area ( ) const ; - inline int noscale ( ) const ; // don't scale by surface area if true - inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) - inline float dy2 ( size_t i ) const ; - inline float dz2 ( size_t i ) const ; - inline PCOLOR_TABLE ct ( ) const ; - inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) - inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 - inline MRIS_cmdlines_t cmdlines ( ) const ; - inline int ncmds ( ) const ; - inline float group_avg_surface_area ( ) const ; // average of total surface area for group - inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex - inline int triangle_links_removed ( ) const ; // for quad surfaces - inline p_void user_parms ( ) const ; // for whatever the user wants to hang here - inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel - inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for - inline p_void mht ( ) const ; - inline p_void temps ( ) const ; + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline p_void vp ( ) const ; // for misc. use + inline float alpha ( ) const ; // rotation around z-axis + inline float beta ( ) const ; // rotation around y-axis + inline float gamma ( ) const ; // rotation around x-axis + inline float da ( ) const ; + inline float db ( ) const ; + inline float dg ( ) const ; // old deltas + inline int type ( ) const ; // what type of surface was this initially + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; - inline void set_vp ( p_void to ) ; // for misc. use - inline void set_alpha ( float to ) ; // rotation around z-axis - inline void set_beta ( float to ) ; // rotation around y-axis - inline void set_gamma ( float to ) ; // rotation around x-axis - inline void set_da ( float to ) ; - inline void set_db ( float to ) ; - inline void set_dg ( float to ) ; // old deltas - inline void set_type ( int to ) ; // what type of surface was this initially - }; + inline void set_vp ( p_void to ) ; // for misc. use + inline void set_alpha ( float to ) ; // rotation around z-axis + inline void set_beta ( float to ) ; // rotation around y-axis + inline void set_gamma ( float to ) ; // rotation around x-axis + inline void set_da ( float to ) ; + inline void set_db ( float to ) ; + inline void set_dg ( float to ) ; // old deltas + inline void set_type ( int to ) ; // what type of surface was this initially + }; // Surface } // namespace XYZPosition diff --git a/include/mrisurf_SurfaceFromMRIS_generated_XYZPositionConsequences.h b/include/mrisurf_SurfaceFromMRIS_generated_XYZPositionConsequences.h index 525487af27d..a710ad2d842 100644 --- a/include/mrisurf_SurfaceFromMRIS_generated_XYZPositionConsequences.h +++ b/include/mrisurf_SurfaceFromMRIS_generated_XYZPositionConsequences.h @@ -1,5 +1,7 @@ namespace XYZPositionConsequences { struct Face : public Repr_Elt { + typedef XYZPositionConsequences::Surface Surface; + typedef XYZPositionConsequences::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); @@ -10,23 +12,25 @@ inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline float area ( ) const ; - inline angles_per_triangle_t angle ( ) const ; - inline angles_per_triangle_t orig_angle ( ) const ; - inline char ripflag ( ) const ; - inline char oripflag ( ) const ; - inline int marked ( ) const ; - inline PDMATRIX norm ( ) const ; - inline A3PDMATRIX gradNorm ( ) const ; + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; + inline PDMATRIX norm ( ) const ; + inline A3PDMATRIX gradNorm ( ) const ; - inline void set_orig_angle ( angles_per_triangle_t to ) ; - inline void set_ripflag ( char to ) ; - inline void set_oripflag ( char to ) ; - inline void set_marked ( int to ) ; - }; + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef XYZPositionConsequences::Surface Surface; + typedef XYZPositionConsequences::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -39,58 +43,60 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline int e ( size_t i ) const ; // edge state for neighboring vertices - inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops - inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i, - inline short v2num ( ) const ; // number of 1, or 2-hop neighbors - inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors - inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur - inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num - inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc - inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal - inline uchar num ( ) const ; // number of neighboring faces + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces // managed by MRISfreeDists[_orig] and MRISmakeDists[_orig] - inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz - inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz - inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements - inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements // - inline float x ( ) const ; // current coordinates - inline float y ( ) const ; // use MRISsetXYZ() to set - inline float z ( ) const ; + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; // - inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status - inline float origy ( ) const ; // use MRISsetOriginalXYZ(, - inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set // - inline float nx ( ) const ; - inline float ny ( ) const ; - inline float nz ( ) const ; // curr normal - inline float cx ( ) const ; - inline float cy ( ) const ; - inline float cz ( ) const ; // coordinates in canonical coordinate system - inline float area ( ) const ; - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float area ( ) const ; + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces - inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices // - inline void set_nx ( float to ) ; - inline void set_ny ( float to ) ; - inline void set_nz ( float to ) ; // curr normal - inline void set_cx ( float to ) ; - inline void set_cy ( float to ) ; - inline void set_cz ( float to ) ; // coordinates in canonical coordinate system - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef XYZPositionConsequences::Face Face; + typedef XYZPositionConsequences::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); @@ -101,134 +107,140 @@ inline Surface ( AllM::Surface const & src ); // Fields being maintained by specialist functions - inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons - inline int nedges ( ) const ; // # of edges on surface - inline int nstrips ( ) const ; - inline Vertex vertices ( size_t i ) const ; - inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored - inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored - inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use - inline Face faces ( size_t i ) const ; - inline MRI_EDGE edges ( size_t i ) const ; - inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; - inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; - inline STRIP strips ( size_t i ) const ; - inline float xctr ( ) const ; - inline float yctr ( ) const ; - inline float zctr ( ) const ; - inline float xlo ( ) const ; - inline float ylo ( ) const ; - inline float zlo ( ) const ; - inline float xhi ( ) const ; - inline float yhi ( ) const ; - inline float zhi ( ) const ; - inline float x0 ( ) const ; // center of spherical expansion - inline float y0 ( ) const ; - inline float z0 ( ) const ; - inline Vertex v_temporal_pole ( ) const ; - inline Vertex v_frontal_pole ( ) const ; - inline Vertex v_occipital_pole ( ) const ; - inline float max_curv ( ) const ; - inline float min_curv ( ) const ; - inline float total_area ( ) const ; - inline double avg_vertex_area ( ) const ; - inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist - inline double std_vertex_dist ( ) const ; - inline float orig_area ( ) const ; - inline float neg_area ( ) const ; - inline float neg_orig_area ( ) const ; // amount of original surface in folds - inline int zeros ( ) const ; - inline int hemisphere ( ) const ; // which hemisphere - inline int initialized ( ) const ; - inline PLTA lta ( ) const ; - inline PMATRIX SRASToTalSRAS_ ( ) const ; - inline PMATRIX TalSRASToSRAS_ ( ) const ; - inline int free_transform ( ) const ; - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline float a ( ) const ; - inline float b ( ) const ; - inline float c ( ) const ; // ellipsoid parameters - inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from - inline float Hmin ( ) const ; // min mean curvature - inline float Hmax ( ) const ; // max mean curvature - inline float Kmin ( ) const ; // min Gaussian curvature - inline float Kmax ( ) const ; // max Gaussian curvature - inline double Ktotal ( ) const ; // total Gaussian curvature - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - inline int patch ( ) const ; // if a patch of the surface - inline int nlabels ( ) const ; - inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) - inline p_void vp ( ) const ; // for misc. use - inline float alpha ( ) const ; // rotation around z-axis - inline float beta ( ) const ; // rotation around y-axis - inline float gamma ( ) const ; // rotation around x-axis - inline float da ( ) const ; - inline float db ( ) const ; - inline float dg ( ) const ; // old deltas - inline int type ( ) const ; // what type of surface was this initially - inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces - inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces - inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject - inline float canon_area ( ) const ; - inline int noscale ( ) const ; // don't scale by surface area if true - inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) - inline float dy2 ( size_t i ) const ; - inline float dz2 ( size_t i ) const ; - inline PCOLOR_TABLE ct ( ) const ; - inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) - inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 - inline MRIS_cmdlines_t cmdlines ( ) const ; - inline int ncmds ( ) const ; - inline float group_avg_surface_area ( ) const ; // average of total surface area for group - inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex - inline int triangle_links_removed ( ) const ; // for quad surfaces - inline p_void user_parms ( ) const ; // for whatever the user wants to hang here - inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel - inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for - inline p_void mht ( ) const ; - inline p_void temps ( ) const ; + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline STRIP strips ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float x0 ( ) const ; // center of spherical expansion + inline float y0 ( ) const ; + inline float z0 ( ) const ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + inline Vertex v_temporal_pole ( ) const ; + inline Vertex v_frontal_pole ( ) const ; + inline Vertex v_occipital_pole ( ) const ; + // + inline float max_curv ( ) const ; + inline float min_curv ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline int zeros ( ) const ; + inline int hemisphere ( ) const ; // which hemisphere + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline float Hmin ( ) const ; // min mean curvature + inline float Hmax ( ) const ; // max mean curvature + inline float Kmin ( ) const ; // min Gaussian curvature + inline float Kmax ( ) const ; // max Gaussian curvature + inline double Ktotal ( ) const ; // total Gaussian curvature + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int nlabels ( ) const ; + inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) + inline p_void vp ( ) const ; // for misc. use + inline float alpha ( ) const ; // rotation around z-axis + inline float beta ( ) const ; // rotation around y-axis + inline float gamma ( ) const ; // rotation around x-axis + inline float da ( ) const ; + inline float db ( ) const ; + inline float dg ( ) const ; // old deltas + inline int type ( ) const ; // what type of surface was this initially + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; - inline void set_strips ( size_t i, STRIP to ) ; - inline void set_xctr ( float to ) ; - inline void set_yctr ( float to ) ; - inline void set_zctr ( float to ) ; - inline void set_xlo ( float to ) ; - inline void set_ylo ( float to ) ; - inline void set_zlo ( float to ) ; - inline void set_xhi ( float to ) ; - inline void set_yhi ( float to ) ; - inline void set_zhi ( float to ) ; - inline void set_x0 ( float to ) ; // center of spherical expansion - inline void set_y0 ( float to ) ; - inline void set_z0 ( float to ) ; - inline void set_v_temporal_pole ( Vertex to ) ; - inline void set_v_frontal_pole ( Vertex to ) ; - inline void set_v_occipital_pole ( Vertex to ) ; - inline void set_max_curv ( float to ) ; - inline void set_min_curv ( float to ) ; - inline void set_total_area ( float to ) ; - inline void set_avg_vertex_area ( double to ) ; - inline void set_zeros ( int to ) ; - inline void set_hemisphere ( int to ) ; // which hemisphere - inline void set_Hmin ( float to ) ; // min mean curvature - inline void set_Hmax ( float to ) ; // max mean curvature - inline void set_Kmin ( float to ) ; // min Gaussian curvature - inline void set_Kmax ( float to ) ; // max Gaussian curvature - inline void set_Ktotal ( double to ) ; // total Gaussian curvature - inline void set_nlabels ( int to ) ; - inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) - inline void set_vp ( p_void to ) ; // for misc. use - inline void set_alpha ( float to ) ; // rotation around z-axis - inline void set_beta ( float to ) ; // rotation around y-axis - inline void set_gamma ( float to ) ; // rotation around x-axis - inline void set_da ( float to ) ; - inline void set_db ( float to ) ; - inline void set_dg ( float to ) ; // old deltas - inline void set_type ( int to ) ; // what type of surface was this initially - }; + inline void set_strips ( size_t i, STRIP to ) ; + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_x0 ( float to ) ; // center of spherical expansion + inline void set_y0 ( float to ) ; + inline void set_z0 ( float to ) ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + inline void set_v_temporal_pole ( Vertex to ) ; + inline void set_v_frontal_pole ( Vertex to ) ; + inline void set_v_occipital_pole ( Vertex to ) ; + // + inline void set_max_curv ( float to ) ; + inline void set_min_curv ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + inline void set_zeros ( int to ) ; + inline void set_hemisphere ( int to ) ; // which hemisphere + inline void set_Hmin ( float to ) ; // min mean curvature + inline void set_Hmax ( float to ) ; // max mean curvature + inline void set_Kmin ( float to ) ; // min Gaussian curvature + inline void set_Kmax ( float to ) ; // max Gaussian curvature + inline void set_Ktotal ( double to ) ; // total Gaussian curvature + inline void set_nlabels ( int to ) ; + inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) + inline void set_vp ( p_void to ) ; // for misc. use + inline void set_alpha ( float to ) ; // rotation around z-axis + inline void set_beta ( float to ) ; // rotation around y-axis + inline void set_gamma ( float to ) ; // rotation around x-axis + inline void set_da ( float to ) ; + inline void set_db ( float to ) ; + inline void set_dg ( float to ) ; // old deltas + inline void set_type ( int to ) ; // what type of surface was this initially + }; // Surface } // namespace XYZPositionConsequences diff --git a/include/mrisurf_SurfaceFromMRIS_generated_XYZPositionConsequencesM.h b/include/mrisurf_SurfaceFromMRIS_generated_XYZPositionConsequencesM.h index 19d966d743b..e0caa36c27a 100644 --- a/include/mrisurf_SurfaceFromMRIS_generated_XYZPositionConsequencesM.h +++ b/include/mrisurf_SurfaceFromMRIS_generated_XYZPositionConsequencesM.h @@ -1,32 +1,36 @@ namespace XYZPositionConsequencesM { struct Face : public Repr_Elt { + typedef XYZPositionConsequencesM::Surface Surface; + typedef XYZPositionConsequencesM::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline float area ( ) const ; - inline angles_per_triangle_t angle ( ) const ; - inline angles_per_triangle_t orig_angle ( ) const ; - inline char ripflag ( ) const ; - inline char oripflag ( ) const ; - inline int marked ( ) const ; - inline PDMATRIX norm ( ) const ; - inline A3PDMATRIX gradNorm ( ) const ; + inline Vertex v ( size_t i ) const ; + inline float area ( ) const ; + inline angles_per_triangle_t angle ( ) const ; + inline angles_per_triangle_t orig_angle ( ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; + inline PDMATRIX norm ( ) const ; + inline A3PDMATRIX gradNorm ( ) const ; - inline void set_area ( float to ) ; - inline void set_angle ( angles_per_triangle_t to ) ; - inline void set_orig_angle ( angles_per_triangle_t to ) ; - inline void set_ripflag ( char to ) ; - inline void set_oripflag ( char to ) ; - inline void set_marked ( int to ) ; - inline void set_norm ( PDMATRIX to ) ; - inline void set_gradNorm ( A3PDMATRIX to ) ; - }; + inline void set_area ( float to ) ; + inline void set_angle ( angles_per_triangle_t to ) ; + inline void set_orig_angle ( angles_per_triangle_t to ) ; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + inline void set_norm ( PDMATRIX to ) ; + inline void set_gradNorm ( A3PDMATRIX to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef XYZPositionConsequencesM::Surface Surface; + typedef XYZPositionConsequencesM::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -35,198 +39,206 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline int e ( size_t i ) const ; // edge state for neighboring vertices - inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops - inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i, - inline short v2num ( ) const ; // number of 1, or 2-hop neighbors - inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors - inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur - inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num - inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc - inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal - inline uchar num ( ) const ; // number of neighboring faces + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces // managed by MRISfreeDists[_orig] and MRISmakeDists[_orig] - inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz - inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz - inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements - inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements // - inline float x ( ) const ; // current coordinates - inline float y ( ) const ; // use MRISsetXYZ() to set - inline float z ( ) const ; + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; // - inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status - inline float origy ( ) const ; // use MRISsetOriginalXYZ(, - inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set // - inline float nx ( ) const ; - inline float ny ( ) const ; - inline float nz ( ) const ; // curr normal - inline float cx ( ) const ; - inline float cy ( ) const ; - inline float cz ( ) const ; // coordinates in canonical coordinate system - inline float area ( ) const ; - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline float nx ( ) const ; + inline float ny ( ) const ; + inline float nz ( ) const ; // curr normal + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline float area ( ) const ; + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces - inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices // - inline void set_nx ( float to ) ; - inline void set_ny ( float to ) ; - inline void set_nz ( float to ) ; // curr normal - inline void set_cx ( float to ) ; - inline void set_cy ( float to ) ; - inline void set_cz ( float to ) ; // coordinates in canonical coordinate system - inline void set_area ( float to ) ; - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_nx ( float to ) ; + inline void set_ny ( float to ) ; + inline void set_nz ( float to ) ; // curr normal + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_area ( float to ) ; + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { + typedef XYZPositionConsequencesM::Face Face; + typedef XYZPositionConsequencesM::Vertex Vertex; inline Surface ( ); inline Surface ( Surface const & src ); inline Surface ( Representation* representation ); inline Surface ( AllM::Surface const & src ); // Fields being maintained by specialist functions - inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons - inline int nedges ( ) const ; // # of edges on surface - inline int nstrips ( ) const ; - inline Vertex vertices ( size_t i ) const ; - inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored - inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored - inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use - inline Face faces ( size_t i ) const ; - inline MRI_EDGE edges ( size_t i ) const ; - inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; - inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; - inline STRIP strips ( size_t i ) const ; - inline float xctr ( ) const ; - inline float yctr ( ) const ; - inline float zctr ( ) const ; - inline float xlo ( ) const ; - inline float ylo ( ) const ; - inline float zlo ( ) const ; - inline float xhi ( ) const ; - inline float yhi ( ) const ; - inline float zhi ( ) const ; - inline float x0 ( ) const ; // center of spherical expansion - inline float y0 ( ) const ; - inline float z0 ( ) const ; - inline Vertex v_temporal_pole ( ) const ; - inline Vertex v_frontal_pole ( ) const ; - inline Vertex v_occipital_pole ( ) const ; - inline float max_curv ( ) const ; - inline float min_curv ( ) const ; - inline float total_area ( ) const ; - inline double avg_vertex_area ( ) const ; - inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist - inline double std_vertex_dist ( ) const ; - inline float orig_area ( ) const ; - inline float neg_area ( ) const ; - inline float neg_orig_area ( ) const ; // amount of original surface in folds - inline int zeros ( ) const ; - inline int hemisphere ( ) const ; // which hemisphere - inline int initialized ( ) const ; - inline PLTA lta ( ) const ; - inline PMATRIX SRASToTalSRAS_ ( ) const ; - inline PMATRIX TalSRASToSRAS_ ( ) const ; - inline int free_transform ( ) const ; - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline float a ( ) const ; - inline float b ( ) const ; - inline float c ( ) const ; // ellipsoid parameters - inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from - inline float Hmin ( ) const ; // min mean curvature - inline float Hmax ( ) const ; // max mean curvature - inline float Kmin ( ) const ; // min Gaussian curvature - inline float Kmax ( ) const ; // max Gaussian curvature - inline double Ktotal ( ) const ; // total Gaussian curvature - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - inline int patch ( ) const ; // if a patch of the surface - inline int nlabels ( ) const ; - inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) - inline p_void vp ( ) const ; // for misc. use - inline float alpha ( ) const ; // rotation around z-axis - inline float beta ( ) const ; // rotation around y-axis - inline float gamma ( ) const ; // rotation around x-axis - inline float da ( ) const ; - inline float db ( ) const ; - inline float dg ( ) const ; // old deltas - inline int type ( ) const ; // what type of surface was this initially - inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces - inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces - inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject - inline float canon_area ( ) const ; - inline int noscale ( ) const ; // don't scale by surface area if true - inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) - inline float dy2 ( size_t i ) const ; - inline float dz2 ( size_t i ) const ; - inline PCOLOR_TABLE ct ( ) const ; - inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) - inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 - inline MRIS_cmdlines_t cmdlines ( ) const ; - inline int ncmds ( ) const ; - inline float group_avg_surface_area ( ) const ; // average of total surface area for group - inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex - inline int triangle_links_removed ( ) const ; // for quad surfaces - inline p_void user_parms ( ) const ; // for whatever the user wants to hang here - inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel - inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for - inline p_void mht ( ) const ; - inline p_void temps ( ) const ; + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline STRIP strips ( size_t i ) const ; + inline float xctr ( ) const ; + inline float yctr ( ) const ; + inline float zctr ( ) const ; + inline float xlo ( ) const ; + inline float ylo ( ) const ; + inline float zlo ( ) const ; + inline float xhi ( ) const ; + inline float yhi ( ) const ; + inline float zhi ( ) const ; + inline float x0 ( ) const ; // center of spherical expansion + inline float y0 ( ) const ; + inline float z0 ( ) const ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + inline Vertex v_temporal_pole ( ) const ; + inline Vertex v_frontal_pole ( ) const ; + inline Vertex v_occipital_pole ( ) const ; + // + inline float max_curv ( ) const ; + inline float min_curv ( ) const ; + inline float total_area ( ) const ; + inline double avg_vertex_area ( ) const ; + inline double avg_vertex_dist ( ) const ; // set by MRIScomputeAvgInterVertexDist + inline double std_vertex_dist ( ) const ; + inline float orig_area ( ) const ; + inline float neg_area ( ) const ; + inline float neg_orig_area ( ) const ; // amount of original surface in folds + inline int zeros ( ) const ; + inline int hemisphere ( ) const ; // which hemisphere + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline float Hmin ( ) const ; // min mean curvature + inline float Hmax ( ) const ; // max mean curvature + inline float Kmin ( ) const ; // min Gaussian curvature + inline float Kmax ( ) const ; // max Gaussian curvature + inline double Ktotal ( ) const ; // total Gaussian curvature + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline int nlabels ( ) const ; + inline PMRIS_AREA_LABEL labels ( ) const ; // nlabels of these (may be null) + inline p_void vp ( ) const ; // for misc. use + inline float alpha ( ) const ; // rotation around z-axis + inline float beta ( ) const ; // rotation around y-axis + inline float gamma ( ) const ; // rotation around x-axis + inline float da ( ) const ; + inline float db ( ) const ; + inline float dg ( ) const ; // old deltas + inline int type ( ) const ; // what type of surface was this initially + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; - inline void set_strips ( size_t i, STRIP to ) ; - inline void set_xctr ( float to ) ; - inline void set_yctr ( float to ) ; - inline void set_zctr ( float to ) ; - inline void set_xlo ( float to ) ; - inline void set_ylo ( float to ) ; - inline void set_zlo ( float to ) ; - inline void set_xhi ( float to ) ; - inline void set_yhi ( float to ) ; - inline void set_zhi ( float to ) ; - inline void set_x0 ( float to ) ; // center of spherical expansion - inline void set_y0 ( float to ) ; - inline void set_z0 ( float to ) ; - inline void set_v_temporal_pole ( Vertex to ) ; - inline void set_v_frontal_pole ( Vertex to ) ; - inline void set_v_occipital_pole ( Vertex to ) ; - inline void set_max_curv ( float to ) ; - inline void set_min_curv ( float to ) ; - inline void set_total_area ( float to ) ; - inline void set_avg_vertex_area ( double to ) ; - inline void set_avg_vertex_dist ( double to ) ; // set by MRIScomputeAvgInterVertexDist - inline void set_std_vertex_dist ( double to ) ; - inline void set_orig_area ( float to ) ; - inline void set_neg_area ( float to ) ; - inline void set_neg_orig_area ( float to ) ; // amount of original surface in folds - inline void set_zeros ( int to ) ; - inline void set_hemisphere ( int to ) ; // which hemisphere - inline void set_Hmin ( float to ) ; // min mean curvature - inline void set_Hmax ( float to ) ; // max mean curvature - inline void set_Kmin ( float to ) ; // min Gaussian curvature - inline void set_Kmax ( float to ) ; // max Gaussian curvature - inline void set_Ktotal ( double to ) ; // total Gaussian curvature - inline void set_nlabels ( int to ) ; - inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) - inline void set_vp ( p_void to ) ; // for misc. use - inline void set_alpha ( float to ) ; // rotation around z-axis - inline void set_beta ( float to ) ; // rotation around y-axis - inline void set_gamma ( float to ) ; // rotation around x-axis - inline void set_da ( float to ) ; - inline void set_db ( float to ) ; - inline void set_dg ( float to ) ; // old deltas - inline void set_type ( int to ) ; // what type of surface was this initially - }; + inline void set_strips ( size_t i, STRIP to ) ; + inline void set_xctr ( float to ) ; + inline void set_yctr ( float to ) ; + inline void set_zctr ( float to ) ; + inline void set_xlo ( float to ) ; + inline void set_ylo ( float to ) ; + inline void set_zlo ( float to ) ; + inline void set_xhi ( float to ) ; + inline void set_yhi ( float to ) ; + inline void set_zhi ( float to ) ; + inline void set_x0 ( float to ) ; // center of spherical expansion + inline void set_y0 ( float to ) ; + inline void set_z0 ( float to ) ; + // v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices + inline void set_v_temporal_pole ( Vertex to ) ; + inline void set_v_frontal_pole ( Vertex to ) ; + inline void set_v_occipital_pole ( Vertex to ) ; + // + inline void set_max_curv ( float to ) ; + inline void set_min_curv ( float to ) ; + inline void set_total_area ( float to ) ; + inline void set_avg_vertex_area ( double to ) ; + inline void set_avg_vertex_dist ( double to ) ; // set by MRIScomputeAvgInterVertexDist + inline void set_std_vertex_dist ( double to ) ; + inline void set_orig_area ( float to ) ; + inline void set_neg_area ( float to ) ; + inline void set_neg_orig_area ( float to ) ; // amount of original surface in folds + inline void set_zeros ( int to ) ; + inline void set_hemisphere ( int to ) ; // which hemisphere + inline void set_Hmin ( float to ) ; // min mean curvature + inline void set_Hmax ( float to ) ; // max mean curvature + inline void set_Kmin ( float to ) ; // min Gaussian curvature + inline void set_Kmax ( float to ) ; // max Gaussian curvature + inline void set_Ktotal ( double to ) ; // total Gaussian curvature + inline void set_nlabels ( int to ) ; + inline void set_labels ( PMRIS_AREA_LABEL to ) ; // nlabels of these (may be null) + inline void set_vp ( p_void to ) ; // for misc. use + inline void set_alpha ( float to ) ; // rotation around z-axis + inline void set_beta ( float to ) ; // rotation around y-axis + inline void set_gamma ( float to ) ; // rotation around x-axis + inline void set_da ( float to ) ; + inline void set_db ( float to ) ; + inline void set_dg ( float to ) ; // old deltas + inline void set_type ( int to ) ; // what type of surface was this initially + }; // Surface } // namespace XYZPositionConsequencesM diff --git a/include/mrisurf_SurfaceFromMRIS_generated_XYZPositionM.h b/include/mrisurf_SurfaceFromMRIS_generated_XYZPositionM.h index 2bfcbeafb98..ee272fd77f1 100644 --- a/include/mrisurf_SurfaceFromMRIS_generated_XYZPositionM.h +++ b/include/mrisurf_SurfaceFromMRIS_generated_XYZPositionM.h @@ -1,22 +1,26 @@ namespace XYZPositionM { struct Face : public Repr_Elt { + typedef XYZPositionM::Surface Surface; + typedef XYZPositionM::Vertex Vertex; inline Face ( ); inline Face ( Face const & src ); inline Face ( Representation* representation, size_t idx ); inline Face ( AllM::Face const & src ); int fno () const { return idx; } - inline Vertex v ( size_t i ) const ; - inline char ripflag ( ) const ; - inline char oripflag ( ) const ; - inline int marked ( ) const ; + inline Vertex v ( size_t i ) const ; + inline char ripflag ( ) const ; + inline char oripflag ( ) const ; + inline int marked ( ) const ; - inline void set_ripflag ( char to ) ; - inline void set_oripflag ( char to ) ; - inline void set_marked ( int to ) ; - }; + inline void set_ripflag ( char to ) ; + inline void set_oripflag ( char to ) ; + inline void set_marked ( int to ) ; + }; // Face struct Vertex : public Repr_Elt { + typedef XYZPositionM::Surface Surface; + typedef XYZPositionM::Face Face; inline Vertex ( ); inline Vertex ( Vertex const & src ); inline Vertex ( Representation* representation, size_t idx ); @@ -25,124 +29,129 @@ // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces - inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline int e ( size_t i ) const ; // edge state for neighboring vertices - inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops - inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i, - inline short v2num ( ) const ; // number of 1, or 2-hop neighbors - inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors - inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur - inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num - inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc - inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal - inline uchar num ( ) const ; // number of neighboring faces + inline Face f ( size_t i ) const ; // size() is num. array[v->num] the fno's of the neighboring faces + inline size_t n ( size_t i ) const ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline int e ( size_t i ) const ; // edge state for neighboring vertices + inline Vertex v ( size_t i ) const ; // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops + inline short vnum ( ) const ; // number of 1-hop neighbors should use [p]VERTEXvnum(i) + inline short v2num ( ) const ; // number of 1, or 2-hop neighbors + inline short v3num ( ) const ; // number of 1,2,or 3-hop neighbors + inline short vtotal ( ) const ; // total # of neighbors. copy of vnum.nsizeCur + inline short nsizeMaxClock ( ) const ; // copy of mris->nsizeMaxClock when v#num + inline uchar nsizeMax ( ) const ; // the max nsize that was used to fill in vnum etc + inline uchar nsizeCur ( ) const ; // index of the current v#num in vtotal + inline uchar num ( ) const ; // number of neighboring faces // managed by MRISfreeDists[_orig] and MRISmakeDists[_orig] - inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz - inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz - inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements - inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline float dist ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on xyz + inline float dist_orig ( size_t i ) const ; // size() is vtotal. distance to neighboring vertices based on origxyz + inline int dist_capacity ( ) const ; // -- should contain at least vtx_vtotal elements + inline int dist_orig_capacity ( ) const ; // -- should contain at least vtx_vtotal elements // - inline float x ( ) const ; // current coordinates - inline float y ( ) const ; // use MRISsetXYZ() to set - inline float z ( ) const ; + inline float x ( ) const ; // current coordinates + inline float y ( ) const ; // use MRISsetXYZ() to set + inline float z ( ) const ; // - inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status - inline float origy ( ) const ; // use MRISsetOriginalXYZ(, - inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set - inline float cx ( ) const ; - inline float cy ( ) const ; - inline float cz ( ) const ; // coordinates in canonical coordinate system - inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache + inline float origx ( ) const ; // original coordinates, see also MRIS::origxyz_status + inline float origy ( ) const ; // use MRISsetOriginalXYZ(, + inline float origz ( ) const ; // or MRISsetOriginalXYZfromXYZ to set + inline float cx ( ) const ; + inline float cy ( ) const ; + inline float cz ( ) const ; // coordinates in canonical coordinate system + inline char ripflag ( ) const ; // vertex no longer exists - placed last to load the next vertex into cache inline void which_coords (int which, float *x, float *y, float *z) const ; // put the pointers before the ints, before the shorts, before uchars, to reduce size // the whole fits in much less than one cache line, so further ordering is no use - inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces - inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex - inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices + inline void set_f ( size_t i, Face to ) ; // size() is num. array[v->num] the fno's of the neighboring faces + inline void set_n ( size_t i, size_t to ) ; // size() is num. array[v->num] the face.v[*] index for this vertex + inline void set_e ( size_t i, int to ) ; // edge state for neighboring vertices // - inline void set_x ( float to ) ; // current coordinates - inline void set_y ( float to ) ; // use MRISsetXYZ() to set - inline void set_z ( float to ) ; - inline void set_cx ( float to ) ; - inline void set_cy ( float to ) ; - inline void set_cz ( float to ) ; // coordinates in canonical coordinate system - inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache - }; + inline void set_x ( float to ) ; // current coordinates + inline void set_y ( float to ) ; // use MRISsetXYZ() to set + inline void set_z ( float to ) ; + inline void set_cx ( float to ) ; + inline void set_cy ( float to ) ; + inline void set_cz ( float to ) ; // coordinates in canonical coordinate system + inline void set_ripflag ( char to ) ; // vertex no longer exists - placed last to load the next vertex into cache + }; // Vertex struct Surface : public Repr_Elt { - inline Surface ( ); - inline Surface ( Surface const & src ); - inline Surface ( Representation* representation ); - inline Surface ( AllM::Surface const & src ); + typedef XYZPositionM::Face Face; + typedef XYZPositionM::Vertex Vertex; + inline Surface ( ); + inline Surface ( Surface const & src ); + inline Surface ( Representation* representation ); + inline Surface ( AllM::Surface const & src ); + void freeDistsButNotOrig() { MRISfreeDistsButNotOrig(repr); } // Fields being maintained by specialist functions - inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen - inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al - inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al - inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons - inline int nedges ( ) const ; // # of edges on surface - inline int nstrips ( ) const ; - inline Vertex vertices ( size_t i ) const ; - inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored - inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored - inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use - inline Face faces ( size_t i ) const ; - inline MRI_EDGE edges ( size_t i ) const ; - inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; - inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; - inline int initialized ( ) const ; - inline PLTA lta ( ) const ; - inline PMATRIX SRASToTalSRAS_ ( ) const ; - inline PMATRIX TalSRASToSRAS_ ( ) const ; - inline int free_transform ( ) const ; - inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) - inline float a ( ) const ; - inline float b ( ) const ; - inline float c ( ) const ; // ellipsoid parameters - inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from - inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) - inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from - inline int patch ( ) const ; // if a patch of the surface - inline p_void vp ( ) const ; // for misc. use - inline float alpha ( ) const ; // rotation around z-axis - inline float beta ( ) const ; // rotation around y-axis - inline float gamma ( ) const ; // rotation around x-axis - inline float da ( ) const ; - inline float db ( ) const ; - inline float dg ( ) const ; // old deltas - inline int type ( ) const ; // what type of surface was this initially - inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces - inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces - inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject - inline float canon_area ( ) const ; - inline int noscale ( ) const ; // don't scale by surface area if true - inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) - inline float dy2 ( size_t i ) const ; - inline float dz2 ( size_t i ) const ; - inline PCOLOR_TABLE ct ( ) const ; - inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) - inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 - inline MRIS_cmdlines_t cmdlines ( ) const ; - inline int ncmds ( ) const ; - inline float group_avg_surface_area ( ) const ; // average of total surface area for group - inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex - inline int triangle_links_removed ( ) const ; // for quad surfaces - inline p_void user_parms ( ) const ; // for whatever the user wants to hang here - inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel - inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for - inline p_void mht ( ) const ; - inline p_void temps ( ) const ; + inline int nverticesFrozen ( ) const ; // # of vertices on surface is frozen + inline int nvertices ( ) const ; // # of vertices on surface, change by calling MRISreallocVerticesAndFaces et al + inline int nfaces ( ) const ; // # of faces on surface, change by calling MRISreallocVerticesAndFaces et al + inline bool faceAttachmentDeferred ( ) const ; // defer connecting faces to vertices for performance reasons + inline int nedges ( ) const ; // # of edges on surface + inline int ncorners ( ) const ; // # of triangle corners + inline int nstrips ( ) const ; + inline Vertex vertices ( size_t i ) const ; + inline p_p_void dist_storage ( ) const ; // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored + inline p_p_void dist_orig_storage ( ) const ; // the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored + inline int tempsAssigned ( ) const ; // State of various temp fields that can be borrowed if not already in use + inline Face faces ( size_t i ) const ; + inline MRI_EDGE edges ( size_t i ) const ; + inline MRI_CORNER corners ( size_t i ) const ; + inline FaceNormCacheEntry faceNormCacheEntries ( size_t i ) const ; + inline FaceNormDeferredEntry faceNormDeferredEntries ( size_t i ) const ; + inline int initialized ( ) const ; + inline PLTA lta ( ) const ; + inline PMATRIX SRASToTalSRAS_ ( ) const ; + inline PMATRIX TalSRASToSRAS_ ( ) const ; + inline int free_transform ( ) const ; + inline double radius ( ) const ; // radius (if status==MRIS_SPHERE) + inline float a ( ) const ; + inline float b ( ) const ; + inline float c ( ) const ; // ellipsoid parameters + inline MRIS_fname_t fname ( ) const ; // file it was originally loaded from + inline MRIS_Status status ( ) const ; // type of surface (e.g. sphere, plane) + inline MRIS_Status origxyz_status ( ) const ; // type of surface (e.g. sphere, plane) that this origxyz were obtained from + inline int patch ( ) const ; // if a patch of the surface + inline p_void vp ( ) const ; // for misc. use + inline float alpha ( ) const ; // rotation around z-axis + inline float beta ( ) const ; // rotation around y-axis + inline float gamma ( ) const ; // rotation around x-axis + inline float da ( ) const ; + inline float db ( ) const ; + inline float dg ( ) const ; // old deltas + inline int type ( ) const ; // what type of surface was this initially + inline int max_vertices ( ) const ; // may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces + inline int max_faces ( ) const ; // may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces + inline MRIS_subject_name_t subject_name ( ) const ; // name of the subject + inline float canon_area ( ) const ; + inline int noscale ( ) const ; // don't scale by surface area if true + inline float dx2 ( size_t i ) const ; // an extra set of gradient (not always alloced) + inline float dy2 ( size_t i ) const ; + inline float dz2 ( size_t i ) const ; + inline PCOLOR_TABLE ct ( ) const ; + inline int useRealRAS ( ) const ; // if 0 (default), vertex position is a conformed volume RAS with c_(r,"a","s")=0. else is a real RAS (volume stored RAS) + inline VOL_GEOM vg ( ) const ; // volume info from which this surface is created. valid iff vg.valid = 1 + inline MRIS_cmdlines_t cmdlines ( ) const ; + inline int ncmds ( ) const ; + inline float group_avg_surface_area ( ) const ; // average of total surface area for group + inline int group_avg_vtxarea_loaded ( ) const ; // average vertex area for group at each vertex + inline int triangle_links_removed ( ) const ; // for quad surfaces + inline p_void user_parms ( ) const ; // for whatever the user wants to hang here + inline PMATRIX m_sras2vox ( ) const ; // for converting surface ras to voxel + inline PMRI mri_sras2vox ( ) const ; // volume that the above matrix is for + inline p_void mht ( ) const ; + inline p_void temps ( ) const ; - inline void set_vp ( p_void to ) ; // for misc. use - inline void set_alpha ( float to ) ; // rotation around z-axis - inline void set_beta ( float to ) ; // rotation around y-axis - inline void set_gamma ( float to ) ; // rotation around x-axis - inline void set_da ( float to ) ; - inline void set_db ( float to ) ; - inline void set_dg ( float to ) ; // old deltas - inline void set_type ( int to ) ; // what type of surface was this initially - }; + inline void set_vp ( p_void to ) ; // for misc. use + inline void set_alpha ( float to ) ; // rotation around z-axis + inline void set_beta ( float to ) ; // rotation around y-axis + inline void set_gamma ( float to ) ; // rotation around x-axis + inline void set_da ( float to ) ; + inline void set_db ( float to ) ; + inline void set_dg ( float to ) ; // old deltas + inline void set_type ( int to ) ; // what type of surface was this initially + }; // Surface } // namespace XYZPositionM diff --git a/include/mrisurf_SurfaceFromMRIS_generated_prefix.h b/include/mrisurf_SurfaceFromMRIS_generated_prefix.h index 1761af9594c..73963ca06f1 100644 --- a/include/mrisurf_SurfaceFromMRIS_generated_prefix.h +++ b/include/mrisurf_SurfaceFromMRIS_generated_prefix.h @@ -1,7 +1,9 @@ +#pragma once // GENERATED SOURCE - DO NOT DIRECTLY EDIT // // ======================================= +#include "mrisurf_aaa.h" namespace SurfaceFromMRIS { typedef MRIS Representation; diff --git a/include/mrisurf_SurfaceFromMRIS_generated_suffix.h b/include/mrisurf_SurfaceFromMRIS_generated_suffix.h index 149453543e5..0e2e5c5153b 100644 --- a/include/mrisurf_SurfaceFromMRIS_generated_suffix.h +++ b/include/mrisurf_SurfaceFromMRIS_generated_suffix.h @@ -1,7 +1,9 @@ +#pragma once // GENERATED SOURCE - DO NOT DIRECTLY EDIT // // ======================================= +#include "mrisurf_aaa.h" namespace SurfaceFromMRIS { typedef MRIS Representation; @@ -247,7 +249,7 @@ namespace SurfaceFromMRIS { return Face(repr,repr->vertices_topology[idx].f[i]); } size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex - return size_t(repr->vertices_topology[idx].n[i]); + return repr->vertices_topology[idx].n[i]; } int Vertex::e(size_t i) const { // edge state for neighboring vertices return repr->vertices_topology[idx].e[i]; @@ -255,7 +257,7 @@ namespace SurfaceFromMRIS { Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops return Vertex(repr,repr->vertices_topology[idx].v[i]); } - short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i, + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) return repr->vertices_topology[idx].vnum; } short Vertex::v2num() const { // number of 1, or 2-hop neighbors @@ -328,11 +330,14 @@ namespace SurfaceFromMRIS { int Surface::nedges() const { // # of edges on surface return repr->nedges; } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } int Surface::nstrips() const { return repr->nstrips; } Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + return Vertex(repr, i); } p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored return repr->dist_storage; @@ -344,11 +349,14 @@ namespace SurfaceFromMRIS { return repr->tempsAssigned; } Face Surface::faces(size_t i) const { - return Face(repr,i); + return Face(repr, i); } MRI_EDGE Surface::edges(size_t i) const { return repr->edges[i]; } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { return repr->faceNormCacheEntries[i]; } @@ -513,7 +521,7 @@ namespace SurfaceFromMRIS { return Face(repr,repr->vertices_topology[idx].f[i]); } size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex - return size_t(repr->vertices_topology[idx].n[i]); + return repr->vertices_topology[idx].n[i]; } int Vertex::e(size_t i) const { // edge state for neighboring vertices return repr->vertices_topology[idx].e[i]; @@ -521,7 +529,7 @@ namespace SurfaceFromMRIS { Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops return Vertex(repr,repr->vertices_topology[idx].v[i]); } - short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i, + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) return repr->vertices_topology[idx].vnum; } short Vertex::v2num() const { // number of 1, or 2-hop neighbors @@ -640,11 +648,14 @@ namespace SurfaceFromMRIS { int Surface::nedges() const { // # of edges on surface return repr->nedges; } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } int Surface::nstrips() const { return repr->nstrips; } Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + return Vertex(repr, i); } p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored return repr->dist_storage; @@ -656,11 +667,14 @@ namespace SurfaceFromMRIS { return repr->tempsAssigned; } Face Surface::faces(size_t i) const { - return Face(repr,i); + return Face(repr, i); } MRI_EDGE Surface::edges(size_t i) const { return repr->edges[i]; } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { return repr->faceNormCacheEntries[i]; } @@ -888,7 +902,7 @@ namespace SurfaceFromMRIS { return Face(repr,repr->vertices_topology[idx].f[i]); } size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex - return size_t(repr->vertices_topology[idx].n[i]); + return repr->vertices_topology[idx].n[i]; } int Vertex::e(size_t i) const { // edge state for neighboring vertices return repr->vertices_topology[idx].e[i]; @@ -896,7 +910,7 @@ namespace SurfaceFromMRIS { Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops return Vertex(repr,repr->vertices_topology[idx].v[i]); } - short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i, + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) return repr->vertices_topology[idx].vnum; } short Vertex::v2num() const { // number of 1, or 2-hop neighbors @@ -1034,11 +1048,14 @@ namespace SurfaceFromMRIS { int Surface::nedges() const { // # of edges on surface return repr->nedges; } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } int Surface::nstrips() const { return repr->nstrips; } Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + return Vertex(repr, i); } p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored return repr->dist_storage; @@ -1050,11 +1067,14 @@ namespace SurfaceFromMRIS { return repr->tempsAssigned; } Face Surface::faces(size_t i) const { - return Face(repr,i); + return Face(repr, i); } MRI_EDGE Surface::edges(size_t i) const { return repr->edges[i]; } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { return repr->faceNormCacheEntries[i]; } @@ -1101,13 +1121,13 @@ namespace SurfaceFromMRIS { return repr->z0; } Vertex Surface::v_temporal_pole() const { - return Vertex(repr,repr->v_temporal_pole - repr->vertices); + return Vertex(repr, repr->v_temporal_pole - repr->vertices); } Vertex Surface::v_frontal_pole() const { - return Vertex(repr,repr->v_frontal_pole - repr->vertices); + return Vertex(repr, repr->v_frontal_pole - repr->vertices); } Vertex Surface::v_occipital_pole() const { - return Vertex(repr,repr->v_occipital_pole - repr->vertices); + return Vertex(repr, repr->v_occipital_pole - repr->vertices); } float Surface::max_curv() const { return repr->max_curv; @@ -1467,7 +1487,7 @@ namespace SurfaceFromMRIS { return Face(repr,repr->vertices_topology[idx].f[i]); } size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex - return size_t(repr->vertices_topology[idx].n[i]); + return repr->vertices_topology[idx].n[i]; } int Vertex::e(size_t i) const { // edge state for neighboring vertices return repr->vertices_topology[idx].e[i]; @@ -1475,7 +1495,7 @@ namespace SurfaceFromMRIS { Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops return Vertex(repr,repr->vertices_topology[idx].v[i]); } - short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i, + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) return repr->vertices_topology[idx].vnum; } short Vertex::v2num() const { // number of 1, or 2-hop neighbors @@ -2199,11 +2219,14 @@ namespace SurfaceFromMRIS { int Surface::nedges() const { // # of edges on surface return repr->nedges; } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } int Surface::nstrips() const { return repr->nstrips; } Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + return Vertex(repr, i); } p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored return repr->dist_storage; @@ -2215,11 +2238,14 @@ namespace SurfaceFromMRIS { return repr->tempsAssigned; } Face Surface::faces(size_t i) const { - return Face(repr,i); + return Face(repr, i); } MRI_EDGE Surface::edges(size_t i) const { return repr->edges[i]; } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { return repr->faceNormCacheEntries[i]; } @@ -2266,13 +2292,13 @@ namespace SurfaceFromMRIS { return repr->z0; } Vertex Surface::v_temporal_pole() const { - return Vertex(repr,repr->v_temporal_pole - repr->vertices); + return Vertex(repr, repr->v_temporal_pole - repr->vertices); } Vertex Surface::v_frontal_pole() const { - return Vertex(repr,repr->v_frontal_pole - repr->vertices); + return Vertex(repr, repr->v_frontal_pole - repr->vertices); } Vertex Surface::v_occipital_pole() const { - return Vertex(repr,repr->v_occipital_pole - repr->vertices); + return Vertex(repr, repr->v_occipital_pole - repr->vertices); } float Surface::max_curv() const { return repr->max_curv; @@ -2628,7 +2654,7 @@ namespace SurfaceFromMRIS { return Face(repr,repr->vertices_topology[idx].f[i]); } size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex - return size_t(repr->vertices_topology[idx].n[i]); + return repr->vertices_topology[idx].n[i]; } int Vertex::e(size_t i) const { // edge state for neighboring vertices return repr->vertices_topology[idx].e[i]; @@ -2636,7 +2662,7 @@ namespace SurfaceFromMRIS { Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops return Vertex(repr,repr->vertices_topology[idx].v[i]); } - short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i, + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) return repr->vertices_topology[idx].vnum; } short Vertex::v2num() const { // number of 1, or 2-hop neighbors @@ -3358,11 +3384,14 @@ namespace SurfaceFromMRIS { int Surface::nedges() const { // # of edges on surface return repr->nedges; } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } int Surface::nstrips() const { return repr->nstrips; } Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + return Vertex(repr, i); } p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored return repr->dist_storage; @@ -3374,11 +3403,14 @@ namespace SurfaceFromMRIS { return repr->tempsAssigned; } Face Surface::faces(size_t i) const { - return Face(repr,i); + return Face(repr, i); } MRI_EDGE Surface::edges(size_t i) const { return repr->edges[i]; } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { return repr->faceNormCacheEntries[i]; } @@ -3425,13 +3457,13 @@ namespace SurfaceFromMRIS { return repr->z0; } Vertex Surface::v_temporal_pole() const { - return Vertex(repr,repr->v_temporal_pole - repr->vertices); + return Vertex(repr, repr->v_temporal_pole - repr->vertices); } Vertex Surface::v_frontal_pole() const { - return Vertex(repr,repr->v_frontal_pole - repr->vertices); + return Vertex(repr, repr->v_frontal_pole - repr->vertices); } Vertex Surface::v_occipital_pole() const { - return Vertex(repr,repr->v_occipital_pole - repr->vertices); + return Vertex(repr, repr->v_occipital_pole - repr->vertices); } float Surface::max_curv() const { return repr->max_curv; @@ -3941,7 +3973,7 @@ namespace SurfaceFromMRIS { return Face(repr,repr->vertices_topology[idx].f[i]); } size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex - return size_t(repr->vertices_topology[idx].n[i]); + return repr->vertices_topology[idx].n[i]; } int Vertex::e(size_t i) const { // edge state for neighboring vertices return repr->vertices_topology[idx].e[i]; @@ -3949,7 +3981,7 @@ namespace SurfaceFromMRIS { Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops return Vertex(repr,repr->vertices_topology[idx].v[i]); } - short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i, + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) return repr->vertices_topology[idx].vnum; } short Vertex::v2num() const { // number of 1, or 2-hop neighbors @@ -3992,9 +4024,9 @@ namespace SurfaceFromMRIS { void Vertex::set_v(size_t i, Vertex to) { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops cheapAssert(repr == to.repr); repr->vertices_topology[idx].v[i] = to.idx; } - //void Vertex::set_vnum(short to) { // number of 1-hop neighbors should use [p]VERTEXvnum(i, - // repr->vertices_topology[idx].vnum = to; - //} + void Vertex::set_vnum(short to) { // number of 1-hop neighbors should use [p]VERTEXvnum(i) + repr->vertices_topology[idx].vnum = to; + } void Vertex::set_v2num(short to) { // number of 1, or 2-hop neighbors repr->vertices_topology[idx].v2num = to; } @@ -4041,11 +4073,14 @@ namespace SurfaceFromMRIS { int Surface::nedges() const { // # of edges on surface return repr->nedges; } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } int Surface::nstrips() const { return repr->nstrips; } Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + return Vertex(repr, i); } p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored return repr->dist_storage; @@ -4057,11 +4092,14 @@ namespace SurfaceFromMRIS { return repr->tempsAssigned; } Face Surface::faces(size_t i) const { - return Face(repr,i); + return Face(repr, i); } MRI_EDGE Surface::edges(size_t i) const { return repr->edges[i]; } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { return repr->faceNormCacheEntries[i]; } @@ -4214,7 +4252,7 @@ namespace SurfaceFromMRIS { return Face(repr,repr->vertices_topology[idx].f[i]); } size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex - return size_t(repr->vertices_topology[idx].n[i]); + return repr->vertices_topology[idx].n[i]; } int Vertex::e(size_t i) const { // edge state for neighboring vertices return repr->vertices_topology[idx].e[i]; @@ -4222,7 +4260,7 @@ namespace SurfaceFromMRIS { Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops return Vertex(repr,repr->vertices_topology[idx].v[i]); } - short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i, + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) return repr->vertices_topology[idx].vnum; } short Vertex::v2num() const { // number of 1, or 2-hop neighbors @@ -4344,11 +4382,14 @@ namespace SurfaceFromMRIS { int Surface::nedges() const { // # of edges on surface return repr->nedges; } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } int Surface::nstrips() const { return repr->nstrips; } Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + return Vertex(repr, i); } p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored return repr->dist_storage; @@ -4360,11 +4401,14 @@ namespace SurfaceFromMRIS { return repr->tempsAssigned; } Face Surface::faces(size_t i) const { - return Face(repr,i); + return Face(repr, i); } MRI_EDGE Surface::edges(size_t i) const { return repr->edges[i]; } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { return repr->faceNormCacheEntries[i]; } @@ -4596,7 +4640,7 @@ namespace SurfaceFromMRIS { return Face(repr,repr->vertices_topology[idx].f[i]); } size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex - return size_t(repr->vertices_topology[idx].n[i]); + return repr->vertices_topology[idx].n[i]; } int Vertex::e(size_t i) const { // edge state for neighboring vertices return repr->vertices_topology[idx].e[i]; @@ -4604,7 +4648,7 @@ namespace SurfaceFromMRIS { Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops return Vertex(repr,repr->vertices_topology[idx].v[i]); } - short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i, + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) return repr->vertices_topology[idx].vnum; } short Vertex::v2num() const { // number of 1, or 2-hop neighbors @@ -4741,11 +4785,14 @@ namespace SurfaceFromMRIS { int Surface::nedges() const { // # of edges on surface return repr->nedges; } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } int Surface::nstrips() const { return repr->nstrips; } Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + return Vertex(repr, i); } p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored return repr->dist_storage; @@ -4757,11 +4804,14 @@ namespace SurfaceFromMRIS { return repr->tempsAssigned; } Face Surface::faces(size_t i) const { - return Face(repr,i); + return Face(repr, i); } MRI_EDGE Surface::edges(size_t i) const { return repr->edges[i]; } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { return repr->faceNormCacheEntries[i]; } @@ -4808,13 +4858,13 @@ namespace SurfaceFromMRIS { return repr->z0; } Vertex Surface::v_temporal_pole() const { - return Vertex(repr,repr->v_temporal_pole - repr->vertices); + return Vertex(repr, repr->v_temporal_pole - repr->vertices); } Vertex Surface::v_frontal_pole() const { - return Vertex(repr,repr->v_frontal_pole - repr->vertices); + return Vertex(repr, repr->v_frontal_pole - repr->vertices); } Vertex Surface::v_occipital_pole() const { - return Vertex(repr,repr->v_occipital_pole - repr->vertices); + return Vertex(repr, repr->v_occipital_pole - repr->vertices); } float Surface::max_curv() const { return repr->max_curv; @@ -5185,7 +5235,7 @@ namespace SurfaceFromMRIS { return Face(repr,repr->vertices_topology[idx].f[i]); } size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex - return size_t(repr->vertices_topology[idx].n[i]); + return repr->vertices_topology[idx].n[i]; } int Vertex::e(size_t i) const { // edge state for neighboring vertices return repr->vertices_topology[idx].e[i]; @@ -5193,7 +5243,7 @@ namespace SurfaceFromMRIS { Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops return Vertex(repr,repr->vertices_topology[idx].v[i]); } - short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i, + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) return repr->vertices_topology[idx].vnum; } short Vertex::v2num() const { // number of 1, or 2-hop neighbors @@ -5915,11 +5965,14 @@ namespace SurfaceFromMRIS { int Surface::nedges() const { // # of edges on surface return repr->nedges; } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } int Surface::nstrips() const { return repr->nstrips; } Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + return Vertex(repr, i); } p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored return repr->dist_storage; @@ -5931,11 +5984,14 @@ namespace SurfaceFromMRIS { return repr->tempsAssigned; } Face Surface::faces(size_t i) const { - return Face(repr,i); + return Face(repr, i); } MRI_EDGE Surface::edges(size_t i) const { return repr->edges[i]; } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { return repr->faceNormCacheEntries[i]; } @@ -5982,13 +6038,13 @@ namespace SurfaceFromMRIS { return repr->z0; } Vertex Surface::v_temporal_pole() const { - return Vertex(repr,repr->v_temporal_pole - repr->vertices); + return Vertex(repr, repr->v_temporal_pole - repr->vertices); } Vertex Surface::v_frontal_pole() const { - return Vertex(repr,repr->v_frontal_pole - repr->vertices); + return Vertex(repr, repr->v_frontal_pole - repr->vertices); } Vertex Surface::v_occipital_pole() const { - return Vertex(repr,repr->v_occipital_pole - repr->vertices); + return Vertex(repr, repr->v_occipital_pole - repr->vertices); } float Surface::max_curv() const { return repr->max_curv; @@ -6344,7 +6400,7 @@ namespace SurfaceFromMRIS { return Face(repr,repr->vertices_topology[idx].f[i]); } size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex - return size_t(repr->vertices_topology[idx].n[i]); + return repr->vertices_topology[idx].n[i]; } int Vertex::e(size_t i) const { // edge state for neighboring vertices return repr->vertices_topology[idx].e[i]; @@ -6352,7 +6408,7 @@ namespace SurfaceFromMRIS { Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops return Vertex(repr,repr->vertices_topology[idx].v[i]); } - short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i, + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) return repr->vertices_topology[idx].vnum; } short Vertex::v2num() const { // number of 1, or 2-hop neighbors @@ -7074,11 +7130,14 @@ namespace SurfaceFromMRIS { int Surface::nedges() const { // # of edges on surface return repr->nedges; } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } int Surface::nstrips() const { return repr->nstrips; } Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + return Vertex(repr, i); } p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored return repr->dist_storage; @@ -7090,11 +7149,14 @@ namespace SurfaceFromMRIS { return repr->tempsAssigned; } Face Surface::faces(size_t i) const { - return Face(repr,i); + return Face(repr, i); } MRI_EDGE Surface::edges(size_t i) const { return repr->edges[i]; } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { return repr->faceNormCacheEntries[i]; } @@ -7141,13 +7203,13 @@ namespace SurfaceFromMRIS { return repr->z0; } Vertex Surface::v_temporal_pole() const { - return Vertex(repr,repr->v_temporal_pole - repr->vertices); + return Vertex(repr, repr->v_temporal_pole - repr->vertices); } Vertex Surface::v_frontal_pole() const { - return Vertex(repr,repr->v_frontal_pole - repr->vertices); + return Vertex(repr, repr->v_frontal_pole - repr->vertices); } Vertex Surface::v_occipital_pole() const { - return Vertex(repr,repr->v_occipital_pole - repr->vertices); + return Vertex(repr, repr->v_occipital_pole - repr->vertices); } float Surface::max_curv() const { return repr->max_curv; @@ -7516,7 +7578,7 @@ namespace SurfaceFromMRIS { return Face(repr,repr->vertices_topology[idx].f[i]); } size_t Vertex::n(size_t i) const { // size() is num. array[v->num] the face.v[*] index for this vertex - return size_t(repr->vertices_topology[idx].n[i]); + return repr->vertices_topology[idx].n[i]; } int Vertex::e(size_t i) const { // edge state for neighboring vertices return repr->vertices_topology[idx].e[i]; @@ -7524,7 +7586,7 @@ namespace SurfaceFromMRIS { Vertex Vertex::v(size_t i) const { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops return Vertex(repr,repr->vertices_topology[idx].v[i]); } - short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i, + short Vertex::vnum() const { // number of 1-hop neighbors should use [p]VERTEXvnum(i) return repr->vertices_topology[idx].vnum; } short Vertex::v2num() const { // number of 1, or 2-hop neighbors @@ -7912,9 +7974,9 @@ namespace SurfaceFromMRIS { void Vertex::set_v(size_t i, Vertex to) { // size() is vtotal. array[v->vtotal or more] of vno, head sorted by hops cheapAssert(repr == to.repr); repr->vertices_topology[idx].v[i] = to.idx; } - //void Vertex::set_vnum(short to) { // number of 1-hop neighbors should use [p]VERTEXvnum(i, - // repr->vertices_topology[idx].vnum = to; - //} + void Vertex::set_vnum(short to) { // number of 1-hop neighbors should use [p]VERTEXvnum(i) + repr->vertices_topology[idx].vnum = to; + } void Vertex::set_v2num(short to) { // number of 1, or 2-hop neighbors repr->vertices_topology[idx].v2num = to; } @@ -8284,11 +8346,14 @@ namespace SurfaceFromMRIS { int Surface::nedges() const { // # of edges on surface return repr->nedges; } + int Surface::ncorners() const { // # of triangle corners + return repr->ncorners; + } int Surface::nstrips() const { return repr->nstrips; } Vertex Surface::vertices(size_t i) const { - return Vertex(repr,i); + return Vertex(repr, i); } p_p_void Surface::dist_storage() const { // the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored return repr->dist_storage; @@ -8300,11 +8365,14 @@ namespace SurfaceFromMRIS { return repr->tempsAssigned; } Face Surface::faces(size_t i) const { - return Face(repr,i); + return Face(repr, i); } MRI_EDGE Surface::edges(size_t i) const { return repr->edges[i]; } + MRI_CORNER Surface::corners(size_t i) const { + return repr->corners[i]; + } FaceNormCacheEntry Surface::faceNormCacheEntries(size_t i) const { return repr->faceNormCacheEntries[i]; } @@ -8351,13 +8419,13 @@ namespace SurfaceFromMRIS { return repr->z0; } Vertex Surface::v_temporal_pole() const { - return Vertex(repr,repr->v_temporal_pole - repr->vertices); + return Vertex(repr, repr->v_temporal_pole - repr->vertices); } Vertex Surface::v_frontal_pole() const { - return Vertex(repr,repr->v_frontal_pole - repr->vertices); + return Vertex(repr, repr->v_frontal_pole - repr->vertices); } Vertex Surface::v_occipital_pole() const { - return Vertex(repr,repr->v_occipital_pole - repr->vertices); + return Vertex(repr, repr->v_occipital_pole - repr->vertices); } float Surface::max_curv() const { return repr->max_curv; diff --git a/include/mrisurf_aaa.h b/include/mrisurf_aaa.h index 0b5121d8cf3..8cd9c79d4f5 100644 --- a/include/mrisurf_aaa.h +++ b/include/mrisurf_aaa.h @@ -30,6 +30,8 @@ #include "matrix.h" #include "dmatrix.h" +#define MAX_NEIGHBORS (1024) +#define MRIS_MAX_NEIGHBORHOOD_LINKS 50 // bound on nlinks #define MAX_SURFACES 20 #define TALAIRACH_COORDS 0 @@ -213,6 +215,7 @@ STRIP; typedef int* pSeveralInt; typedef uchar* pSeveralUchar; typedef float* pSeveralFloat; +typedef float const* pSeveralConstFloat; typedef void* p_void; typedef void** p_p_void; @@ -239,11 +242,16 @@ typedef FaceNormDeferredEntry* pSeveralFaceNormDeferredEntry; // MRIS supplies a rich world, but in a format that causes lots of memory traffic // +// It is defined in mrisurf_FACE_VERTEX_MRIS_generated.h +// typedef struct MRIS MRIS,MRI_SURFACE; // Prefer using MRIS -// MRIS_MP is a much more efficient supplier of MetricProperties data than MRIS. -// It is implemented in mrisurf_mp.h +// MRIS_MP is a much more efficient supplier of MetricProperties data than MRIS, +// but can get some of its properties from an underlying Surface so it doesn't have to +// implement or copy ones that are rarely used. +// +// It is defined in mrisurf_MRIS_MPPropertiesInVectors.h with some additional macros in mrisurf_mp.h // // It is optimized to cope with the XYZ changing as the shape is mutated to optimize some SSE. // Its representation keeps the data in a format that fills cache lines with immediately @@ -252,13 +260,28 @@ typedef struct MRIS MRIS,MRI_SURFACE; // Prefer using MRIS typedef struct MRIS_MP MRIS_MP; +// MRISPV is a much more efficient supplier of MetricProperties data than MRIS +// and hold all the data. It is not yet fully implemented. +// +// It is defined in mrisurf_MRIS_PropertiesInVectors.h +// +// It is optimized to cope with the XYZ changing as the shape is mutated to optimize some SSE. +// Its representation keeps the data in a format that fills cache lines with immediately +// needed information. +// +typedef struct MRISPV MRISPV; + + // The SSE calculation uses some large subsystems, such as MHT, that are coded // using the MRIS. Ideally we would use C++, a class derivation hierachy, and // virtual functions or C++ templates to implement these functions on top of both // MRIS and MRIS_MP // -// The following is basically a base class with virtual functions. -// It is implemented in mrisurf_MRISBase.h +// The following precedes the change to C++, +// should be elikminated asap. +// It is a crude implementation of a base class with virtual functions. +// +// It is further defined in mrisurf_MRISBase.h // typedef struct MRISBase { MRIS_MP* mris_mp; // takes precidence over mris diff --git a/include/mrisurf_base.h b/include/mrisurf_base.h index 5fc733b9a9f..f40fc43fcf0 100644 --- a/include/mrisurf_base.h +++ b/include/mrisurf_base.h @@ -358,3 +358,16 @@ void notifyActiveRealmTreesChangedNFacesNVertices(MRIS const * const mris); extern const char *mrisurf_surface_names[3]; extern const char *curvature_names[3]; int MRISprintCurvatureNames(FILE *fp); + + +#if MATRIX_ALLOCATION +extern MATRIX *VoxelFromSRASmatrix; +int mriSurfaceRASToVoxel(double xr, double yr, double zr, double *xv, double *yv, double *zv); +#endif + +#if SPHERE_INTERSECTION +int containsAnotherVertexOnSphere(MRIS *mris, int vno0, int vno1, int vno2, int mode); +#else +int containsAnotherVertex(MRIS *mris, int vno0, int vno1, int vno2, double e0[3], double e1[3], double origin[3]); +#endif + diff --git a/include/mrisurf_metricProperties.h b/include/mrisurf_metricProperties.h index 1be01c43fb5..ffbf0b642d7 100644 --- a/include/mrisurf_metricProperties.h +++ b/include/mrisurf_metricProperties.h @@ -20,6 +20,8 @@ // The positions of the vertices and the immediate consequences of that // #include "mrisurf_topology.h" +#include "topo_parms.h" +#include "realm.h" int mrisCheckSurface( MRIS * mris); bool mrisCheckDist (MRIS const * mris); @@ -27,6 +29,9 @@ bool mrisCheckDistOrig(MRIS const * mris); void MRISmakeDist(MRIS *mris, int vno); + + + typedef struct PerThreadMRIDistance { MRI const * mri_distance; int heightTimesDepth,depth; @@ -75,17 +80,8 @@ extern double l_vol; extern double l_surf; extern double l_wm; -#if SPHERE_INTERSECTION -int containsAnotherVertexOnSphere(MRIS *mris, int vno0, int vno1, int vno2, int mode); -#else -int containsAnotherVertex(MRIS *mris, int vno0, int vno1, int vno2, double e0[3], double e1[3], double origin[3]); -#endif - void computeVertexPseudoNormal(MRIS const *mris, int vno, float norm[3], int verbose); -void computeDefectFaceNormal_calculate( - MRIS const * const mris, int const fno, float* p_nx, float* p_ny, float* p_nz, float* p_orig_area); - void setFaceNorm (MRIS const * const mris, int fno, float nx, float ny, float nz); void setFaceOrigArea(MRIS const * const mris, int fno, float orig_area); float getFaceOrigArea(MRIS const * const mris, int fno); @@ -122,6 +118,11 @@ float MRIScomputeOrigArea (MRIS* mris); void MRISsetOrigArea (MRIS* mris); +FaceNormCacheEntry const * getFaceNorm(MRIS const * const mris, int fno); +FaceNormCacheEntry const * getFaceNorm(MRIS_MP const * const mris, int fno); +void setFaceNorm(MRIS const * const mris, int fno, float nx, float ny, float nz); +void setFaceNorm(MRIS_MP const * const mris, int fno, float nx, float ny, float nz); + int mrisComputeBoundaryNormals(MRIS *mris); int mrisComputeCurvatureMinMax(MRIS *mris); @@ -139,11 +140,6 @@ float mrisDefectFaceMRILogLikelihood( float mrisDefectVertexMRILogLikelihood( MRIS *mris, MRI *mri, TP *tp, HISTOGRAM *h_white, HISTOGRAM *h_gray, HISTOGRAM *h_grad, MRI *mri_gray_white); -#if MATRIX_ALLOCATION -extern MATRIX *VoxelFromSRASmatrix; -int mriSurfaceRASToVoxel(double xr, double yr, double zr, double *xv, double *yv, double *zv); -#endif - float mrisSampleAshburnerTriangleEnergy (MRIS * const mris, int const vno, INTEGRATION_PARMS * const parms, float cx, float cy, float cz); float mrisSampleMinimizationEnergy (MRIS *mris, int const vno, INTEGRATION_PARMS *parms, float cx, float cy, float cz); float mrisSampleParallelEnergyAtVertex (MRIS *mris, int const vno, INTEGRATION_PARMS *parms); @@ -167,9 +163,9 @@ static void constructComputeDefectContext(ComputeDefectContext* computeDefectCon bzero(computeDefectContext, sizeof(*computeDefectContext)); } -void computeDefectFaceNormal_calculate( - MRIS const * const mris, int const fno, float* p_nx, float* p_ny, float* p_nz, float* p_orig_area); - #define VERTEX_EDGE(vec, v0, v1) VECTOR_LOAD(vec, v1->x - v0->x, v1->y - v0->y, v1->z - v0->z) #define VERTEX_ORIG_EDGE(vec, v0, v1) VECTOR_LOAD(vec, v1->origx - v0->origx, v1->origy - v0->origy, v1->origz - v0->origz) #define VERTEX_CANONICAL_EDGE(vec, v0, v1) VECTOR_LOAD(vec, v1->cx - v0->cx, v1->cy - v0->cy, v1->cz - v0->cz) + + +void MRIScomputeMetricProperties(MRIS_MP* mris); diff --git a/include/mrisurf_project.h b/include/mrisurf_project.h index cbee2907068..d3112d1ad7c 100644 --- a/include/mrisurf_project.h +++ b/include/mrisurf_project.h @@ -21,8 +21,15 @@ #include "mrisurf_metricProperties.h" void mrisSphericalProjectXYZ(float xs, float ys, float zs, float *xd, float *yd, float *zd); -void mrisSphericalProjection(MRIS *mris); +void mrisSphericalProjection(MRIS * mris); +void mrisAssignFaces(MRIS* mris, MHT *mht, int which_vertices); -void MRISMP_projectOntoSphere(MRIS_MP* mris, double r); -void mrisAssignFaces(MRIS* mris, MHT *mht, int which_vertices); +MRIS* MRISprojectOntoSphere (MRIS* mris_src, MRIS* mris_dst, double r) ; // for now, mris_src and mris_dst must be the same pointer +MRIS* MRISprojectOntoEllipsoid(MRIS* mris_src, MRIS* mris_dst, float a, float b, float c) ; + + +// Ones that are supported by MRIS and MRIS_MP +// +MRIS* MRISprojectOntoSphere(MRIS* mris, double r); +MRIS_MP* MRISprojectOntoSphere(MRIS_MP* mris, double r); diff --git a/include/mrisurf_sseTerms.h b/include/mrisurf_sseTerms.h index db97f54a6a8..b9710d19329 100644 --- a/include/mrisurf_sseTerms.h +++ b/include/mrisurf_sseTerms.h @@ -22,7 +22,7 @@ // and using either the MRIS or another representation of the Surface Face Vertex information // #include "mrisurf_metricProperties.h" - +#include "voxlist.h" // misc // @@ -44,8 +44,14 @@ void mrismp_ComputeFaceRelevantAngleAndArea(MRIS_MP* mris, INTEGRATION_PARMS *pa int mrisAverageSignedGradients (MRIS* mris, int num_avgs); int mrisComputePositioningGradients (MRIS* mris, INTEGRATION_PARMS *parms); -double MRIScomputeSSE (MRI_SURFACE *mris, INTEGRATION_PARMS *parms); -double MRIScomputeSSEExternal(MRI_SURFACE *mris, INTEGRATION_PARMS *parms, double *ext_sse); +bool MRIScomputeSSE_canDo (MRIS* mris, INTEGRATION_PARMS *parms); +bool MRIScomputeSSE_canDo (MRIS_MP* mris, INTEGRATION_PARMS *parms); + +double MRIScomputeSSE (MRIS* mris, INTEGRATION_PARMS *parms); +double MRIScomputeSSEExternal(MRIS* mris, INTEGRATION_PARMS *parms, double *ext_sse); +double MRIScomputeSSE (MRIS_MP* mris, INTEGRATION_PARMS *parms); + + // MEF support // @@ -136,7 +142,7 @@ int mrisComputeIntensityTerm_mef (MRI_SURFACE *mris, LIST_OF_SSETERMS #undef ELT #define MRIS MRIS_MP -#define ELT(NAME, SIGNATURE, CALL) double mrismp_Compute##NAME SIGNATURE; +#define ELT(NAME, SIGNATURE, CALL) double mrisCompute##NAME SIGNATURE; LIST_OF_PER_VERTEX_SSETERMS_Implemented SEP LIST_OF_PER_FACE_SSETERMS #undef ELT #undef MRIS diff --git a/include/mrisurf_topology.h b/include/mrisurf_topology.h index 4e86b93c866..c22c76b5c12 100644 --- a/include/mrisurf_topology.h +++ b/include/mrisurf_topology.h @@ -18,7 +18,9 @@ * */ -#include "mrisurf_base.h" +#include "mrisurf_aaa.h" +#include "mrisurf.h" + // MRIS code dealing with the existence and connectedness of the vertices, edges, and faces // and with their partitioning into sets (ripped, marked, ...) diff --git a/mris_ca_label/mris_ca_label.cpp b/mris_ca_label/mris_ca_label.cpp index b4ea0f7792c..577d788d59c 100644 --- a/mris_ca_label/mris_ca_label.cpp +++ b/mris_ca_label/mris_ca_label.cpp @@ -33,9 +33,12 @@ #include #include -#include "mri.h" #include "macros.h" + +#include "mri.h" #include "mrisurf.h" +#include "mrisurf_project.h" + #include "error.h" #include "diag.h" #include "proto.h" diff --git a/mris_ca_train/mris_ca_train.cpp b/mris_ca_train/mris_ca_train.cpp index 7ca440d1577..1c3f3bf53b6 100644 --- a/mris_ca_train/mris_ca_train.cpp +++ b/mris_ca_train/mris_ca_train.cpp @@ -43,9 +43,12 @@ #include #include -#include "mri.h" #include "macros.h" + +#include "mri.h" #include "mrisurf.h" +#include "mrisurf_project.h" + #include "error.h" #include "diag.h" #include "proto.h" diff --git a/mris_diff/mris_diff.cpp b/mris_diff/mris_diff.cpp index d911d212aa1..a41b4938ba9 100644 --- a/mris_diff/mris_diff.cpp +++ b/mris_diff/mris_diff.cpp @@ -94,6 +94,7 @@ double round(double x); #include "macros.h" #include "utils.h" #include "mrisurf.h" +#include "mrisurf_metricProperties.h" #include "mrisutils.h" #include "error.h" #include "diag.h" diff --git a/mris_errors/mris_errors.cpp b/mris_errors/mris_errors.cpp index ab50e18de59..9bfcdeae63f 100644 --- a/mris_errors/mris_errors.cpp +++ b/mris_errors/mris_errors.cpp @@ -35,6 +35,7 @@ #include "diag.h" #include "proto.h" #include "mrisurf.h" +#include "mrisurf_metricProperties.h" #include "macros.h" #include "utils.h" #include "version.h" diff --git a/mris_fix_topology/mris_fix_topology.cpp b/mris_fix_topology/mris_fix_topology.cpp index 6c305537890..173e118ed25 100644 --- a/mris_fix_topology/mris_fix_topology.cpp +++ b/mris_fix_topology/mris_fix_topology.cpp @@ -37,18 +37,20 @@ #include #include -#include "romp_support.h" -#include "macros.h" +#include "mri.h" +#include "mrisurf.h" +#include "mrisurf_project.h" +#include "mrishash.h" +#include "icosahedron.h" + #include "error.h" -#include "tags.h" #include "diag.h" +#include "macros.h" + +#include "romp_support.h" +#include "tags.h" #include "proto.h" #include "timer.h" -#include "mrisurf.h" -#include "mri.h" -#include "macros.h" -#include "icosahedron.h" -#include "mrishash.h" #include "version.h" static char vcid[] = diff --git a/mris_parcellate_connectivity/mris_parcellate_connectivity.cpp b/mris_parcellate_connectivity/mris_parcellate_connectivity.cpp index c94f2be550a..6b9595b8aa4 100644 --- a/mris_parcellate_connectivity/mris_parcellate_connectivity.cpp +++ b/mris_parcellate_connectivity/mris_parcellate_connectivity.cpp @@ -29,8 +29,14 @@ #include #include -#include "mri.h" #include "macros.h" + +#include "mri.h" +#include "mrisurf.h" +#include "mrisurf_project.h" +#include "mrishash.h" +#include "icosahedron.h" + #include "error.h" #include "diag.h" #include "proto.h" @@ -38,9 +44,6 @@ #include "const.h" #include "timer.h" #include "version.h" -#include "mrisurf.h" -#include "mrishash.h" -#include "icosahedron.h" int main(int argc, char *argv[]) ; static int get_option(int argc, char *argv[]) ; diff --git a/mris_register/mris_register.cpp b/mris_register/mris_register.cpp index 46de8b42ea2..c60a6cb99b1 100644 --- a/mris_register/mris_register.cpp +++ b/mris_register/mris_register.cpp @@ -33,22 +33,26 @@ #include #include #include -#ifdef HAVE_OPENMP + +#include "macros.h" + +#include "mri.h" +#include "mrisurf.h" +#include "mrisurf_project.h" + #include "romp_support.h" -#endif #include "timer.h" -#include "macros.h" #include "error.h" #include "diag.h" #include "tags.h" #include "proto.h" -#include "mrisurf.h" -#include "mri.h" #include "macros.h" #include "version.h" #include "gcsa.h" +#define PARAM_IMAGES (IMAGES_PER_SURFACE * SURFACES) + static char vcid[] = "$Id: mris_register.c,v 1.64 2017/02/07 19:04:44 fischl Exp $"; @@ -81,7 +85,6 @@ static float sigmas[MAX_SIGMAS] ; #define IMAGES_PER_SURFACE 3 /* mean, variance, and dof */ #define SURFACES sizeof(curvature_names) / sizeof(curvature_names[0]) -#define PARAM_IMAGES (IMAGES_PER_SURFACE*SURFACES) static char *starting_reg_fname = NULL ; static int multi_scale = 0 ; diff --git a/mris_register_label_map/mris_register_label_map.cpp b/mris_register_label_map/mris_register_label_map.cpp index d2e39af12ea..2297bdd6660 100644 --- a/mris_register_label_map/mris_register_label_map.cpp +++ b/mris_register_label_map/mris_register_label_map.cpp @@ -53,19 +53,21 @@ #include #include -#include "romp_support.h" - #include "macros.h" + +#include "mri.h" +#include "mri2.h" +#include "mrisurf.h" +#include "mrisurf_project.h" + #include "utils.h" #include "fio.h" #include "version.h" #include "cmdargs.h" #include "error.h" #include "diag.h" -#include "mri.h" -#include "mrisurf.h" #include "cma.h" -#include "mri2.h" +#include "romp_support.h" #include "voxlist.h" #include "matrix.h" diff --git a/mris_shrinkwrap/mris_AA_shrinkwrap.cpp b/mris_shrinkwrap/mris_AA_shrinkwrap.cpp index ef3685f1519..f848742fe9a 100644 --- a/mris_shrinkwrap/mris_AA_shrinkwrap.cpp +++ b/mris_shrinkwrap/mris_AA_shrinkwrap.cpp @@ -31,20 +31,22 @@ #include #include "macros.h" + +#include "mri.h" +#include "mrisegment.h" +#include "mrisegment.h" +#include "mrimorph.h" +#include "mrinorm.h" +#include "mrisurf.h" +#include "mrisurf_project.h" +#include "icosahedron.h" + #include "error.h" #include "diag.h" #include "proto.h" #include "timer.h" -#include "mrisurf.h" -#include "mri.h" -#include "macros.h" -#include "mrimorph.h" -#include "mrinorm.h" #include "version.h" -#include "icosahedron.h" #include "cma.h" -#include "mrisegment.h" -#include "mrisegment.h" static double compute_surface_dist_sse(MRI_SURFACE *mris, MRI *mri_dist) ; static int MRISrepositionToInnerSkull(MRI_SURFACE *mris, MRI *mri_smooth, INTEGRATION_PARMS *parms) ; diff --git a/mris_shrinkwrap/mris_shrinkwrap.cpp b/mris_shrinkwrap/mris_shrinkwrap.cpp index a6fcab881a9..54e4d359d79 100644 --- a/mris_shrinkwrap/mris_shrinkwrap.cpp +++ b/mris_shrinkwrap/mris_shrinkwrap.cpp @@ -30,19 +30,21 @@ #include #include "macros.h" + +#include "mri.h" +#include "mrimorph.h" +#include "mrinorm.h" +#include "mrisegment.h" +#include "mrisurf.h" +#include "mrisurf_project.h" +#include "icosahedron.h" + #include "error.h" #include "diag.h" #include "proto.h" #include "timer.h" -#include "mrisurf.h" -#include "mri.h" -#include "macros.h" -#include "mrimorph.h" -#include "mrinorm.h" #include "version.h" -#include "icosahedron.h" #include "cma.h" -#include "mrisegment.h" static char vcid[] = "$Id: mris_shrinkwrap.c,v 1.9 2012/11/10 20:19:46 fischl Exp $"; diff --git a/mris_sphere/mris_remove_negative_vertices.cpp b/mris_sphere/mris_remove_negative_vertices.cpp index 62019aa1bcb..c21129d0137 100644 --- a/mris_sphere/mris_remove_negative_vertices.cpp +++ b/mris_sphere/mris_remove_negative_vertices.cpp @@ -30,13 +30,14 @@ #include #include "macros.h" + +#include "mri.h" +#include "mrisurf_project.h" + #include "error.h" #include "tags.h" #include "diag.h" #include "proto.h" -#include "mrisurf.h" -#include "mri.h" -#include "macros.h" #include "utils.h" #include "timer.h" #include "version.h" diff --git a/mris_sphere/mris_sphere.cpp b/mris_sphere/mris_sphere.cpp index 090799ac6d0..f68ad927391 100644 --- a/mris_sphere/mris_sphere.cpp +++ b/mris_sphere/mris_sphere.cpp @@ -32,18 +32,18 @@ #include #include #include -#ifdef HAVE_OPENMP // mrisurf.c has numerous parallelized functions -#include "romp_support.h" -#endif #include "macros.h" + +#include "mri.h" +#include "mrisurf.h" +#include "mrisurf_project.h" + +#include "romp_support.h" #include "error.h" #include "tags.h" #include "diag.h" #include "proto.h" -#include "mrisurf.h" -#include "mri.h" -#include "macros.h" #include "utils.h" #include "timer.h" #include "version.h" diff --git a/mris_spherical_average/mris_spherical_average.cpp b/mris_spherical_average/mris_spherical_average.cpp index 4a079caa23f..71609d076f3 100644 --- a/mris_spherical_average/mris_spherical_average.cpp +++ b/mris_spherical_average/mris_spherical_average.cpp @@ -32,15 +32,17 @@ #include #include "macros.h" -#include "error.h" -#include "diag.h" -#include "proto.h" + +#include "mri.h" #include "mrisurf.h" +#include "mrisurf_project.h" #include "mrisurf_vals.h" -#include "mri.h" -#include "macros.h" #include "mrishash.h" #include "icosahedron.h" + +#include "error.h" +#include "diag.h" +#include "proto.h" #include "tags.h" #include "label.h" #include "version.h" diff --git a/utils/gcsa.cpp b/utils/gcsa.cpp index 69f3ddc52c5..eefb37ab320 100644 --- a/utils/gcsa.cpp +++ b/utils/gcsa.cpp @@ -31,6 +31,7 @@ #include #include "mrisurf.h" +#include "mrisurf_project.h" #include "annotation.h" #include "cma.h" diff --git a/utils/mriflood.cpp b/utils/mriflood.cpp index dcd6ff3e636..91967a33fb9 100644 --- a/utils/mriflood.cpp +++ b/utils/mriflood.cpp @@ -31,6 +31,7 @@ #include "macros.h" #include "mri.h" #include "mrisurf.h" +#include "mrisurf_metricProperties.h" #include "region.h" #include "timer.h" diff --git a/utils/mris_compVolFrac.cpp b/utils/mris_compVolFrac.cpp index 707471a8f7e..4daff785367 100644 --- a/utils/mris_compVolFrac.cpp +++ b/utils/mris_compVolFrac.cpp @@ -36,6 +36,7 @@ #include "macros.h" #include "mris_compVolFrac.h" #include "mrisurf.h" +#include "mrisurf_metricProperties.h" #include "utils.h" #include "version.h" diff --git a/utils/mrishash.cpp b/utils/mrishash.cpp index 971c7386fa8..25032d98dcb 100644 --- a/utils/mrishash.cpp +++ b/utils/mrishash.cpp @@ -2292,7 +2292,7 @@ int MRIS_HASH_TABLE_IMPL::mhtBruteForceClosestVertex( // // -using namespace SurfaceFromMRIS::Analysis; +using namespace Minimal_Surface_MRIS; //using namespace SurfaceFromMRIS::XYZPositionConsequences; //using namespace SurfaceFromMRISPV::XYZPositionConsequences; @@ -2328,8 +2328,8 @@ MRIS_HASH_TABLE* MHTcreateFaceTable(ARG mris) } \ // end of macro -CONSTRUCTORS(MRIS *, SurfaceFromMRIS::Analysis) -CONSTRUCTORS(SurfaceFromMRIS::Analysis::Surface, SurfaceFromMRIS::Analysis) +CONSTRUCTORS(MRIS *, Minimal_Surface_MRIS) +CONSTRUCTORS(Minimal_Surface_MRIS::Surface, Minimal_Surface_MRIS) CONSTRUCTORS(SurfaceFromMRIS::XYZPositionConsequences::Surface, SurfaceFromMRIS::XYZPositionConsequences) CONSTRUCTORS(SurfaceFromMRISPV::XYZPositionConsequences::Surface, SurfaceFromMRISPV::XYZPositionConsequences) diff --git a/utils/mrisurf_base.cpp b/utils/mrisurf_base.cpp index f6bdf76dd13..ba0639ed6bb 100644 --- a/utils/mrisurf_base.cpp +++ b/utils/mrisurf_base.cpp @@ -354,44 +354,6 @@ static void growDistOrDistOrig(bool doOrig, MRIS *mris, int vno, int minimumCapa changeDistOrDistOrig(doOrig, mris, vno, oldSize, vSize); } - -// VERTEX, FACE, EDGE primitives -// -static void VERTEX_TOPOLOGYdtr(VERTEX_TOPOLOGY* v) { - freeAndNULL(v->v); - freeAndNULL(v->f); - freeAndNULL(v->n); - if(v->e) freeAndNULL(v->e); -} - -static void VERTEXdtr(VERTEX* v) { - freeDistOrDistOrig(false, v); - freeDistOrDistOrig(true, v); -} - -static void FACEdtr(FACE* f) { - if (f->norm) DMatrixFree(&f->norm); - int k; - for (k=0; k < 3; k++){ - if (f->gradNorm[k]) DMatrixFree(&f->gradNorm[k]); - } -} - -static void MRIS_EDGEdtr(MRI_EDGE* e) { - int k; - for (k=0; k<4; k++){ - if (e->gradDot[k]) DMatrixFree(&e->gradDot[k]); - } - if(e->gradU) DMatrixFree(&e->gradU); -} - -static void MRIS_CORNERdtr(MRI_CORNER* c) { - int k; - for (k=0; k<3; k++){ - if (c->gradDot[k]) DMatrixFree(&c->gradDot[k]); - } -} - void MRISgrowDist(MRIS *mris, int vno, int minimumCapacity) { growDistOrDistOrig(false, mris, vno, minimumCapacity); @@ -421,7 +383,7 @@ void MRISmakeDistOrig(MRIS *mris, int vno) // Freeing // -void freeDistsOrDistOrigs(bool doOrig, MRIS *mris) +static void freeDistsOrDistOrigs(bool doOrig, MRIS *mris) { char const flag = (char)(1)<v); + freeAndNULL(v->f); + freeAndNULL(v->n); + if (v->e) freeAndNULL(v->e); +} + +static void VERTEXdtr(VERTEX* v) { + freeDistOrDistOrig(false, v); + freeDistOrDistOrig(true, v); +} + +static void FACEdtr(FACE* f) { + if (f->norm) DMatrixFree(&f->norm); + int k; + for (k=0; k < 3; k++){ + if (f->gradNorm[k]) DMatrixFree(&f->gradNorm[k]); + } +} + +static void MRIS_EDGEdtr(MRI_EDGE* e) { + for (int k=0; k<4; k++){ + if (e->gradDot[k]) DMatrixFree(&e->gradDot[k]); + } +} + +static void MRIS_CORNERdtr(MRI_CORNER* c) { + for (int k=0; k<3; k++){ + if (c->gradDot[k]) DMatrixFree(&c->gradDot[k]); + } +} // MRIS // diff --git a/utils/mrisurf_compute_dxyz.cpp b/utils/mrisurf_compute_dxyz.cpp index f51a33895ba..983c6cb455f 100644 --- a/utils/mrisurf_compute_dxyz.cpp +++ b/utils/mrisurf_compute_dxyz.cpp @@ -17,6 +17,8 @@ #include "mrisurf_project.h" #include "mrisurf_sseTerms.h" +#include "mrisurf_base.h" + #define MAX_VOXELS mrisurf_sse_MAX_VOXELS #define MAX_DISPLACEMENT mrisurf_sse_MAX_DISPLACEMENT #define DISPLACEMENT_DELTA mrisurf_sse_DISPLACEMENT_DELTA diff --git a/utils/mrisurf_defect.cpp b/utils/mrisurf_defect.cpp index 3782a9959a3..08ee924fd74 100644 --- a/utils/mrisurf_defect.cpp +++ b/utils/mrisurf_defect.cpp @@ -21,6 +21,8 @@ */ #include "mrisurf_defect.h" +#include "mrisurf_metricProperties.h" +#include "mrisurf_base.h" //================================================================== // Utilities for editing a surface diff --git a/utils/mrisurf_deform.cpp b/utils/mrisurf_deform.cpp index 664f9e24d6d..652ec27ea2c 100644 --- a/utils/mrisurf_deform.cpp +++ b/utils/mrisurf_deform.cpp @@ -24,6 +24,9 @@ #include "mrisurf_sseTerms.h" #include "mrisurf_compute_dxyz.h" #include "mrisurf_io.h" +#include "mrisurf_MRIS_MP.h" + +#include "mrisurf_base.h" #define MAX_VOXELS mrisurf_sse_MAX_VOXELS @@ -289,10 +292,51 @@ static void mrisProjectOntoSurface(MRI_SURFACE *mris, int which_vertices) } -int mrisProjectSurface(MRI_SURFACE *mris) -{ - /* MRISupdateSurface(mris) ;*/ - switch (mris->status) { + +template +class mrisSurfaceProjector { +public: + bool canDo(int mris_status); + void project(MRIS_Representation* representation); +}; + + +template<> +class mrisSurfaceProjector { +public: + + bool canDo(int mris_status) { + switch (mris_status) { + //case MRIS_PARAMETERIZED_SPHERE: return true; + case MRIS_SPHERE: return true; + default:; + } + static int shown = 0; + int shownMask = (1 << mris_status); + if (!(shown&shownMask)) { shown |= shownMask; + fprintf(stdout, "%s:%d need to process MRIS::status %d\n", __FILE__, __LINE__, mris_status); + } + return false; + } + + void project(MRIS_MP* mris_mp) { + switch (mris_mp->status) { + case MRIS_SPHERE: MRISprojectOntoSphere(mris_mp, mris_mp->radius); break; + default: break; + } + cheapAssert(false); + } + +}; + + +template<> +class mrisSurfaceProjector { +public: + bool canDo(int mris_status) { return true; } + void project(MRIS* mris) + { + switch (mris->status) { case MRIS_PLANE: MRISflattenPatch(mris); break; @@ -300,32 +344,47 @@ int mrisProjectSurface(MRI_SURFACE *mris) mrisSphericalProjection(mris); break; case MRIS_PARAMETERIZED_SPHERE: - MRISprojectOntoSphere(mris, mris, mris->radius); + MRISprojectOntoSphere(mris, mris->radius); break; case MRIS_SPHERE: - MRISprojectOntoSphere(mris, mris, mris->radius); + MRISprojectOntoSphere(mris, mris->radius); break; case MRIS_ELLIPSOID: MRISprojectOntoEllipsoid(mris, mris, 0.0f, 0.0f, 0.0f); break; - // case PROJECT_PLANE: - /* mrisOrientPlane(mris) ;*/ - // break ; + //se PROJECT_PLANE: + //mrisOrientPlane(mris) + //break ; case MRIS_RIGID_BODY: - /* MRISprojectOntoSphere(mris, mris, mris->radius) ;*/ - mris->status = MRIS_RIGID_BODY; break; case MRIS_PIAL_SURFACE: mrisProjectOntoSurface(mris, PIAL_VERTICES); break; default: + // seen to happen cheapAssert(!"was just fall thru before - Bevin looking for cases"); break; + } } +}; + +int mrisProjectSurface(MRIS* mris) +{ + mrisSurfaceProjector().project(mris); return (NO_ERROR); } +int mrisProjectSurface(MRIS_MP* mris) +{ + mrisSurfaceProjector().project(mris); + return (NO_ERROR); +} + +static bool mrisProjectSurface_CanDo(int mris_status) +{ + return mrisSurfaceProjector().canDo(mris_status); +} -int mrisComputePlaneTerm(MRI_SURFACE *mris, double l_plane, double l_spacing) +int mrisComputePlaneTerm(MRIS* mris, double l_plane, double l_spacing) { int vno, n, vnum; MATRIX *M, *m_evectors; @@ -887,43 +946,38 @@ int mrisApplyGradientPositiveAreaMaximizing(MRI_SURFACE *mris, double dt) int MRISapplyGradient(MRIS* mris, double dt) { - int vno, nvertices; - - nvertices = mris->nvertices; MRISstoreCurrentPositions(mris); if (mris->status == MRIS_RIGID_BODY) { MRISrotate(mris, mris, dt * mris->alpha, dt * mris->beta, dt * mris->gamma); - } - else { - ROMP_PF_begin -#ifdef HAVE_OPENMP - #pragma omp parallel for if_ROMP(assume_reproducible) schedule(static, 1) -#endif - for (vno = 0; vno < nvertices; vno++) { - ROMP_PFLB_begin - - VERTEX *v; - v = &mris->vertices[vno]; - if (v->ripflag) ROMP_PF_continue; - - if (!isfinite(v->x) || !isfinite(v->y) || !isfinite(v->z)) - ErrorPrintf(ERROR_BADPARM, "vertex %d position is not finite!\n", vno); - if (!isfinite(v->dx) || !isfinite(v->dy) || !isfinite(v->dz)) - ErrorPrintf(ERROR_BADPARM, "vertex %d position is not finite!\n", vno); - v->x += dt * v->dx; - v->y += dt * v->dy; - v->z += dt * v->dz; - - ROMP_PFLB_end - } - ROMP_PF_end + } else { + MRIStranslate_along_vertex_dxdydz(mris, mris, dt); } return (NO_ERROR); } struct MRIScomputeSSE_asThoughGradientApplied_ctx::Impl { - // NYI + Impl() : inited(false), dx(nullptr), dy(nullptr), dz(nullptr) {} + ~Impl() + { + freeAndNULL(dx); freeAndNULL(dy); freeAndNULL(dz); + } + + bool inited; + MRIS_MP curr, orig; + float *dx, *dy, *dz; + + void init(MRIS* mris) { + cheapAssert(!inited); + + MRISMP_ctr(&orig); + MRISMP_ctr(&curr); + + MRISmemalignNFloats(mris->nvertices, &dx, &dy, &dz); + MRISMP_load(&orig, mris, true, dx,dy,dz); // needs to load the outputs because those are inputs to ProjectSurface + + inited = true; + } }; @@ -934,7 +988,7 @@ MRIScomputeSSE_asThoughGradientApplied_ctx::MRIScomputeSSE_asThoughGradientAppli MRIScomputeSSE_asThoughGradientApplied_ctx::~MRIScomputeSSE_asThoughGradientApplied_ctx() { - delete _impl; _impl = nullptr; + delete _impl; } double MRIScomputeSSE_asThoughGradientApplied( @@ -943,14 +997,49 @@ double MRIScomputeSSE_asThoughGradientApplied( INTEGRATION_PARMS* parms, MRIScomputeSSE_asThoughGradientApplied_ctx& ctx) { - MRISapplyGradient(mris, delta_t); - mrisProjectSurface(mris); - MRIScomputeMetricProperties(mris); - double sse = MRIScomputeSSE(mris, parms); + bool const canUseNewBehaviour = mrisProjectSurface_CanDo(mris->status) && MRIScomputeSSE_canDo((MRIS_MP*)nullptr,parms); + + bool useOldBehaviour = !!getenv("FREESURFER_OLD_MRIScomputeSSE_asThoughGradientApplied"); + bool useNewBehaviour = !!getenv("FREESURFER_NEW_MRIScomputeSSE_asThoughGradientApplied") || !useOldBehaviour; + + useNewBehaviour = false; + + if (!canUseNewBehaviour) { + useNewBehaviour = false; + useOldBehaviour = true; + } + + double new_result = 0.0; + if (useNewBehaviour) { + auto & ctxImpl = *ctx._impl; + + if (!ctxImpl.inited) ctxImpl.init(mris); + + MRISMP_copy(&ctxImpl.curr, &ctxImpl.orig, + false, // needs to copy the outputs because those are inputs to ProjectSurface + true); // no need to copy v_x[*] etc. because they are obtained by the translate_along_vertex_dxdydxz below - MRISrestoreOldPositions(mris); + MRIStranslate_along_vertex_dxdydz(&ctxImpl.orig, &ctxImpl.curr, delta_t); + mrisProjectSurface(&ctxImpl.curr); + MRIScomputeMetricProperties(&ctxImpl.curr); + new_result = MRIScomputeSSE(&ctxImpl.curr, parms); + } + + double old_result = 0.0; + if (useOldBehaviour) { + MRISapplyGradient(mris, delta_t); + mrisProjectSurface(mris); + MRIScomputeMetricProperties(mris); + old_result = MRIScomputeSSE(mris, parms); - return sse; + MRISrestoreOldPositions(mris); + } + + if (useOldBehaviour && useNewBehaviour && (old_result != new_result)) { + cheapAssert(false); + } + + return useOldBehaviour ? old_result : new_result; } /*----------------------------------------------------- @@ -1893,14 +1982,6 @@ double mrisComputeSSE_MEF( } -/*----------------------------------------------------- - Parameters: - - Returns value: - - Description - - ------------------------------------------------------*/ static float neg_area_ratios[] = { // 1e-3, 1e-4, 1e-5, 1e-6, 1e-7, 1e-8, 1e-3, 1e-2, 5e-2,1e-1 1e-6, @@ -2051,13 +2132,6 @@ int mrisRemoveNegativeArea( } -/*----------------------------------------------------- - Parameters: - - Returns value: - - Description - ------------------------------------------------------*/ int MRISflattenPatchRandomly(MRI_SURFACE *mris) { float extent; @@ -2082,13 +2156,7 @@ int MRISflattenPatchRandomly(MRI_SURFACE *mris) return (NO_ERROR); } -/*----------------------------------------------------- - Parameters: - - Returns value: - Description - ------------------------------------------------------*/ int MRISflattenPatch(MRI_SURFACE *mris) { float x, y, z, d, d1, d2; @@ -2255,13 +2323,7 @@ int MRISflattenPatch(MRI_SURFACE *mris) return (NO_ERROR); } -/*----------------------------------------------------- - Parameters: - - Returns value: - Description - ------------------------------------------------------*/ #define EXPLODE_ITER 1 int mrisTearStressedRegions(MRI_SURFACE *mris, INTEGRATION_PARMS *parms) { diff --git a/utils/mrisurf_deform.h b/utils/mrisurf_deform.h index 7cc793590a4..a53f50b1ff6 100644 --- a/utils/mrisurf_deform.h +++ b/utils/mrisurf_deform.h @@ -66,12 +66,13 @@ int mrisComputeSpringTerm (MRI_SURFACE *mris, double l_spring); int mrisComputeLaplacianTerm (MRI_SURFACE *mris, double l_laplacian); int mrisComputeNormalizedSpringTerm (MRI_SURFACE *mris, double l_spring); -int mrisProjectSurface (MRI_SURFACE *mris); +int mrisProjectSurface (MRIS* mris); +int mrisProjectSurface (MRIS_MP* mris); + int mrisApplyTopologyPreservingGradient (MRI_SURFACE *mris, double dt, int which_gradient); int mrisApplyGradientPositiveAreaPreserving(MRI_SURFACE *mris, double dt); int mrisApplyGradientPositiveAreaMaximizing(MRI_SURFACE *mris, double dt); -int mrisProjectSurface(MRI_SURFACE *mris); int mrisApplyTopologyPreservingGradient(MRI_SURFACE *mris, double dt, int which_gradient); int mrisCountCompressed(MRI_SURFACE *mris, double min_dist); @@ -80,16 +81,11 @@ int MRISrestoreExtraGradients(MRI_SURFACE *mris); int mrisLogStatus(MRI_SURFACE *mris, INTEGRATION_PARMS *parms, FILE *fp, float dt, float old_sse); -bool MRISMP_computeSSE_canDo( INTEGRATION_PARMS *parms); -double MRISMP_computeSSE (MRIS_MP* mris, INTEGRATION_PARMS *parms); - - struct MRIScomputeSSE_asThoughGradientApplied_ctx { MRIScomputeSSE_asThoughGradientApplied_ctx(); ~MRIScomputeSSE_asThoughGradientApplied_ctx(); -private: struct Impl; - Impl* _impl; + Impl* const _impl; }; double MRIScomputeSSE_asThoughGradientApplied( diff --git a/utils/mrisurf_integrate.cpp b/utils/mrisurf_integrate.cpp index e0e9f12db48..ef4e5e5adb8 100644 --- a/utils/mrisurf_integrate.cpp +++ b/utils/mrisurf_integrate.cpp @@ -21,6 +21,9 @@ #include "mrisurf_sseTerms.h" #include "mrisurf_compute_dxyz.h" +#include "mrisurf_base.h" + + static int mrisIntegrationEpoch (MRI_SURFACE *mris, INTEGRATION_PARMS *parms, int n_avgs); static double mrisLineMinimize (MRI_SURFACE *mris, INTEGRATION_PARMS *parms); static double mrisLineMinimizeSearch(MRI_SURFACE *mris, INTEGRATION_PARMS *parms); @@ -1637,9 +1640,8 @@ static double mrisLineMinimize(MRI_SURFACE *mris, INTEGRATION_PARMS *parms) double dt_in[MAX_ENTRIES], sse_out[MAX_ENTRIES]; int N = 0; { - struct MRIScomputeSSE_asThoughGradientApplied_ctx sseCtx; - // This is NYI - + MRIScomputeSSE_asThoughGradientApplied_ctx sseCtx; + double const starting_sse = MRIScomputeSSE(mris, parms); /* write out some data on supposed quadratic form */ diff --git a/utils/mrisurf_io.cpp b/utils/mrisurf_io.cpp index 66267d54b48..3a66c8c20ea 100644 --- a/utils/mrisurf_io.cpp +++ b/utils/mrisurf_io.cpp @@ -21,6 +21,9 @@ #include "mrisurf_io.h" #include "mrisp.h" +#include "mrisurf_base.h" + + #define QUAD_FILE_MAGIC_NUMBER (-1 & 0x00ffffff) #define TRIANGLE_FILE_MAGIC_NUMBER (-2 & 0x00ffffff) #define NEW_QUAD_FILE_MAGIC_NUMBER (-3 & 0x00ffffff) diff --git a/utils/mrisurf_metricProperties.cpp b/utils/mrisurf_metricProperties.cpp index c37fbcdfd29..960491db90a 100644 --- a/utils/mrisurf_metricProperties.cpp +++ b/utils/mrisurf_metricProperties.cpp @@ -15,10 +15,21 @@ * */ #include "mrisurf_metricProperties.h" + +#include "mrisurf_MRIS.h" +#include "mrisurf_MRIS_MP.h" +#include "mrisurf_MRISPV.h" + +#include "mrisurf_SurfaceFromMRIS_generated.h" +#include "mrisurf_SurfaceFromMRISPV_generated.h" +#include "mrisurf_SurfaceFromMRIS_MP_generated.h" + #include "face_barycentric_coords.h" #include "mrisutils.h" #include "surfgrad.h" +#include "mrisurf_base.h" + static int int_compare(const void* lhs_ptr, const void* rhs_ptr) { int lhs = *(int*)lhs_ptr; @@ -674,14 +685,10 @@ MRIS* MRIStalairachTransform(MRIS* mris_src, MRIS* mris) return mris; } - -MRIS* MRISrotate(MRIS* mris_src, MRIS* mris_dst, float alpha, float beta, float gamma) +template +void MRISrotate(Surface surface, float alpha, float beta, float gamma) { - if (!mris_dst) { - mris_dst = MRISclone(mris_src); - } - - MRISfreeDistsButNotOrig(mris_dst); // it is either this or adjust them... + surface.freeDistsButNotOrig(); float const sa = sin(alpha); float const sb = sin(beta); @@ -703,34 +710,53 @@ MRIS* MRISrotate(MRIS* mris_src, MRIS* mris_dst, float alpha, float beta, float float const cbcg = cb * cg; float const cbsg = cb * sg; - int vno; - + auto const nvertices = surface.nvertices(); + ROMP_PF_begin #ifdef HAVE_OPENMP #pragma omp parallel for if_ROMP(assume_reproducible) schedule(guided) #endif - for (vno = 0; vno < mris_src->nvertices; vno++) { + for (int vno = 0; vno < nvertices; vno++) { ROMP_PFLB_begin - + if (vno == Gdiag_no) { DiagBreak(); } - VERTEX *vertex = &mris_src->vertices[vno]; - float x = vertex->x; - float y = vertex->y; - float z = vertex->z; + auto vertex = surface.vertices(vno); + float x = vertex.x(); + float y = vertex.y(); + float z = vertex.z(); float xp = x * cacb + z * (-cacgsb - sasg) + y * (cgsa - casbsg); float yp = -x * cbsa + z * ( cgsasb - casg) + y * (cacg + sasbsg); float zp = z * cbcg + x * sb + y * cbsg; - vertex->x = xp; - vertex->y = yp; - vertex->z = zp; + vertex.set_x(xp); + vertex.set_y(yp); + vertex.set_z(zp); ROMP_PFLB_end } ROMP_PF_end - +} + +void MRISrotate(MRIS* mris, float alpha, float beta, float gamma) +{ + SurfaceFromMRIS::XYZPositionM::Surface surface(mris); + MRISrotate(surface, alpha, beta, gamma); +} + +void MRISrotate(MRIS_MP* mris, float alpha, float beta, float gamma) +{ + SurfaceFromMRIS_MP::XYZPositionM::Surface surface(mris); + MRISrotate(surface, alpha, beta, gamma); +} + +MRIS* MRISrotate(MRIS* mris_src, MRIS* mris_dst, float alpha, float beta, float gamma) +{ + if (!mris_dst) { + mris_dst = MRISclone(mris_src); + } + MRISrotate(mris_dst, alpha, beta, gamma); return (mris_dst); } @@ -968,6 +994,58 @@ void MRISblendXYZandNXYZ(MRIS* mris, float nxyzScale) } +template +void MRIStranslate_along_vertex_dxdydz(SurfaceOut surfaceOut, SurfaceInp surfaceInp, double dt) +{ + surfaceOut.freeDistsButNotOrig(); + + auto const nvertices = surfaceInp.nvertices(); + cheapAssert(nvertices == surfaceOut.nvertices()); + + ROMP_PF_begin +#ifdef HAVE_OPENMP + #pragma omp parallel for if_ROMP(assume_reproducible) schedule(guided) +#endif + for (int vno = 0; vno < nvertices; vno++) { + ROMP_PFLB_begin + + auto vertexInp = surfaceInp.vertices(vno); + if (vertexInp.ripflag()) continue; + + float x = vertexInp.x(); + float y = vertexInp.y(); + float z = vertexInp.z(); + + x += dt * vertexInp.dx(); + y += dt * vertexInp.dy(); + z += dt * vertexInp.dz(); + + + auto vertexOut = surfaceOut.vertices(vno); + vertexOut.set_x(x); + vertexOut.set_y(y); + vertexOut.set_z(z); + + ROMP_PFLB_end + } + ROMP_PF_end +} + +void MRIStranslate_along_vertex_dxdydz(MRIS* dst, MRIS* src, double dt) +{ + SurfaceFromMRIS::Distort::Surface surfaceInp(src); + SurfaceFromMRIS::XYZPositionM::Surface surfaceOut(dst); + MRIStranslate_along_vertex_dxdydz(surfaceOut, surfaceInp, dt); +} + +void MRIStranslate_along_vertex_dxdydz(MRIS_MP* dst, MRIS_MP* src, double dt) +{ + SurfaceFromMRIS_MP::Distort::Surface surfaceInp(src); + SurfaceFromMRIS_MP::XYZPositionM::Surface surfaceOut(dst); + MRIStranslate_along_vertex_dxdydz(surfaceOut, surfaceInp, dt); +} + + static void MRISaverageVertexPositionsWkr_part1(MRIS* mris, int navgs, float scale, bool includeCenter, int start, int step, float **ppx, float **ppy, float **ppz) { MRISfreeDistsButNotOrig(mris); // it is either this or adjust them... @@ -1825,8 +1903,8 @@ int MRIScomputeMetricProperties(MRIS *mris) if (useNewBehaviour) { MRISfreeDistsButNotOrig(mris); // So they can be stolen to avoid unnecessary mallocs and frees - MRISMP_load(mris, &mp); // Copy the input data before MRIScomputeMetricPropertiesWkr changes it - MRISMP_computeMetricProperties(&mp); // It should not matter the order these are done in + MRISMP_load(&mp, mris); // Copy the input data before MRIScomputeMetricPropertiesWkr changes it + MRIScomputeMetricProperties(&mp); // It should not matter the order these are done in } if (useOldBehaviour) { @@ -6320,15 +6398,6 @@ short MRIScomputeSecondFundamentalFormDiscrete(MRIS *apmris, short ab_signedPrin } -void computeDefectFaceNormal(MRIS const * const mris, int const fno) -{ - float nx, ny, nz, orig_area; - computeDefectFaceNormal_calculate(mris, fno, &nx, &ny, &nz, &orig_area); - setFaceNorm (mris, fno, nx, ny, nz); - setFaceOrigArea(mris, fno, orig_area); -} - - int MRIScomputeSurfaceNormals(MRIS *mris, int which, int navgs) { int vno, n, i; @@ -7487,24 +7556,25 @@ int MRIScomputeNormal(MRIS *mris, int which, int vno, double *pnx, double *pny, ------------------------------------------------------*/ //#define CHECK_DEFERED_NORMS -void computeDefectFaceNormal_calculate( - MRIS const * const mris, int const fno, float* p_nx, float* p_ny, float* p_nz, float* p_orig_area) +template +void computeDefectFaceNormal_calculate_template( + Surface surface, int const fno, float* p_nx, float* p_ny, float* p_nz, float* p_orig_area) { - FACE const * const face = &mris->faces[fno]; + auto face = surface.faces(fno); - VERTEX * v1 = &mris->vertices[face->v[0]]; - VERTEX * v2 = &mris->vertices[face->v[1]]; - VERTEX * v3 = &mris->vertices[face->v[2]]; + auto v1 = face.v(0); + auto v2 = face.v(1); + auto v3 = face.v(2); /* compute the face normal on the original configuration */ float a[3], b[3]; - a[0] = v2->origx - v1->origx; - b[0] = v3->origx - v1->origx; - a[1] = v2->origy - v1->origy; - b[1] = v3->origy - v1->origy; - a[2] = v2->origz - v1->origz; - b[2] = v3->origz - v1->origz; + a[0] = v2.origx() - v1.origx(); + b[0] = v3.origx() - v1.origx(); + a[1] = v2.origy() - v1.origy(); + b[1] = v3.origy() - v1.origy(); + a[2] = v2.origz() - v1.origz(); + b[2] = v3.origz() - v1.origz(); float norm[3]; F_CROSS(a, b, norm); @@ -7521,12 +7591,12 @@ void computeDefectFaceNormal_calculate( // fprintf(WHICH_OUTPUT,"face with a null normal (%f,%f,%f) - (%f,%f,%f) - // (%f,%f,%f)",v1->origx,v1->origy,v1->origz,v2->origx,v2->origy,v2->origz,v3->origx,v3->origy,v3->origz); /* try another dot product */ - a[0] = 100.0 * (v3->origx - v2->origx); - b[0] = 100.0 * (v1->origx - v2->origx); - a[1] = 100.0 * (v3->origy - v2->origy); - b[1] = 100.0 * (v1->origy - v2->origy); - a[2] = 100.0 * (v3->origz - v2->origz); - b[2] = 100.0 * (v1->origz - v2->origz); + a[0] = 100.0 * (v3.origx() - v2.origx()); + b[0] = 100.0 * (v1.origx() - v2.origx()); + a[1] = 100.0 * (v3.origy() - v2.origy()); + b[1] = 100.0 * (v1.origy() - v2.origy()); + a[2] = 100.0 * (v3.origz() - v2.origz()); + b[2] = 100.0 * (v1.origz() - v2.origz()); F_CROSS(a, b, norm); nx = norm[0]; ny = norm[1]; @@ -7545,9 +7615,33 @@ void computeDefectFaceNormal_calculate( *p_orig_area = len / 2.0f; } - +static void computeDefectFaceNormal_calculate( + MRIS const * const mris, int const fno, float* p_nx, float* p_ny, float* p_nz, float* p_orig_area) +{ + SurfaceFromMRIS::XYZPositionM::Surface surface(const_cast(mris)); + computeDefectFaceNormal_calculate_template(surface, fno, p_nx, p_ny, p_nz, p_orig_area); +} -void setFaceNorm(MRIS const * const mris, int fno, float nx, float ny, float nz) { +void computeDefectFaceNormal_calculate( + MRIS_MP const * const mris, int const fno, float* p_nx, float* p_ny, float* p_nz, float* p_orig_area) +{ + SurfaceFromMRIS_MP::XYZPositionM::Surface surface(const_cast(mris)); + computeDefectFaceNormal_calculate_template(surface, fno, p_nx, p_ny, p_nz, p_orig_area); +} + + +void computeDefectFaceNormal(MRIS const * const mris, int const fno) +{ + float nx, ny, nz, orig_area; + computeDefectFaceNormal_calculate(mris, fno, &nx, &ny, &nz, &orig_area); + setFaceNorm (mris, fno, nx, ny, nz); + setFaceOrigArea(mris, fno, orig_area); +} + + + +template +void setFaceNorm_template(SOME_MRIS const * const mris, int fno, float nx, float ny, float nz) { FaceNormCacheEntry * fNorm = &mris->faceNormCacheEntries [fno]; FaceNormDeferredEntry * fNormDeferred = &mris->faceNormDeferredEntries[fno]; @@ -7555,9 +7649,17 @@ void setFaceNorm(MRIS const * const mris, int fno, float nx, float ny, float nz) fNorm->ny = ny; fNorm->nz = nz; fNormDeferred->deferred &= ~1; // now known +} + +void setFaceNorm(MRIS const * const mris, int fno, float nx, float ny, float nz) { + setFaceNorm_template(mris, fno, nx, ny, nz); +} +void setFaceNorm(MRIS_MP const * const mris, int fno, float nx, float ny, float nz) { + setFaceNorm_template(mris, fno, nx, ny, nz); } + void setFaceOrigArea(MRIS const * const mris, int fno, float orig_area) { FaceNormCacheEntry * fNorm = &mris->faceNormCacheEntries [fno]; FaceNormDeferredEntry * fNormDeferred = &mris->faceNormDeferredEntries[fno]; @@ -7576,7 +7678,8 @@ float getFaceOrigArea(MRIS const * const mris, int fno) { } -FaceNormCacheEntry const * getFaceNorm(MRIS const * const mris, int fno) { +template +FaceNormCacheEntry const * getFaceNorm_template(SOME_MRIS const * const mris, int fno) { // volatile to stop the compiler from reordering the stores of the nx,ny,nz,orig with the stores of the deferred // @@ -7617,6 +7720,15 @@ FaceNormCacheEntry const * getFaceNorm(MRIS const * const mris, int fno) { return (FaceNormCacheEntry*)fNorm; } +FaceNormCacheEntry const * getFaceNorm(MRIS const * const mris, int fno) { + return getFaceNorm_template(mris, fno); +} + +FaceNormCacheEntry const * getFaceNorm(MRIS_MP const * const mris, int fno) { + return getFaceNorm_template(mris, fno); +} + + void mrisurf_deferSetFaceNorms(MRIS* mris) { static int use_parallel; static int once; diff --git a/utils/mrisurf_metricProperties_fast.h b/utils/mrisurf_metricProperties_fast.h index b17ebea923b..3c453259539 100644 --- a/utils/mrisurf_metricProperties_fast.h +++ b/utils/mrisurf_metricProperties_fast.h @@ -12,137 +12,11 @@ // There is a lot of overlap between these two functions that needs to be rationalized -// Just the information needed to compute the metric properties -// -typedef struct MRIS_MP { - - // ATH - temporarily adding this constructor to avoid the 'uninitialized const member' errors in g++ > 4 - MRIS_MP() : - status(MRIS_Status__end), - origxyz_status(MRIS_Status__end), - nvertices(0), - nfaces(0), - nsize(0), - radius(0), - vertices_topology(0), - faces_topology(0) - {}; - -#define SEP -#define ELTX(C,T,N) ELT(C,T,N) - - MRIS* underlyingMRIS; // allows access in a few rare cases where there is a real benefit - - // MRIS - // - // In - // -#define ELT(C,T,N) T C N; - - #define MRIS_MP__LIST_MRIS_IN \ - ELT(const, MRIS_Status, status ) SEP \ - ELT(const, MRIS_Status, origxyz_status ) SEP \ - ELT(const, int, nvertices ) SEP \ - ELT(const, int, nfaces ) SEP \ - ELT(const, int, nsize ) SEP \ - ELT(const, double, radius ) SEP \ - ELT(const, VERTEX_TOPOLOGY const *, vertices_topology) \ - ELTX(const, FACE_TOPOLOGY const *, faces_topology) - - MRIS_MP__LIST_MRIS_IN - - // In out - #define MRIS_MP__LIST_MRIS_IN_OUT \ - ELT(, int, dist_nsize ) \ - - MRIS_MP__LIST_MRIS_IN_OUT - - // Out - #define MRIS_MP__LIST_MRIS_OUT \ - ELT(, float, xlo ) SEP \ - ELT(, float, xhi ) SEP \ - ELT(, float, ylo ) SEP \ - ELT(, float, yhi ) SEP \ - ELT(, float, zlo ) SEP \ - ELT(, float, zhi ) SEP \ - ELT(, float, xctr ) SEP \ - ELT(, float, yctr ) SEP \ - ELT(, float, zctr ) SEP \ - ELT(, float, total_area ) SEP \ - ELT(, double, avg_vertex_area ) SEP \ - ELTX(, double, avg_vertex_dist ) SEP \ - ELT(, double, std_vertex_dist ) SEP \ - ELT(, float, neg_orig_area ) SEP \ - ELT(, float, neg_area ) - - MRIS_MP__LIST_MRIS_OUT - -#undef ELT - - // Vertices - // -#define ELT(C,T,N) C T * v_##N; - - // In - #define MRIS_MP__LIST_V_IN \ - ELT(const, char, ripflag ) SEP \ - ELTX(const, int, VSize ) - - MRIS_MP__LIST_V_IN - - // In out - #define MRIS_MP__LIST_V_IN_OUT \ - ELTX(, int, dist_capacity) SEP \ - ELT(, char, border ) SEP \ - ELT(, float, x ) SEP \ - ELT(, float, y ) SEP \ - ELT(, float, z ) SEP \ - ELT(, float, origarea ) - - MRIS_MP__LIST_V_IN_OUT - - // Out - #define MRIS_MP__LIST_V_OUT \ - ELT(, float, area ) SEP \ - ELT(, float, nx ) SEP \ - ELT(, float, ny ) SEP \ - ELT(, float, nz ) SEP \ - ELTX(, char, neg ) SEP \ - ELTX(, float*, dist ) - - MRIS_MP__LIST_V_OUT - -#undef ELT - - // Faces - // -#define ELT(C,T,N) C T * f_##N; - #define MRIS_MP__LIST_F_IN \ - ELT(const, char, ripflag ) SEP \ - ELTX(const, float, norm_orig_area ) - - MRIS_MP__LIST_F_IN - - #define MRIS_MP__LIST_F_OUT \ - ELT(, float, area ) SEP \ - ELTX(, char, normSet ) SEP \ - ELTX(, FloatXYZ, norm ) SEP \ - ELTX(, angles_per_triangle_t, angle) - - MRIS_MP__LIST_F_OUT - -#undef ELT - -#undef ELTX -#undef SEP - -} MRIS_MP; - -static void MRISMP_ctr(MRIS_MP* mp) { +void MRISMP_ctr(MRIS_MP* mp) { bzero(mp, sizeof(*mp)); } -static void MRISMP_dtr(MRIS_MP* mp) { +void MRISMP_dtr(MRIS_MP* mp) { // Faces // #define SEP @@ -183,7 +57,146 @@ static void MRISMP_dtr(MRIS_MP* mp) { bzero(mp, sizeof(*mp)); } -static void MRISMP_load(MRIS* mris, MRIS_MP* mp) { +static void MRISMP_makeDist2(MRIS_MP* mp, int vno, int neededCapacity) { + int const vSize = mp->v_VSize[vno]; + + if (neededCapacity < vSize) neededCapacity = vSize; + + if (neededCapacity <= mp->v_dist_capacity[vno]) { + mp->v_dist[vno] = mp->v_dist_buffer[vno]; + return; + } + + if (!mp->v_dist_buffer) { + mp->v_dist_buffer = (float**)calloc(mp->nvertices,sizeof(float*)); + } + + if (mp->v_dist_buffer[vno]) { + mp->v_dist[vno] = mp->v_dist_buffer[vno] = (float*)realloc(mp->v_dist_buffer[vno], neededCapacity*sizeof(float)); + } else { + mp->v_dist[vno] = mp->v_dist_buffer[vno] = mrisStealDistStore(mp->underlyingMRIS, vno, neededCapacity); + } + + mp->v_dist_capacity[vno] = neededCapacity; +} + +static void MRISMP_makeDist(MRIS_MP* mp, int vno) { + MRISMP_makeDist2(mp, vno, mp->v_dist_capacity[vno]); +} + +void MRISMP_copy(MRIS_MP* dst, MRIS_MP* src, + bool only_inputs, + bool no_need_to_copy_xyz) { // NYI + + dst->underlyingMRIS = src->underlyingMRIS; + + if (dst->in_src != src) { + if (dst->in_src) { + dst->in_src->in_ref_count--; // no longer being referenced by dst + dst->in_src = NULL; + } + src->in_ref_count++; // stop src from destructing + dst->in_src = src; // remember so can decrement later + } + + // MRIS + // +#define SEP +#define ELTX(C,T,N) ELT(C,T,N) +#define ELT(C,T,N) *(T*)&(dst->N) = src->N; // support initializing the const members + MRIS_MP__LIST_MRIS_IN SEP MRIS_MP__LIST_MRIS_IN_OUT + if (!only_inputs) MRIS_MP__LIST_MRIS_OUT +#undef ELT +#undef ELTX +#undef SEP + + // Vertices + // +#define SEP +#define ELTX(C,T,N) ELT(C,T,N) +#define ELT(C,T,N) dst->v_##N = src->v_##N; + MRIS_MP__LIST_V_IN +#undef ELT +#undef ELTX +#undef SEP + +#define SEP +#define ELTX(C,T,N) ELT(C,T,N) +#define ELT(C,T,N) T* v_##N = (T*)realloc((void*)dst->v_##N, dst->nvertices*sizeof(T)); dst->v_##N = v_##N; + MRIS_MP__LIST_V_IN_OUT SEP MRIS_MP__LIST_V_OUT +#undef ELT +#undef ELTX +#undef SEP + + if (dst->status != MRIS_PLANE) { freeAndNULL(dst->v_neg); v_neg = NULL; } + + int vno; + for (vno = 0; vno < src->nvertices; vno++) { +#define SEP +#define ELTX(C,T,N) // these are the special cases dealt with here + v_dist [vno] = NULL; // will make when needed +#define ELT(C,T,N) v_##N[vno] = src->v_##N[vno]; + if (!no_need_to_copy_xyz) { MRIS_MP__LIST_V_IN_OUT_XYZ } + MRIS_MP__LIST_V_IN_OUT_NOXYZ + if (!only_inputs) { + if (v_neg) v_neg[vno] = src->v_neg[vno]; + if (src->v_dist[vno]) { + MRISMP_makeDist2(dst, vno, src->v_dist_capacity[vno]); + memcpy(v_dist[vno], src->v_dist[vno], src->v_dist_capacity[vno]*sizeof(*v_dist[vno])); + } + MRIS_MP__LIST_V_OUT + } +#undef ELT +#undef ELTX +#undef SEP + } + + // Faces + // +#define SEP +#define ELTX(C,T,N) ELT(C,T,N) +#define ELT(C,T,N) T* f_##N = (T*)realloc((void*)dst->f_##N, dst->nfaces*sizeof(T)); dst->f_##N = f_##N; + MRIS_MP__LIST_F_OUT +#undef ELT +#undef ELTX +#undef SEP + +#define SEP +#define ELTX(C,T,N) ELT(C,T,N) +#define ELT(C,T,N) dst->f_##N = src->f_##N; + MRIS_MP__LIST_F_IN +#undef ELT +#undef ELTX +#undef SEP + +#ifdef MRIS_MP__LIST_F_IN_OUT + move test inside the loop when there are MRIS_MP__LIST_F_OUT to process +#endif + if (!only_inputs) { + int fno; + for (fno = 0; fno < dst->nfaces; fno++) { +#define SEP +#define ELTX(C,T,N) // these are the special cases dealt with here +#define ELT(C,T,N) f_##N[fno] = src->f_##N[fno]; + f_normSet[fno] = src->f_normSet[fno]; + f_norm [fno] = src->f_norm [fno]; + copyAnglesPerTriangle(f_angle[fno],src->f_angle[fno]); // not so special + MRIS_MP__LIST_F_OUT +#undef ELT +#undef ELTX +#undef SEP + } + } +} + + +void MRISMP_load(MRIS_MP* mp, MRIS* mris, + bool loadOutputs, + float * dx_or_NULL, float * dy_or_NULL, float * dz_or_NULL) { + + cheapAssert(!dx_or_NULL == !dy_or_NULL); + cheapAssert(!dx_or_NULL == !dz_or_NULL); + MRISMP_dtr(mp); MRISMP_ctr(mp); @@ -206,6 +219,10 @@ static void MRISMP_load(MRIS* mris, MRIS_MP* mp) { #define ELT(C,T,N) *(T*)&(mp->N) = mris->N; // support initializing the const members MRIS_MP__LIST_MRIS_IN SEP MRIS_MP__LIST_MRIS_IN_OUT + if (loadOutputs) { + ELT(,double,avg_vertex_dist) + MRIS_MP__LIST_MRIS_OUT + } #undef ELT #undef ELTX #undef SEP @@ -215,7 +232,9 @@ static void MRISMP_load(MRIS* mris, MRIS_MP* mp) { #define SEP #define ELTX(C,T,N) ELT(C,T,N) #define ELT(C,T,N) T* v_##N = (T*)malloc(mris->nvertices*sizeof(T)); mp->v_##N = v_##N; - MRIS_MP__LIST_V_IN SEP MRIS_MP__LIST_V_IN_OUT SEP MRIS_MP__LIST_V_OUT + MRIS_MP__LIST_V_IN SEP +#define ELTX(C,T,N) ELT(C,T,N) + MRIS_MP__LIST_V_IN_OUT SEP MRIS_MP__LIST_V_OUT #undef ELT #undef ELTX #undef SEP @@ -227,15 +246,31 @@ static void MRISMP_load(MRIS* mris, MRIS_MP* mp) { VERTEX const * const v = &mris->vertices[vno]; #define SEP #define ELTX(C,T,N) // these are the special cases dealt with here - v_dist_capacity[vno] = v->dist_capacity; + v_dist_orig[vno] = v->dist_orig; v_VSize[vno] = mrisVertexVSize(mris, vno); - if (v_neg) v_neg[vno] = v->neg; - v_dist[vno] = NULL; + v_dist [vno] = NULL; + v_dist_capacity[vno] = 0; #define ELT(C,T,N) v_##N[vno] = v->N; MRIS_MP__LIST_V_IN SEP MRIS_MP__LIST_V_IN_OUT + if (loadOutputs) { + if (v_neg) v_neg[vno] = v->neg; + MRIS_MP__LIST_V_OUT + MRISMP_makeDist2(mp, vno, v->dist_capacity); + memcpy(v_dist [vno], v->dist, v_VSize[vno]*sizeof(*v_dist[vno])); + } #undef ELT #undef ELTX #undef SEP + if (!dx_or_NULL) continue; + if (v->ripflag) { + dx_or_NULL[vno] = 0.0f; + dy_or_NULL[vno] = 0.0f; + dz_or_NULL[vno] = 0.0f; + } else { + dx_or_NULL[vno] = v->dx; + dy_or_NULL[vno] = v->dy; + dz_or_NULL[vno] = v->dz; + } } // Faces @@ -254,9 +289,27 @@ static void MRISMP_load(MRIS* mris, MRIS_MP* mp) { FaceNormCacheEntry const * const fNorm = getFaceNorm(mris, fno); #define SEP #define ELTX(C,T,N) // these are the special cases dealt with here - f_norm_orig_area[fno] = fNorm->orig_area; + f_norm_orig_area [fno] = fNorm->orig_area; + copyAnglesPerTriangle(f_orig_angle[fno],f->orig_angle); #define ELT(C,T,N) f_##N[fno] = f->N; MRIS_MP__LIST_F_IN + f_normSet[fno] = false; + if (loadOutputs) { + MRIS_MP__LIST_F_OUT + DMATRIX* d = f->norm; + if (!d) { + f_norm[fno].x = 0.0; + f_norm[fno].y = 0.0; + f_norm[fno].z = 0.0; + } else { + cheapAssert(d->rows == 3); + cheapAssert(d->cols == 1); + f_norm[fno].x = d->rptr[0][0]; + f_norm[fno].y = d->rptr[1][0]; + f_norm[fno].z = d->rptr[2][0]; + } + copyAnglesPerTriangle(f_angle[fno],f->angle); + } #undef ELT #undef ELTX #undef SEP @@ -280,7 +333,7 @@ static void comparisonWkr(int vnoOrFno, double lhs, double rhs, const char* expr if (count == 1) fprintf(stdout, "b %s:%d needed\n",__FILE__,__LINE__); } -static void MRISMP_unload(MRIS* mris, MRIS_MP* mp, bool check) { +void MRISMP_unload(MRIS* mris, MRIS_MP* mp, bool check) { int errorCount = 0; // MRIS @@ -324,12 +377,10 @@ static void MRISMP_unload(MRIS* mris, MRIS_MP* mp, bool check) { if (mp->v_dist[vno]) { if (!check) { // this requires that the dist capacity match, not just the vtotal mrisSetDist(mris,vno,mp->v_dist[vno],mp->v_dist_capacity[vno]); // why assign and free when you can just move? - mp->v_dist[vno] = NULL; + mp->v_dist[vno] = mp->v_dist_buffer[vno] = NULL; + mp->v_dist_capacity[vno] = 0; } else { - if (!check && !v->dist) - MRISmakeDist(mris,vno); - float* const mp_dist = mp->v_dist[vno]; float* const mris_dist = v->dist; @@ -342,7 +393,6 @@ static void MRISMP_unload(MRIS* mris, MRIS_MP* mp, bool check) { } } } - comparison(vno,v->dist_capacity,mp->v_dist_capacity[vno]) // must be after MRISmakeDist or mrisSetDist #define ELT(C,T,N) comparison(vno,v->N,mp->v_##N[vno]); MRIS_MP__LIST_V_IN #undef ELT @@ -364,6 +414,7 @@ static void MRISMP_unload(MRIS* mris, MRIS_MP* mp, bool check) { #define SEP #define ELTX(C,T,N) // these are the special cases dealt with here if (check) comparison(fno,fNorm->orig_area,mp->f_norm_orig_area[fno]) else setFaceOrigArea(mris, fno, mp->f_norm_orig_area[fno]); + if (check) comparison(fno,cmpAnglesPerTriangle(f->orig_angle,mp->f_orig_angle[fno]),0) else copyAnglesPerTriangle(f->orig_angle,mp->f_orig_angle[fno]); if (mp->f_normSet[fno]) { FloatXYZ* fn = &mp->f_norm[fno]; if (!check) { @@ -388,13 +439,7 @@ static void MRISMP_unload(MRIS* mris, MRIS_MP* mp, bool check) { #undef comparison -static void MRISMP_makeDist(MRIS_MP* mp, int vno) { - int capacity = mp->v_dist_capacity[vno]; - int vSize = mp->v_VSize[vno]; - if (capacity < vSize) capacity = vSize; - mp->v_dist [vno] = mrisStealDistStore(mp->underlyingMRIS, vno, capacity); - mp->v_dist_capacity[vno] = capacity; -} + // // @@ -1104,7 +1149,7 @@ int mrismp_OrientSurface(MRIS_MP *mris) } -static void MRISMP_computeMetricProperties(MRIS_MP* mris) { +void MRIScomputeMetricProperties(MRIS_MP* mris) { // fprintf(stdout,"%s:%d %s\n",__FILE__,__LINE__,__MYFUNCTION__); MRISMP_computeNormals(mris, false); // changes XYZ diff --git a/utils/mrisurf_mri.cpp b/utils/mrisurf_mri.cpp index 9deb4d60df6..b5f173ba51c 100644 --- a/utils/mrisurf_mri.cpp +++ b/utils/mrisurf_mri.cpp @@ -27,6 +27,9 @@ #include "region.h" #include "surfgrad.h" +#include "mrisurf_base.h" + + static void showDtSSeRmsWkr(FILE* file, int n, double dt, double sse, double rms, double last_rms, int line) { fprintf(file, "%3.3d: dt: %2.4f, sse=%2.1f, rms=%2.3f", n+1, dt, (float)sse, (float)rms); diff --git a/utils/mrisurf_project.cpp b/utils/mrisurf_project.cpp index 807536b8a3c..29dd0ecf1cc 100644 --- a/utils/mrisurf_project.cpp +++ b/utils/mrisurf_project.cpp @@ -19,7 +19,7 @@ * */ #include "mrisurf_project.h" - +#include "mrisurf_base.h" /* project onto the sphere of radius DEFAULT_RADIUS */ void mrisSphericalProjectXYZ(float xs, float ys, float zs, float *xd, float *yd, float *zd) @@ -92,65 +92,40 @@ void mrisSphericalProjection(MRIS *mris) } -/*----------------------------------------------------- - Parameters: - - Returns value: - - Description - Perform a projection onto an sphere moving each - point on the cortical surface to the closest spherical - coordinate. - ------------------------------------------------------*/ -MRI_SURFACE *MRISprojectOntoSphere(MRI_SURFACE *mris_src, MRI_SURFACE *mris_dst, double r) +static MRIS* MRISprojectOntoSphereWkr(MRIS* mris, double r) { - VERTEX *v; - int vno; - double x, y, z, d, dx, dy, dz, dist, total_dist, x2, y2, z2; - if (FZERO(r)) { r = DEFAULT_RADIUS; } - if (!mris_dst) { - mris_dst = MRISclone(mris_src); - mris_dst->status = mris_src->status; // added this, think it right - Bevin + if ((mris->status != MRIS_SPHERE) && (mris->status != MRIS_PARAMETERIZED_SPHERE)) { + MRIScenter(mris, mris); } - if ((mris_dst->status != MRIS_SPHERE) && (mris_dst->status != MRIS_PARAMETERIZED_SPHERE)) { - MRIScenter(mris_dst, mris_dst); - } + mris->radius = r; - mris_dst->radius = r; + MRISfreeDistsButNotOrig(mris); - MRISfreeDistsButNotOrig(mris_dst); + bool const showTotalDist = ((Gdiag & DIAG_SHOW) && DIAG_VERBOSE_ON); + + double total_dist = 0.0; + for (int vno = 0; vno < mris->nvertices; vno++) { - for (total_dist = vno = 0; vno < mris_dst->nvertices; vno++) { - v = &mris_dst->vertices[vno]; + auto v = &mris->vertices[vno]; if (v->ripflag) /* shouldn't happen */ - { continue; - } - if (false && vno == 118009) { - DiagBreak(); - } - x = (double)v->x; - y = (double)v->y; - z = (double)v->z; - x2 = x * x; - y2 = y * y; - z2 = z * z; - dist = sqrt(x2 + y2 + z2); - if (FZERO(dist)) { - d = 0; - } - else { - d = 1 - r / dist; - } - dx = d * x; - dy = d * y; - dz = d * z; + double const x = v->x, x2 = x*x; + double const y = v->y, y2 = y*y; + double const z = v->z, z2 = z*z; + + double const dist = sqrt(x2 + y2 + z2); + double const d = FZERO(dist) ? 0 : (1 - r / dist); + + double const dx = d * x; + double const dy = d * y; + double const dz = d * z; + v->x = x - dx; v->y = y - dy; v->z = z - dz; @@ -159,30 +134,43 @@ MRI_SURFACE *MRISprojectOntoSphere(MRI_SURFACE *mris_src, MRI_SURFACE *mris_dst, DiagBreak(); } - /* if ((Gdiag & DIAG_SHOW) && DIAG_VERBOSE_ON)*/ - { - dist = sqrt((double)(dx * dx + dy * dy + dz * dz)); - total_dist += dist; - } -#if 1 - x = (double)v->x; - y = (double)v->y; - z = (double)v->z; - x2 = x * x; - y2 = y * y; - z2 = z * z; - dist = sqrt(x2 + y2 + z2); -#endif + if (showTotalDist) total_dist += sqrt((double)(dx*dx + dy*dy + dz*dz)); } - if ((Gdiag & DIAG_SHOW) && DIAG_VERBOSE_ON) { + + if (showTotalDist) { fprintf(stdout, "sphere_project: total dist = %f\n", total_dist); } - MRISupdateEllipsoidSurface(mris_dst); - mris_dst->status = mris_src->status == MRIS_PARAMETERIZED_SPHERE ? MRIS_PARAMETERIZED_SPHERE : MRIS_SPHERE; - return (mris_dst); + + mris->status = (mris->status == MRIS_PARAMETERIZED_SPHERE) ? MRIS_PARAMETERIZED_SPHERE : MRIS_SPHERE; + + MRISupdateEllipsoidSurface(mris); + + return mris; } +MRIS* MRISprojectOntoSphere(MRIS* mris, double r) +{ + return MRISprojectOntoSphereWkr(mris, r); +} + +MRIS_MP* MRISprojectOntoSphere(MRIS_MP* mris, double r) +{ + cheapAssert(false); + return mris; +} + + +MRIS* MRISprojectOntoSphere(MRIS* mris_src, MRIS* mris_dst, double r) +{ + cheapAssert(mris_src == mris_dst); + auto result = MRISprojectOntoSphere(mris_src, r); + cheapAssert(result == mris_dst); + return result; +} + + + void mrisAssignFaces(MRI_SURFACE *mris, MHT *mht, int which_vertices) { int vno; diff --git a/utils/mrisurf_sseTerms.cpp b/utils/mrisurf_sseTerms.cpp index 583c43577f2..77ef0acc68c 100644 --- a/utils/mrisurf_sseTerms.cpp +++ b/utils/mrisurf_sseTerms.cpp @@ -15,6 +15,12 @@ #include "mrisurf_sseTerms.h" #include "mrisurf_project.h" +#include "mrisurf_base.h" +#include "mrisurf_MRIS_MP.h" +#include "mrisurf_SurfaceFromMRIS_MP_generated.h" + +#include "mrishash_SurfaceFromMRIS.h" + #define MAX_VOXELS mrisurf_sse_MAX_VOXELS #define MAX_DISPLACEMENT mrisurf_sse_MAX_DISPLACEMENT @@ -43,10 +49,14 @@ struct SseTermsBase { }; -// This template is for all the terms that can be computed from any Surface +// This template is for all the terms that can be computed from any Surface // -template -struct SseTerms_Template : public SseTermsBase { +template +struct SseTerms_DistortedSurfaces : public SseTermsBase { + typedef _Surface Surface; + typedef typename Surface::Face Face; + typedef typename Surface::Vertex Vertex; + Surface surface; #if METRIC_SCALE double const area_scale; @@ -58,7 +68,7 @@ struct SseTerms_Template : public SseTermsBase { int const fnoBegin; int const fnoEnd; - SseTerms_Template(Surface surface, int selector) + SseTerms_DistortedSurfaces(Surface surface, int selector) : surface(surface), #if METRIC_SCALE area_scale((surface.patch()) ? 1.0 : // it is weird that this doesn't have all the alternatives the dist has @@ -263,15 +273,43 @@ struct SseTerms_Template : public SseTermsBase { }; -typedef SurfaceFromMRIS::Distort::Surface MRIS_Surface; -typedef SurfaceFromMRIS::Distort::Face MRIS_Face; -typedef SurfaceFromMRIS::Distort::Vertex MRIS_Vertex; +// Choose the Surface et al to be used for MRIS and for MRIS_MP +// +typedef SurfaceFromMRIS::Distort::Surface SSE_Surface_type_MRIS; +typedef SurfaceFromMRIS_MP::Distort::Surface SSE_Surface_types_MRIS_MP; -typedef SseTerms_Template SseTerms_Template_for_SurfaceFromMRIS; -struct SseTerms : public SseTerms_Template_for_SurfaceFromMRIS { + +// This maps the MRIS and MRIS_MP to the set of functions that are implemented for them +// whether done using the SseTerms_DistortedSurfaces implementations or specific implementations or not at all +// +typedef SseTerms_DistortedSurfaces SseTerms_Template_for_SurfaceFromMRIS; + +struct SseTerms_MRIS : public SseTerms_Template_for_SurfaceFromMRIS { MRIS* const mris; - SseTerms(MRIS* const mris, int selector) : SseTerms_Template_for_SurfaceFromMRIS(MRIS_Surface(mris),selector), mris(mris) {} + SseTerms_MRIS(MRIS* const mris, int selector) : SseTerms_Template_for_SurfaceFromMRIS(Surface(mris),selector), mris(mris) {} + + #define MRIS_PARAMETER + #define MRIS_PARAMETER_COMMA + #define NOCOMMA_SELECTOR + #define COMMA_SELECTOR + #define SEP + #define ELT(NAME, SIGNATURE, CALL) double NAME SIGNATURE; + LIST_OF_SSETERMS + #undef ELT + #undef SEP + #undef NOCOMMA_SELECTOR + #undef COMMA_SELECTOR + #undef MRIS_PARAMETER_COMMA + #undef MRIS_PARAMETER +}; + + +typedef SseTerms_DistortedSurfaces SseTerms_Template_for_SurfaceFromMRIS_MP; + +struct SseTerms_MRIS_MP : public SseTerms_Template_for_SurfaceFromMRIS_MP { + MRIS_MP* const mris; + SseTerms_MRIS_MP(MRIS_MP* const mris, int selector) : SseTerms_Template_for_SurfaceFromMRIS_MP(Surface(mris),selector), mris(mris) {} #define MRIS_PARAMETER #define MRIS_PARAMETER_COMMA @@ -289,25 +327,27 @@ struct SseTerms : public SseTerms_Template_for_SurfaceFromMRIS { }; + //============= // Energy Terms // -double SseTerms::RepulsiveRatioEnergy(double l_repulse) +double SseTerms_MRIS::RepulsiveRatioEnergy(double l_repulse) { return SseTerms_Template_for_SurfaceFromMRIS::RepulsiveRatioEnergy(l_repulse); } -double SseTerms::SpringEnergy() + +double SseTerms_MRIS::SpringEnergy() { return SseTerms_Template_for_SurfaceFromMRIS::SpringEnergy(); } -double SseTerms::LaplacianEnergy() +double SseTerms_MRIS::LaplacianEnergy() { return SseTerms_Template_for_SurfaceFromMRIS::LaplacianEnergy(); } -double SseTerms::TangentialSpringEnergy() +double SseTerms_MRIS::TangentialSpringEnergy() { return SseTerms_Template_for_SurfaceFromMRIS::TangentialSpringEnergy(); } @@ -318,12 +358,12 @@ double SseTerms::TangentialSpringEnergy() // Misc // -double SseTerms::NonlinearDistanceSSE() +double SseTerms_MRIS::NonlinearDistanceSSE() { return SseTerms_Template_for_SurfaceFromMRIS::TangentialSpringEnergy(); } -double SseTerms::NonlinearAreaSSE() +double SseTerms_MRIS::NonlinearAreaSSE() { return SseTerms_Template_for_SurfaceFromMRIS::NonlinearAreaSSE(); } @@ -340,7 +380,7 @@ double SseTerms::NonlinearAreaSSE() the square of the constant term (the distance the quadratic fit surface is from going through the central vertex) ------------------------------------------------------*/ -double SseTerms::QuadraticCurvatureSSE( double l_curv) // BEVIN mris_make_surfaces 3 +double SseTerms_MRIS::QuadraticCurvatureSSE( double l_curv) // BEVIN mris_make_surfaces 3 { if (FZERO(l_curv)) { return (NO_ERROR); @@ -493,7 +533,7 @@ double SseTerms::QuadraticCurvatureSSE( double l_curv) // BEVIN mris_ Description ------------------------------------------------------*/ -double SseTerms::ThicknessMinimizationEnergy( double l_thick_min, INTEGRATION_PARMS *parms) +double SseTerms_MRIS::ThicknessMinimizationEnergy( double l_thick_min, INTEGRATION_PARMS *parms) { int vno; double sse_tmin; @@ -545,7 +585,7 @@ double SseTerms::ThicknessMinimizationEnergy( double l_thick_min, INTEGRATION_PA } -double SseTerms::ThicknessParallelEnergy( double l_thick_parallel, INTEGRATION_PARMS *parms) +double SseTerms_MRIS::ThicknessParallelEnergy( double l_thick_parallel, INTEGRATION_PARMS *parms) { int vno, max_vno; double sse_tparallel, max_inc; @@ -604,7 +644,7 @@ double SseTerms::ThicknessParallelEnergy( double l_thick_parallel, INTEGRATION_P } -double SseTerms::ThicknessSmoothnessEnergy( double l_tsmooth, INTEGRATION_PARMS *parms) +double SseTerms_MRIS::ThicknessSmoothnessEnergy( double l_tsmooth, INTEGRATION_PARMS *parms) { int vno, n; double sse_tsmooth, v_sse, dn, dx, dy, dz, d0; @@ -643,7 +683,7 @@ double SseTerms::ThicknessSmoothnessEnergy( double l_tsmooth, INTEGRATION_PARMS static double big_sse = 10.0; -double SseTerms::ThicknessNormalEnergy( double l_thick_normal, INTEGRATION_PARMS *parms) +double SseTerms_MRIS::ThicknessNormalEnergy( double l_thick_normal, INTEGRATION_PARMS *parms) { int vno; double sse_tnormal; @@ -719,7 +759,7 @@ double SseTerms::ThicknessNormalEnergy( double l_thick_normal, INTEGRATION_PARMS } -double SseTerms::ThicknessSpringEnergy( double l_thick_spring, INTEGRATION_PARMS *parms) +double SseTerms_MRIS::ThicknessSpringEnergy( double l_thick_spring, INTEGRATION_PARMS *parms) { int vno; double sse_spring, sse; @@ -775,7 +815,7 @@ double SseTerms::ThicknessSpringEnergy( double l_thick_spring, INTEGRATION_PARMS /*! - \fn double SseTerms::RepulsiveEnergy( double l_repulse, MHT *mht, MHT *mht_faces) + \fn double SseTerms_MRIS::RepulsiveEnergy( double l_repulse, MHT *mht, MHT *mht_faces) \brief The repulsive term causes vertices to push away from each other based on the distance in 3D space (does not apply to nearest neighbors). This helps to prevent self-intersection. The force is @@ -786,7 +826,7 @@ double SseTerms::ThicknessSpringEnergy( double l_thick_spring, INTEGRATION_PARMS REPULSE_E - sets minimum distance 4 - scaling term */ -double SseTerms::RepulsiveEnergy( double l_repulse, MHT *mht, MHT *mht_faces) +double SseTerms_MRIS::RepulsiveEnergy( double l_repulse, MHT *mht, MHT *mht_faces) { int vno, num, min_vno, i, n; float dist, dx, dy, dz, x, y, z, min_d; @@ -893,7 +933,7 @@ double SseTerms::RepulsiveEnergy( double l_repulse, MHT *mht, MHT *mht_faces) } -double SseTerms::NonlinearSpringEnergy( INTEGRATION_PARMS *parms) +double SseTerms_MRIS::NonlinearSpringEnergy( INTEGRATION_PARMS *parms) { int vno, n; double area_scale, sse_spring, E, F, f, rmin, rmax, ftotal; @@ -948,7 +988,7 @@ double SseTerms::NonlinearSpringEnergy( INTEGRATION_PARMS *parms) return (sse_spring); } -double SseTerms::SurfaceRepulsionEnergy( double l_repulse, MHT *mht) +double SseTerms_MRIS::SurfaceRepulsionEnergy( double l_repulse, MHT *mht) { int vno, max_vno, i; float dx, dy, dz, x, y, z, sx, sy, sz, norm[3], dot; @@ -1028,7 +1068,7 @@ double SseTerms::SurfaceRepulsionEnergy( double l_repulse, MHT *mht) } -double SseTerms::AshburnerTriangleEnergy( +double SseTerms_MRIS::AshburnerTriangleEnergy( double l_ashburner_triangle, INTEGRATION_PARMS *parms) { @@ -1068,7 +1108,7 @@ double SseTerms::AshburnerTriangleEnergy( return (sse_ashburner); } -double SseTerms::HistoNegativeLikelihood( INTEGRATION_PARMS *parms) +double SseTerms_MRIS::HistoNegativeLikelihood( INTEGRATION_PARMS *parms) { double likelihood, entropy; int x, y, z, label; @@ -1128,7 +1168,7 @@ double SseTerms::HistoNegativeLikelihood( INTEGRATION_PARMS *parms) } -double SseTerms::NegativeLogPosterior( INTEGRATION_PARMS *parms, int *pnvox) +double SseTerms_MRIS::NegativeLogPosterior( INTEGRATION_PARMS *parms, int *pnvox) { MRI *mri = parms->mri_brain; double sse = 0.0, ll, wm_frac, gm_frac, out_frac, Ig, Ic, pval; @@ -1253,7 +1293,7 @@ double SseTerms::NegativeLogPosterior( INTEGRATION_PARMS *parms, int *pnvox) } -double SseTerms::NegativeLogPosterior2D( INTEGRATION_PARMS *parms, int *pnvox) +double SseTerms_MRIS::NegativeLogPosterior2D( INTEGRATION_PARMS *parms, int *pnvox) { MRI *mri = parms->mri_brain; MHT *mht; @@ -1482,7 +1522,7 @@ double SseTerms::NegativeLogPosterior2D( INTEGRATION_PARMS *parms, int *pnvox) //=================================================================================================== // Error functions // -double SseTerms::DistanceError( INTEGRATION_PARMS *parms) +double SseTerms_MRIS::DistanceError( INTEGRATION_PARMS *parms) { if (!(mris->dist_alloced_flags & 1)) { switch (copeWithLogicProblem("FREESURFER_fix_mrisComputeDistanceError","should have computed distances already")) { @@ -1694,7 +1734,7 @@ double MRIScomputeCorrelationError(MRI_SURFACE *mris, MRI_SP *mrisp_template, in return (sqrt(error / (double)MRISvalidVertices(mris))); } -double SseTerms::CorrelationError( INTEGRATION_PARMS *parms, int use_stds) +double SseTerms_MRIS::CorrelationError( INTEGRATION_PARMS *parms, int use_stds) { float l_corr; @@ -1802,13 +1842,13 @@ double SseTerms::CorrelationError( INTEGRATION_PARMS *parms, int use_stds) /*! - \fn double SseTerms::IntensityError( INTEGRATION_PARMS *parms) + \fn double SseTerms_MRIS::IntensityError( INTEGRATION_PARMS *parms) \brief Computes the sum of the squares of the value at a vertex minus the v->val. Ignores ripped vertices or any with v->val<0. Does not normalize by the number of vertices. Basically same computation as mrisRmsValError() but that func does normalize. */ -double SseTerms::IntensityError( INTEGRATION_PARMS *parms) +double SseTerms_MRIS::IntensityError( INTEGRATION_PARMS *parms) { int vno,nhits; VERTEX *v; @@ -1835,7 +1875,7 @@ double SseTerms::IntensityError( INTEGRATION_PARMS *parms) } -double SseTerms::TargetLocationError( INTEGRATION_PARMS *parms) +double SseTerms_MRIS::TargetLocationError( INTEGRATION_PARMS *parms) { int vno, max_vno; VERTEX *v; @@ -1883,7 +1923,7 @@ double SseTerms::TargetLocationError( INTEGRATION_PARMS *parms) } -double SseTerms::RmsDistanceError() +double SseTerms_MRIS::RmsDistanceError() { INTEGRATION_PARMS parms; double rms; @@ -1895,7 +1935,7 @@ double SseTerms::RmsDistanceError() } -double SseTerms::IntensityGradientError( INTEGRATION_PARMS *parms) +double SseTerms_MRIS::IntensityGradientError( INTEGRATION_PARMS *parms) { int vno; VERTEX *v; @@ -1938,7 +1978,7 @@ double SseTerms::IntensityGradientError( INTEGRATION_PARMS *parms) -double SseTerms::SphereError( double l_sphere, double r0) +double SseTerms_MRIS::SphereError( double l_sphere, double r0) { int vno; double sse, x0, y0, z0; @@ -1997,7 +2037,7 @@ double SseTerms::SphereError( double l_sphere, double r0) return (sse); } -double SseTerms::DuraError( INTEGRATION_PARMS *parms) +double SseTerms_MRIS::DuraError( INTEGRATION_PARMS *parms) { double dura_thresh = parms->dura_thresh, sse; MRI *mri_dura = parms->mri_dura; @@ -2037,7 +2077,7 @@ double SseTerms::DuraError( INTEGRATION_PARMS *parms) } -double SseTerms::VectorCorrelationError( INTEGRATION_PARMS *parms, int use_stds) +double SseTerms_MRIS::VectorCorrelationError( INTEGRATION_PARMS *parms, int use_stds) { double src, target, sse, delta, std; VERTEX *v; @@ -2195,7 +2235,7 @@ double SseTerms::VectorCorrelationError( INTEGRATION_PARMS *parms, int use_stds) } -double SseTerms::ExpandwrapError( MRI *mri_brain, double l_expandwrap, double target_radius) +double SseTerms_MRIS::ExpandwrapError( MRI *mri_brain, double l_expandwrap, double target_radius) { int vno; double xw, yw, zw, x, y, z, val, dx, dy, dz, sse, error, dist; @@ -2243,7 +2283,7 @@ double SseTerms::ExpandwrapError( MRI *mri_brain, double l_expandwrap, double ta return (sse); } -double SseTerms::ShrinkwrapError( MRI *mri_brain, double l_shrinkwrap) +double SseTerms_MRIS::ShrinkwrapError( MRI *mri_brain, double l_shrinkwrap) { #if 0 static int iter = 100 ; @@ -2270,7 +2310,7 @@ double SseTerms::ShrinkwrapError( MRI *mri_brain, double l_shrinkwrap) -double SseTerms::Error( +double SseTerms_MRIS::Error( INTEGRATION_PARMS *parms, float *parea_rms, float *pangle_rms, @@ -2361,6 +2401,7 @@ double SseTerms::Error( return (rms); } + int MRIScomputeDistanceErrors(MRI_SURFACE *mris, int nbhd_size, int max_nbrs) { int vno, n, nvertices; @@ -2611,69 +2652,49 @@ double vlst_loglikelihood2D(MRIS *mris, MRI *mri, int vno, double displacement, // // These are in the order the original code computed them, so that side effects are not reordered // In older code the ashburner_triangle is computed but not used , here it is not computed at all -// -#define COMPUTE_DISTANCE_ERROR mrisComputeDistanceError(mris, parms) +// The ELTS terms have a working overloading of mrisCompute### that can take a SurfaceFromMRIS_MP::XYZPositionConsequences::Surface as their first parameter +// They are implemented below in template struct SseTerms_DistortedSurfaces {...} +// +// The ELTM terms have a working overloading of mrisCompute### that can take a MRIS* as their first parameter +// They also have an asserting overloading that can take a SurfaceFromMRIS_MP::XYZPositionConsequences::Surface as their first parameter +// which will not be called because MRIScomputeSSE_canDo(MRIS_MP* usedOnlyForOverloadingResolution, INTEGRATION_PARMS *parms) returns false for these +// #define SSE_TERMS \ - ELT(sse_area , parms->l_parea, true, computed_area ) SEP \ - ELT(sse_neg_area , parms->l_area, true, computed_neg_area ) SEP \ - ELT(sse_repulse , 1.0, (parms->l_repulse > 0), mrisComputeRepulsiveEnergy(mris, parms->l_repulse, mht_v_current, mht_f_current)) SEP \ - ELT(sse_repulsive_ratio , 1.0, true, mrisComputeRepulsiveRatioEnergy(mris, parms->l_repulse_ratio) ) SEP \ - ELT(sse_tsmooth , 1.0, true, mrisComputeThicknessSmoothnessEnergy(mris, parms->l_tsmooth, parms) ) SEP \ - ELT(sse_thick_min , parms->l_thick_min, true, mrisComputeThicknessMinimizationEnergy(mris, parms->l_thick_min, parms) ) SEP \ - ELT(sse_ashburner_triangle , parms->l_ashburner_triangle, false, mrisComputeAshburnerTriangleEnergy(mris, parms->l_ashburner_triangle, parms) ) SEP \ - ELT(sse_thick_parallel , parms->l_thick_parallel, true, mrisComputeThicknessParallelEnergy(mris, parms->l_thick_parallel, parms) ) SEP \ - ELT(sse_thick_normal , parms->l_thick_normal, true, mrisComputeThicknessNormalEnergy(mris, parms->l_thick_normal, parms) ) SEP \ - ELT(sse_thick_spring , parms->l_thick_spring, true, mrisComputeThicknessSpringEnergy(mris, parms->l_thick_spring, parms) ) SEP \ - ELT(sse_nl_area , parms->l_nlarea, !FZERO(parms->l_nlarea), mrisComputeNonlinearAreaSSE(mris) ) SEP \ - ELT(sse_nl_dist , parms->l_nldist, !DZERO(parms->l_nldist), mrisComputeNonlinearDistanceSSE(mris) ) SEP \ - ELT(sse_dist , parms->l_dist, !DZERO(parms->l_dist), COMPUTE_DISTANCE_ERROR ) SEP \ - ELT(sse_spring , parms->l_spring, !DZERO(parms->l_spring), mrisComputeSpringEnergy(mris) ) SEP \ - ELT(sse_lap , parms->l_lap, !DZERO(parms->l_lap), mrisComputeLaplacianEnergy(mris) ) SEP \ - ELT(sse_tspring , parms->l_tspring, !DZERO(parms->l_tspring), mrisComputeTangentialSpringEnergy(mris) ) SEP \ - ELT(sse_nlspring , parms->l_nlspring, !DZERO(parms->l_nlspring), mrisComputeNonlinearSpringEnergy(mris, parms) ) SEP \ - ELT(sse_curv , l_curv_scaled, !DZERO(parms->l_curv), mrisComputeQuadraticCurvatureSSE(mris, parms->l_curv) ) SEP \ - ELT(sse_corr , l_corr, !DZERO(l_corr), mrisComputeCorrelationError(mris, parms, 1) ) SEP \ - ELT(sse_val , parms->l_intensity, !DZERO(parms->l_intensity), mrisComputeIntensityError(mris, parms) ) SEP \ - ELT(sse_loc , parms->l_location, !DZERO(parms->l_location), mrisComputeTargetLocationError(mris, parms) ) SEP \ - ELT(sse_dura , parms->l_dura, !DZERO(parms->l_dura), mrisComputeDuraError(mris, parms) ) SEP \ - ELT(sse_histo , parms->l_histo, !DZERO(parms->l_histo), mrisComputeHistoNegativeLikelihood(mris, parms) ) SEP \ - ELT(sse_map , parms->l_map, !DZERO(parms->l_map), mrisComputeNegativeLogPosterior(mris, parms, NULL) ) SEP \ - ELT(sse_map2d , parms->l_map2d, !DZERO(parms->l_map2d), mrisComputeNegativeLogPosterior2D(mris, parms, NULL) ) SEP \ - ELT(sse_grad , parms->l_grad, !DZERO(parms->l_grad), mrisComputeIntensityGradientError(mris, parms) ) SEP \ - ELT(sse_sphere , parms->l_sphere, !DZERO(parms->l_sphere), mrisComputeSphereError(mris, parms->l_sphere, parms->a) ) SEP \ - ELT(sse_shrinkwrap , parms->l_shrinkwrap, !DZERO(parms->l_shrinkwrap),mrisComputeShrinkwrapError(mris, parms->mri_brain, parms->l_shrinkwrap) ) SEP \ - ELT(sse_expandwrap , parms->l_expandwrap, !DZERO(parms->l_expandwrap),mrisComputeExpandwrapError(mris, parms->mri_brain, parms->l_expandwrap, parms->target_radius)) SEP \ - ELT(sse_vectorCorrelationError, 1.0, use_multiframes, mrisComputeVectorCorrelationError(mris, parms, 1) ) \ + ELTM(sse_area , parms->l_parea, true, computed_area ) \ + ELTM(sse_neg_area , parms->l_area, true, computed_neg_area ) \ + ELTM(sse_repulse , 1.0, (parms->l_repulse > 0), mrisComputeRepulsiveEnergy(mris, parms->l_repulse, mht_v_current, mht_f_current)) \ + ELTM(sse_repulsive_ratio , 1.0, true, mrisComputeRepulsiveRatioEnergy(mris, parms->l_repulse_ratio) ) \ + ELTM(sse_tsmooth , 1.0, true, mrisComputeThicknessSmoothnessEnergy(mris, parms->l_tsmooth, parms) ) \ + ELTM(sse_thick_min , parms->l_thick_min, true, mrisComputeThicknessMinimizationEnergy(mris, parms->l_thick_min, parms) ) \ + ELTM(sse_ashburner_triangle , parms->l_ashburner_triangle, false, mrisComputeAshburnerTriangleEnergy(mris, parms->l_ashburner_triangle, parms) ) \ + ELTM(sse_thick_parallel , parms->l_thick_parallel, true, mrisComputeThicknessParallelEnergy(mris, parms->l_thick_parallel, parms) ) \ + ELTM(sse_thick_normal , parms->l_thick_normal, true, mrisComputeThicknessNormalEnergy(mris, parms->l_thick_normal, parms) ) \ + ELTM(sse_thick_spring , parms->l_thick_spring, true, mrisComputeThicknessSpringEnergy(mris, parms->l_thick_spring, parms) ) \ + ELTM(sse_nl_area , parms->l_nlarea, !FZERO(parms->l_nlarea), mrisComputeNonlinearAreaSSE(mris) ) \ + ELTM(sse_nl_dist , parms->l_nldist, !DZERO(parms->l_nldist), mrisComputeNonlinearDistanceSSE(mris) ) \ + ELTM(sse_dist , parms->l_dist, !DZERO(parms->l_dist), mrisComputeDistanceError(mris, parms) ) \ + ELTM(sse_spring , parms->l_spring, !DZERO(parms->l_spring), mrisComputeSpringEnergy(mris) ) \ + ELTM(sse_lap , parms->l_lap, !DZERO(parms->l_lap), mrisComputeLaplacianEnergy(mris) ) \ + ELTM(sse_tspring , parms->l_tspring, !DZERO(parms->l_tspring), mrisComputeTangentialSpringEnergy(mris) ) \ + ELTM(sse_nlspring , parms->l_nlspring, !DZERO(parms->l_nlspring), mrisComputeNonlinearSpringEnergy(mris, parms) ) \ + ELTM(sse_curv , l_curv_scaled, !DZERO(parms->l_curv), mrisComputeQuadraticCurvatureSSE(mris, parms->l_curv) ) \ + ELTM(sse_corr , l_corr, !DZERO(l_corr), mrisComputeCorrelationError(mris, parms, 1) ) \ + ELTM(sse_val , parms->l_intensity, !DZERO(parms->l_intensity), mrisComputeIntensityError(mris, parms) ) \ + ELTM(sse_loc , parms->l_location, !DZERO(parms->l_location), mrisComputeTargetLocationError(mris, parms) ) \ + ELTM(sse_dura , parms->l_dura, !DZERO(parms->l_dura), mrisComputeDuraError(mris, parms) ) \ + ELTM(sse_histo , parms->l_histo, !DZERO(parms->l_histo), mrisComputeHistoNegativeLikelihood(mris, parms) ) \ + ELTM(sse_map , parms->l_map, !DZERO(parms->l_map), mrisComputeNegativeLogPosterior(mris, parms, NULL) ) \ + ELTM(sse_map2d , parms->l_map2d, !DZERO(parms->l_map2d), mrisComputeNegativeLogPosterior2D(mris, parms, NULL) ) \ + ELTM(sse_grad , parms->l_grad, !DZERO(parms->l_grad), mrisComputeIntensityGradientError(mris, parms) ) \ + ELTM(sse_sphere , parms->l_sphere, !DZERO(parms->l_sphere), mrisComputeSphereError(mris, parms->l_sphere, parms->a) ) \ + ELTM(sse_shrinkwrap , parms->l_shrinkwrap, !DZERO(parms->l_shrinkwrap),mrisComputeShrinkwrapError(mris, parms->mri_brain, parms->l_shrinkwrap) ) \ + ELTM(sse_expandwrap , parms->l_expandwrap, !DZERO(parms->l_expandwrap),mrisComputeExpandwrapError(mris, parms->mri_brain, parms->l_expandwrap, parms->target_radius)) \ + ELTM(sse_vectorCorrelationError, 1.0, use_multiframes, mrisComputeVectorCorrelationError(mris, parms, 1) ) \ // end of list -#if defined(COMPILING_MRIS_MP) -bool MRISMP_computeSSE_canDo(INTEGRATION_PARMS *parms) -{ - debug |= debugNonDeterminism; - - bool const use_multiframes = !!(parms->flags & IP_USE_MULTIFRAMES); - // double const l_corr = (double)(parms->l_corr + parms->l_pcorr); - - bool result = true; -#define SEP -#define ELTM(NAME,MULTIPLIER,COND,EXPR,EXPRM) -#define ELT(NAME, MULTIPLIER, COND, EXPR) \ - if (COND) { static bool reported = false; \ - if (!reported) { reported = true; fprintf(stdout, "%s:%d can't do %s %s\n", __FILE__,__LINE__,#NAME,#EXPR); } \ - result = false; \ - } - SSE_TERMS - ELT(sse_init,1.0,gMRISexternalSSE,) -#undef ELT -#undef ELTM -#undef SEP - return result; -} -#endif - - -double MRIScomputeSSE(MRI_SURFACE *mris, INTEGRATION_PARMS *parms) +template +double MRIScomputeSSE_template(Surface surface, Some_MRIS* mris, INTEGRATION_PARMS *parms) { bool const debug = debugNonDeterminism; @@ -2682,7 +2703,7 @@ double MRIScomputeSSE(MRI_SURFACE *mris, INTEGRATION_PARMS *parms) double const l_curv_scaled = (double)parms->l_curv * CURV_SCALE; double const area_scale = #if METRIC_SCALE - (mris->patch || mris->noscale) ? 1.0 : mris->orig_area / mris->total_area; + (surface.patch() || surface.noscale()) ? 1.0 : surface.orig_area() / surface.total_area(); #else 1.0; #endif @@ -2700,11 +2721,13 @@ double MRIScomputeSSE(MRI_SURFACE *mris, INTEGRATION_PARMS *parms) relevant_angle = 0; computed_neg_area = 0; computed_area = 0; + auto const nfaces = surface.nfaces(); + #ifdef BEVIN_MRISCOMPUTESSE_REPRODUCIBLE #define ROMP_VARIABLE fno #define ROMP_LO 0 - #define ROMP_HI mris->nfaces + #define ROMP_HI nfaces #define ROMP_SUMREDUCTION0 relevant_angle #define ROMP_SUMREDUCTION1 computed_neg_area @@ -2726,7 +2749,7 @@ double MRIScomputeSSE(MRI_SURFACE *mris, INTEGRATION_PARMS *parms) int fno; - ROMP_PF_begin // mris_register + ROMP_PF_begin #ifdef BEVIN_MRISCOMPUTESSE_CHECK #pragma omp parallel for if(trial==0) reduction(+ : relevant_angle, computed_neg_area, computed_area) @@ -2735,27 +2758,29 @@ double MRIScomputeSSE(MRI_SURFACE *mris, INTEGRATION_PARMS *parms) #pragma omp parallel for if_ROMP(fast) reduction(+ : relevant_angle, computed_neg_area, computed_area) #endif #endif - for (fno = 0; fno < mris->nfaces; fno++) { + for (fno = 0; fno < nfaces; fno++) { ROMP_PFLB_begin #endif - FACE const * const face = &mris->faces[fno]; - if (face->ripflag) ROMP_PF_continue; + auto face = surface.faces(fno); + if (face.ripflag()) ROMP_PF_continue; FaceNormCacheEntry const * const fNorm = getFaceNorm(mris, fno); { - double const delta = (double)(area_scale * face->area - fNorm->orig_area); + auto const area = face.area(); + double const delta = (double)(area_scale * area - fNorm->orig_area); #if ONLY_NEG_AREA_TERM - if (face->area < 0.0f) computed_neg_area += delta * delta; + if (area < 0.0f) computed_neg_area += delta * delta; #endif computed_area += delta * delta; } int ano; for (ano = 0; ano < ANGLES_PER_TRIANGLE; ano++) { - double delta = deltaAngle(face->angle[ano], face->orig_angle[ano]); + auto const angle = face.angle()[ano]; + double delta = deltaAngle(angle, face.orig_angle()[ano]); #if ONLY_NEG_AREA_TERM - if (face->angle[ano] >= 0.0f) delta = 0.0f; + if (angle >= 0.0f) delta = 0.0f; #endif relevant_angle += delta * delta; @@ -2809,17 +2834,17 @@ double MRIScomputeSSE(MRI_SURFACE *mris, INTEGRATION_PARMS *parms) MHT* mht_f_current = NULL; if (!FZERO(parms->l_repulse)) { double vmean, vsigma; - vmean = MRIScomputeTotalVertexSpacingStats(mris, &vsigma, NULL, NULL, NULL, NULL); + vmean = MRIScomputeTotalVertexSpacingStats (mris, &vsigma, NULL, NULL, NULL, NULL); mht_v_current = MHTcreateVertexTable_Resolution(mris, CURRENT_VERTICES, vmean); mht_f_current = MHTcreateFaceTable_Resolution (mris, CURRENT_VERTICES, vmean); } -#define SEP -#define ELT(NAME, MULTIPLIER, COND, EXPR) double const NAME = (COND) ? (EXPR) : 0.0; +#define ELTS(NAME, MULTIPLIER, COND, EXPR) double const NAME = (COND) ? (EXPR) : 0.0; +#define ELTM(NAME, MULTIPLIER, COND, EXPR) double const NAME = (COND) ? (EXPR) : 0.0; SSE_TERMS -#undef ELT -#undef SEP +#undef ELTM +#undef ELTS if (parms->l_thick_spring > 0 || parms->l_thick_min > 0 || parms->l_thick_parallel > 0 /* && DIAG_VERBOSE_ON*/) printf("min=%2.3f, parallel=%2.4f, normal=%2.4f, spring=%2.4f, ashburner=%2.3f, tsmooth=%2.3f\n", @@ -2836,22 +2861,23 @@ double MRIScomputeSSE(MRI_SURFACE *mris, INTEGRATION_PARMS *parms) sse_init = (*gMRISexternalSSE)(mris, parms); } - double sse = sse_init + -#define SEP + -#define ELT(NAME, MULTIPLIER, COND, EXPR) (MULTIPLIER) * (NAME) - SSE_TERMS ; -#undef ELT -#undef SEP + double sse = sse_init +#define ELTS(NAME, MULTIPLIER, COND, EXPR) + (MULTIPLIER) * (NAME) +#define ELTM(NAME, MULTIPLIER, COND, EXPR) + (MULTIPLIER) * (NAME) + SSE_TERMS +#undef ELTM +#undef ELTS + ; if (debug) { - #define SEP double sum = 0; - #define ELT(NAME, MULTIPLIER, COND, EXPR) fprintf(stdout, "new %s : %f \n", #NAME, (MULTIPLIER) * (NAME)); sum += (MULTIPLIER) * (NAME); - ELT(sse_init, 1, true, sse_init) + #define ELTS(NAME, MULTIPLIER, COND, EXPR) fprintf(stdout, "new %s : %f \n", #NAME, (MULTIPLIER) * (NAME)); sum += (MULTIPLIER) * (NAME); + #define ELTM(NAME, MULTIPLIER, COND, EXPR) fprintf(stdout, "new %s : %f \n", #NAME, (MULTIPLIER) * (NAME)); sum += (MULTIPLIER) * (NAME); + ELTS(sse_init, 1, true, sse_init) SSE_TERMS fprintf(stdout, "new sum = %f \n", sum); - #undef ELT - #undef SEP + #undef ELTM + #undef ELTS } // This code matches code Bevin added to the previous good code to compare old and new runs @@ -2891,24 +2917,17 @@ double MRIScomputeSSE(MRI_SURFACE *mris, INTEGRATION_PARMS *parms) #undef ELT } -#define SEP -#define ELTM(NAME, MULTIPLIER, COND, EXPR, EXPRM) \ +#define ELTS(NAME, MULTIPLIER, COND, EXPR) ELTM(NAME, MULTIPLIER, COND, EXPR) +#define ELTM(NAME, MULTIPLIER, COND, EXPR) \ { double term = (MULTIPLIER) * (NAME); \ if (term != 0.0) { fprintf(stdout, "new %s : %f \n", #NAME, term); } \ } - -#ifdef COMPILING_MRIS_MP -#define ELT(NAME, MULTIPLIER, COND, EXPR) -#else -#define ELT(NAME, MULTIPLIER, COND, EXPR) ELTM(NAME, MULTIPLIER, NotUsed, NotUsed, NotUsed) -#endif - ELT(sse_init, 1, true, sse_init) + ELTM(sse_init, 1, true, sse_init) SSE_TERMS fprintf(stdout, "new sum = %f \n", sse); - -#undef ELT #undef ELTM -#undef SEP +#undef ELTS + } // // end of Bevin added @@ -2920,14 +2939,57 @@ double MRIScomputeSSE(MRI_SURFACE *mris, INTEGRATION_PARMS *parms) DiagBreak(); } -#undef COMPUTE_DISTANCE_ERROR - return sse; } -#undef COMPUTE_DISTANCE_ERROR -#undef SSE_TERMS +bool MRIScomputeSSE_canDo(MRIS* usedOnlyForOverloadingResolution, INTEGRATION_PARMS *parms) +{ + return true; +} + +double MRIScomputeSSE(MRIS* mris, INTEGRATION_PARMS *parms) +{ + SurfaceFromMRIS::XYZPositionConsequences::Surface surface(mris); + return MRIScomputeSSE_template(surface,mris,parms); +} + + +bool MRIScomputeSSE_canDo(MRIS_MP* usedOnlyForOverloadingResolution, INTEGRATION_PARMS *parms) +{ +#if 1 + return false; +#else + bool const use_multiframes = !!(parms->flags & IP_USE_MULTIFRAMES); + double const l_corr = (double)(parms->l_corr + parms->l_pcorr); + + bool result = true; +#define ELTS(NAME, MULTIPLIER, COND, EXPR) +#define ELTM(NAME, MULTIPLIER, COND, EXPR) \ + if (COND) { static bool reported = false; \ + if (!reported) { reported = true; fprintf(stdout, "%s:%d can't do %s %s\n", __FILE__,__LINE__,#NAME,#EXPR); } \ + result = false; \ + } + SSE_TERMS + ELTM(sse_init,1.0,gMRISexternalSSE,) +#undef ELTM +#undef ELTS + + return result; +#endif +} + + +double MRIScomputeSSE(MRIS_MP* mris_mp, INTEGRATION_PARMS *parms) +{ +#if 1 + return 0.0; +#else + SurfaceFromMRIS_MP::XYZPositionConsequences::Surface surface(mris_mp); + return MRIScomputeSSE_template(surface,mris_mp,parms); +#endif +} +#undef SSE_TERMS double MRIScomputeSSEExternal(MRIS* mris, INTEGRATION_PARMS *parms, double *ext_sse) { @@ -2948,15 +3010,14 @@ double MRIScomputeSSEExternal(MRIS* mris, INTEGRATION_PARMS *parms, double *ext_ - // Generate all the jackets // -#define MRIS_PARAMETER MRIS* mris +#define MRIS_PARAMETER MRIS* mris #define MRIS_PARAMETER_COMMA MRIS_PARAMETER , #define NOCOMMA_SELECTOR int selector #define COMMA_SELECTOR , NOCOMMA_SELECTOR #define SEP -#define ELT(NAME, SIGNATURE, CALL) double mrisCompute##NAME SIGNATURE { SseTerms sseTerms(mris,selector); return sseTerms.NAME CALL; } +#define ELT(NAME, SIGNATURE, CALL) double mrisCompute##NAME SIGNATURE { SseTerms_MRIS sseTerms(mris,selector); return sseTerms.NAME CALL; } LIST_OF_SSETERMS #undef ELT #undef SEP @@ -2965,4 +3026,16 @@ LIST_OF_SSETERMS #undef MRIS_PARAMETER_COMMA #undef MRIS_PARAMETER - +#define MRIS_PARAMETER MRIS_MP* mris +#define MRIS_PARAMETER_COMMA MRIS_PARAMETER , +#define NOCOMMA_SELECTOR int selector +#define COMMA_SELECTOR , NOCOMMA_SELECTOR +#define SEP +#define ELT(NAME, SIGNATURE, CALL) double mrisCompute##NAME SIGNATURE { SseTerms_MRIS_MP sseTerms(mris,selector); return sseTerms.NAME CALL; } +LIST_OF_SSETERMS +#undef ELT +#undef SEP +#undef COMMA_SELECTOR +#undef NOCOMMA_SELECTOR +#undef MRIS_PARAMETER_COMMA +#undef MRIS_PARAMETER diff --git a/utils/mrisurf_timeStep.cpp b/utils/mrisurf_timeStep.cpp index 895b598e775..57d5a4364ac 100644 --- a/utils/mrisurf_timeStep.cpp +++ b/utils/mrisurf_timeStep.cpp @@ -23,6 +23,9 @@ #include "mrisurf_compute_dxyz.h" #include "mrinorm.h" +#include "mrisurf_base.h" + + int (*gMRISexternalTimestep)(MRI_SURFACE *mris, INTEGRATION_PARMS *parms) = NULL; diff --git a/utils/mrisurf_topology.cpp b/utils/mrisurf_topology.cpp index 58adfd004f3..5bf0ac36f14 100644 --- a/utils/mrisurf_topology.cpp +++ b/utils/mrisurf_topology.cpp @@ -20,6 +20,8 @@ #include "mrisurf_topology.h" +#include "mrisurf_base.h" + // MRIS code dealing with the existence and connectedness of the vertices, edges, and faces // and with their partitioning into sets (ripped, marked, ...) @@ -3168,6 +3170,24 @@ int MRIS_facesAtVertices_reorder(MRIS *apmris) } +static void dumpFacesAroundVertex(MRIS* mris, int vno) +{ + using namespace SurfaceFromMRIS::Topology; + fprintf(stdout, "Dumping faces around vno:%d\n",vno); + Vertex vertex(mris,vno); + auto const numFaces = vertex.num(); + for (size_t vi = 0; vi < numFaces; vi++) { + auto face = vertex.f(vi); + fprintf(stdout, " vi:%d is face:%d with vertices",vno,face.fno()); + for (size_t vi = 0; vi < VERTICES_PER_FACE; vi++) { + auto v = face.v(vi); + fprintf(stdout, " %d",v.vno()); + } + fprintf(stdout, "\n"); + } +} + + static short FACES_aroundVertex_reorder(MRIS *apmris, int avertex, VECTOR *pv_geometricOrder) { // @@ -3243,7 +3263,15 @@ static short FACES_aroundVertex_reorder(MRIS *apmris, int avertex, VECTOR *pv_ge } VectorFree(&pv_commonVertices); xDbg_PopStack(); - if (packedCount != nfaces) + + static size_t count, limit = 1; + if (count++ == limit && getenv("BEVIN_TESTING_dumpFacesAroundVertex")) { + limit *= 2; + dumpFacesAroundVertex(apmris,avertex); + } + + if (packedCount != nfaces) { + dumpFacesAroundVertex(apmris,avertex); ErrorReturn(-4, (-4, "%s: packed / faces mismatch; vertex = %d, faces = %d, packed = %d", @@ -3251,6 +3279,7 @@ static short FACES_aroundVertex_reorder(MRIS *apmris, int avertex, VECTOR *pv_ge avertex, nfaces, packedCount)); - + } + return 1; } diff --git a/utils/mrisurf_vals.cpp b/utils/mrisurf_vals.cpp index 5c818a59b4d..7e6a119e0da 100644 --- a/utils/mrisurf_vals.cpp +++ b/utils/mrisurf_vals.cpp @@ -19,6 +19,9 @@ */ #include "mrisurf_vals.h" +#include "mrisurf_base.h" + + // Vals are scalar properties of vertexs or faces // that are independent of // diff --git a/utils_generator/Generator.cpp b/utils_generator/Generator.cpp index e69c0f58163..f37acf5e438 100644 --- a/utils_generator/Generator.cpp +++ b/utils_generator/Generator.cpp @@ -1,6 +1,39 @@ // Compile with g++ -std=c++11 Generator.cpp // Run with rm -rf tmp ; mkdir tmp ; ./a.out ./tmp/ // Merge with bcompare ./tmp ../include & +// cp tmp/* ../include +// +// Abstractly, we have +// A Surface, with various properties +// A set of vertices, with various properties +// A set of faces, with various properties +// We have several different representations of this +// The traditional MRIS struct, containing pointer to vectors of VERTEX_TOPOLOGY, VERTEX and FACE +// This is fully implemented in the Freesurfer code +// The MRIS_MP struct, which contains pointers to vectors of some of the vertices and faces properties, but not all +// and which can get some, but not all, of the other properties from an underlying MRIS struct +// This is fully implemented in the Freesurfer code, being initialized from an MRIS struct +// The MRISPV struct, which which contains pointers to vectors of all of the vertices and faces properties +// This is not yet implemented in the code +// +// For each of these representations, we want to generate a cascade of Surface,Face,Vertex accessing classes that provide +// only limited access, so we can try to restrict phases of the Surface construction and manipulation to only parts of the +// whole data structure to force the data structures to be internally consistent by restricting who can modify it, and to +// try to establish a dependency order onto the properties. +// +// To achieve this, the following code is composed of several sections +// +// Section 1: Utilities Useful classes and functions that are mostly independent of the goal +// Section 2: Abstract representation Classes etc. that describe the abstraction representation +// These are used to create a Representations - the complete list of properties etc. +// Section 3: Generator utilities Useful classes etc. that all the source generators share +// Section 4: Representation Generators One for each of the representations described above +// Section 5: Accessor Generators One for each of the representations described above +// Section 6: main Invoke some of the generators +// Section 7: Representations Define the properties, what each representation supports, what each phase can access + + +// Section 1: Utilities Useful classes and functions that are mostly independent of the goal // #include #include @@ -15,6 +48,13 @@ #include #include +static std::string uppercase(std::string const & s_init) { + using namespace std; + string s = s_init; + transform(s.begin(), s.end(), s.begin(), ::toupper); + return s; +} + static std::ostream& indent(std::ostream & os, size_t depth) { for (size_t i = 0; i < depth; i++) os << " "; return os; @@ -121,19 +161,15 @@ namespace ColumnedOutput { T::EndR endR; }; +static std::string createFilesWithin; + -namespace Generator { +// Section 2: Abstract representation Classes etc. that describe the abstraction representation +// +namespace Abstract_Representation { using namespace std; using namespace ColumnedOutput; - static string uppercase(string const & s_init) { - string s = s_init; - transform(s.begin(), s.end(), s.begin(), ::toupper); - return s; - } - - string createFilesWithin; - #define PHASES \ ELT(ExistenceM , Existence ) SEP \ ELT(Existence , end ) SEP \ @@ -178,91 +214,56 @@ namespace Generator { typedef string Id; - struct Clss; Clss* newClss(Id i); - struct Dmbr; + struct Prop; struct Fmbr; struct Type; enum CommentNature { ComGeneral, ComList, ComListSublist }; - const char* currentMrisVector = nullptr; - - struct DmbrModifiable { - const char * mrisVector; + struct PropModifiable { CommentNature commentNature; bool nohash; - string which; - Dmbr* repeatedSize; // type must be a PointerToRepeatedType type, this is the element that gives the number of repeats - DmbrModifiable() : mrisVector(currentMrisVector), commentNature(ComGeneral), nohash(false), repeatedSize(nullptr) {} + string which; + Prop* repeatedSize; // type must be a PointerToRepeatedType type, this is the element that gives the number of repeats + PropModifiable() : commentNature(ComGeneral), nohash(false), repeatedSize(nullptr) {} }; - struct Dmbr : public DmbrModifiable { - Clss* const clss; + struct Prop : public PropModifiable { + string const accessorClassId; Type* const type; Id const id; + + string key() const { + return accessorClassId+"."+id; + } + string const comment; - Phase::T const firstReadingPhase; + Phase::T const firstReadingPhase; Phase::T const firstWritingPhase; Phase::T const lastWritingPhase; - Dmbr(Clss* c, Type* t, Id i, Phase::T wb , string const & com = "") : clss(c), type(t), id(i), firstReadingPhase(wb), firstWritingPhase(wb), lastWritingPhase(wb), comment(com) {} - Dmbr(Clss* c, Type* t, Id i, Phase::T wb, Phase::T we, string const & com = "") : clss(c), type(t), id(i), firstReadingPhase(wb), firstWritingPhase(wb), lastWritingPhase(we), comment(com) {} - Dmbr(Clss* c, Type* t, Id i, Phase::T rb, Phase::T wb, Phase::T we, string const & com = "") : clss(c), type(t), id(i), firstReadingPhase(rb), firstWritingPhase(wb), lastWritingPhase(we), comment(com) {} + Prop(string const & accessorClassId, Type* t, Id i, Phase::T wb, string const & com = "" ) : accessorClassId(accessorClassId), type(t), id(i), firstReadingPhase(wb), firstWritingPhase(wb), lastWritingPhase(wb), comment(com) {} + Prop(string const & accessorClassId, Type* t, Id i, Phase::T wb, Phase::T we, string const & com = "" ) : accessorClassId(accessorClassId), type(t), id(i), firstReadingPhase(wb), firstWritingPhase(wb), lastWritingPhase(we), comment(com) {} + Prop(string const & accessorClassId, Type* t, Id i, Phase::T rb, Phase::T wb, Phase::T we, string const & com = "") : accessorClassId(accessorClassId), type(t), id(i), firstReadingPhase(rb), firstWritingPhase(wb), lastWritingPhase(we), comment(com) {} - bool isGeneralComment() const { return !type && commentNature==ComGeneral; } - - Dmbr* setCommentNature(CommentNature to) { commentNature = to; return this; } - Dmbr* setNoHash() { nohash = true; return this; } - Dmbr* setPRSize(Dmbr* to) { repeatedSize = to; return this; } - Dmbr* setWhich(string const & to) { which = to; return this; } - }; + bool isGeneralComment() const { return !type && commentNature == ComGeneral; } - struct Fmbr { - Clss* const clss; - Type* const retType; - Id const id; - Clss* const args; - bool const isWriter; - Fmbr(Clss* c, Type* rt, Id i, Phase::T w, bool isWriter = false) : clss(c), retType(retType), id(i), args(newClss("")), isWriter(isWriter) {} + Prop* setCommentNature(CommentNature to) { commentNature = to; return this; } + Prop* setNoHash() { nohash = true; return this; } + Prop* setPRSize(Prop* to) { repeatedSize = to; return this; } + Prop* setWhich(string const & to) { which = to; return this; } }; Phase::T phaseRbegin = Phase::end; Phase::T phaseWbegin = Phase::end; Phase::T phaseWend = Phase::end; - struct Clss { - Clss(Id i) : id(i) {} - - Id const id; - map dmbrMap; - vector dmbr; - vector fmbr; - - Dmbr* addDmbrCom(string const & com) { return addDmbr(nullptr, "", Phase::end, Phase::end, Phase::end, com); } - Dmbr* addDmbrList(string const & com) { return addDmbrCom(com)->setCommentNature(ComList); } - Dmbr* addDmbrListSublist(string const & com) { return addDmbrCom(com)->setCommentNature(ComListSublist); } - Dmbr* addDmbr(Type* t, Id i, string const & com = "") { return addDmbr(t, i, phaseRbegin, phaseWbegin, phaseWend, com); } - Dmbr* addDmbr(Type* t, Id i, Phase::T rb, Phase::T wb, Phase::T we, string const & com = "") { - if (rb == Phase::end && wb != Phase::end) rb = wb; - auto res = new Dmbr(this, t, i, rb, wb, we, com); - dmbr.push_back(res); - dmbrMap.insert(make_pair(id,res)); - return res; - } - - Dmbr* findDmbr(Id i) { - auto it = dmbrMap.find(i); - return (it == dmbrMap.end()) ? nullptr : it->second; - } - - }; Clss* newClss(Id i) { return new Clss(i); } - - struct AtomicType; struct PointerType; struct ArrayOfPointerType; struct PointerToRepeatedType; + struct AtomicType; struct PointerType; struct ArrayOfPointerType; struct PointerToRepeatedAtomicType; struct Type { Id const id; Type(Id i) : id(i) {} - virtual AtomicType* toAtomicType () { return nullptr; } + virtual AtomicType* toAtomicType() { return nullptr; } virtual PointerType* toPointerType() { return nullptr; } virtual ArrayOfPointerType* toArrayOfPointerType() { return nullptr; } - virtual PointerToRepeatedType* toPointerToRepeatedType() { return nullptr; } + virtual PointerToRepeatedAtomicType* toPointerToRepeatedType() { return nullptr; } }; struct AtomicType : public Type { @@ -280,95 +281,333 @@ namespace Generator { virtual ArrayOfPointerType* toArrayOfPointerType() { return this; } ArrayOfPointerType(Id i) : Type(i) {} }; - - struct PointerToRepeatedType : public PointerType { - virtual PointerToRepeatedType* toPointerToRepeatedType() { return this; } - PointerToRepeatedType(Id i, AtomicType* at) : PointerType(i, at) {} + + struct PointerToRepeatedAtomicType : public PointerType { + virtual PointerToRepeatedAtomicType* toPointerToRepeatedType() { return this; } + PointerToRepeatedAtomicType(Id i, AtomicType* at) : PointerType(i, at) {} }; - typedef vector Built; - static Built build(); + struct Representation; - struct Generate_Base { - ostream & tos() { return *os.back(); } - Built const & built; - size_t depth; - ostream& indent() { - return ::indent(tos(),depth); + int numericPrecision(string const & t) { + if (t == "char" || t == "uchar") return 0; + if (t == "short") return 1; + if (t == "int") return 2; + if (t == "float") return 3; + if (t == "size_t") return 4; + return -1; + } + bool cvtNeededToFrom(string const & to, string const & from) { + if (from == to) return false; + auto from_prec = numericPrecision(from); + auto to_prec = numericPrecision(to); + if (from_prec < 0 || to_prec < 0) return true; + return from_prec > to_prec; + } + + struct How { + virtual ~How() {} + virtual bool isImplDetail () const = 0; + virtual string secondaryName() const = 0; + virtual string reprNoArrow () const = 0; + virtual string memberType (Prop const & prop) const = 0; + virtual string memberId (Prop const & prop) const = 0; + virtual string storeType (Prop const & prop) const = 0; + virtual string storeId (Prop const & prop) const = 0; + virtual string retType (Prop const & prop) const = 0; + virtual string getId (Prop const & prop) const = 0; + virtual string getArgs (Prop const & prop) const = 0; + virtual string setId (Prop const & prop) const = 0; + virtual string indexArg (Prop const & prop) const = 0; + virtual string setToArg (Prop const & prop) const = 0; + virtual string getSetExpr (string const & reprNoArrow, Prop const & prop, bool write) const = 0; + }; + + struct HowRedirect : public How { + How& to; + HowRedirect(How * to) : to(*to) {} + HowRedirect(How & to) : to( to) {} + virtual bool isImplDetail () const { return to.isImplDetail (); } + virtual string secondaryName() const { return to.secondaryName(); } + virtual string reprNoArrow () const { return to.reprNoArrow (); } + virtual string memberType (Prop const & prop) const { return to.memberType(prop); } + virtual string memberId (Prop const & prop) const { return to.memberId (prop); } + virtual string storeType (Prop const & prop) const { return to.storeType (prop); } + virtual string storeId (Prop const & prop) const { return to.storeId (prop); } + virtual string retType (Prop const & prop) const { return to.retType (prop); } + virtual string getId (Prop const & prop) const { return to.getId (prop); } + virtual string getArgs (Prop const & prop) const { return to.getArgs (prop); } + virtual string setId (Prop const & prop) const { return to.setId (prop); } + virtual string indexArg (Prop const & prop) const { return to.indexArg (prop); } + virtual string setToArg (Prop const & prop) const { return to.setToArg (prop); } + virtual string getSetExpr (string const & reprNoArrow, Prop const & prop, bool write) const { return to.getSetExpr(reprNoArrow, prop, write); } + }; + + struct HowDirect : public How { + virtual bool isImplDetail() const { return m_isImplDetail; } + virtual string secondaryName() const { return m_secondaryName; } + bool m_isImplDetail; + string m_secondaryName; // if not "", then one FACE, VERTEX, etc. showing this property has been placed into some composite child vector + // maybe this should be the prop of the parent's child vector? + + HowDirect() : m_isImplDetail(false) {} + virtual ~HowDirect() {} + + virtual string reprNoArrow() const { + return "repr"; + } + + virtual string memberType(Prop const & prop) const { // the type of the field in the classId + return prop.type->id; + } + + virtual string memberId(Prop const & prop) const { // the id of field in the classId + return prop.id; // it might need to be indexed by [idx] + } + + virtual string storeType(Prop const & prop) const { + return memberType(prop); + } + virtual string storeId(Prop const & prop) const { + return memberId(prop); } + virtual string retType(Prop const & prop) const { + return prop.type->id; + } + virtual string getId(Prop const & prop) const { + return prop.id; + } + virtual string getArgs(Prop const & prop) const { + return ""; + } + virtual string setId(Prop const & prop) const { + return "set_" + prop.id; + } + virtual string indexArg(Prop const & prop) const { + if (!prop.type->toPointerToRepeatedType()) return ""; + return "size_t i"; + } + virtual string setToArg(Prop const & prop) const { + string s = retType(prop) + " to"; + return s; + } + + virtual string getSetExpr(string const & reprNoArrow, Prop const & prop, bool write) const { + // generate the string needed to fetch or store the value as a retType + // convert between the retType and the storeType + // the input value for a store is in "retType const & to" + // + auto st = storeType(prop); + auto rt = retType(prop); + + string storeName = reprNoArrow + "->" + storeId(prop); + if (indexArg(prop).size()) { + storeName += "[i]"; + if (auto pt = prop.type->toPointerToRepeatedType()) { + st = pt->target->id; + } + } + string fetchName = (write ? "to" : storeName); + + if (rt == "Vertex" || rt == "Face") { + if (!write) { + fetchName = rt + "(repr," + storeName + ")"; + st = rt; + } + } + + if (cvtNeededToFrom(write?st:rt,write?rt:st)) { + if (!write) fetchName = rt + "("+storeName+")"; + else fetchName = st + "(to)"; + } + return write ? (storeName + " = " + fetchName) : (fetchName); + } + + }; + + struct Representation { + struct PropHow { + Prop* const prop; + How* const how; + PropHow() : prop(nullptr), how(nullptr) {} + PropHow(Prop* prop, How* how) : prop(prop), how(how) {} + }; + std::vector implements; + string const reprClassName; + const char* const rootHeaderFile; + Representation(const char* rootHeaderFile, string const & surfaceClassName) : rootHeaderFile(rootHeaderFile), reprClassName(surfaceClassName) {} + }; + + template + void walkClasses( + Representation & representation, + Callable0 propHowToClassId, + Callable1 initClass, + Callable2 nextMember, + Callable3 finiClass) { + + set classNames; + for (auto & propHow : representation.implements) { + if (!propHow.how) continue; + classNames.insert(propHowToClassId(propHow)); + } + + auto walkClass = [&](bool primaryClass, string classId, string key) + { + auto keyIter = classNames.find(key); + if (keyIter == classNames.end()) return; + classNames.erase(keyIter); + + if (!classId.size()) classId = key; + initClass(classId); + + for (int write = 0; write < 2; write++) { + for (auto & propHow : representation.implements) { + auto propClassId = propHowToClassId(propHow); + if (propClassId != key) continue; + auto & prop = *propHow.prop; + auto how = propHow.how; + nextMember(prop, how, write == 1); + } + } + + finiClass(classId); + }; + + // the order here matches old code + + walkClass(false, "", "face_type_"); + walkClass(false, "", "VERTEX_TOPOLOGY"); + walkClass(false, "", "vertex_type_"); + + walkClass(false, "", "Face"); + walkClass(false, "", "Vertex"); + + walkClass(true, representation.reprClassName, ""); + + while (!classNames.empty()) { + auto className = *classNames.begin(); + walkClass(false, className, className); + } + } +} + + +// Section 3: Generator utilities Useful classes etc. that all the source generators share. +// +namespace Generator_Utilities { + using namespace std; + using namespace ColumnedOutput; + using namespace Abstract_Representation; + + struct Generate_Base { + Representation & representation; + Generate_Base( - ostream & init_os, - Built const & built) : os(), built(built), depth(0) { + ostream & init_os, + Representation & representation) : os(), representation(representation), depth(0) { os.push_back(&init_os); tos() << endl; + indent() << "#pragma once" << endl; indent() << "// GENERATED SOURCE - DO NOT DIRECTLY EDIT" << endl; indent() << "// " << endl; indent() << "// =======================================" << endl; + indent() << "#include \"mrisurf_aaa.h\"" << endl; } + + // A stack of output files so we can spread the generated code + // across several files for readability + // + ostream & tos() { return *os.back(); } void os_push(ostream * new_tos) { os.push_back(new_tos); } void os_pop() { os.pop_back(); } - private: - vector os; - }; - - // Generate the various representations - // - struct IsImplementedSupplier { - // Representations may only supply some of the properties - virtual bool isImplemented(Clss const & c, Dmbr const & d) { return true; } - }; - struct Generate_mris : public Generate_Base { - void generateClass(Clss & c) { - bool const isVertex = (c.id == "Vertex"); + // Support indented output to the top output file + // + size_t depth; + ostream& indent() { + return ::indent(tos(), depth); + } - for (int pass = 0; pass < (isVertex ? 2 : 1); pass++) { - bool isInVertexTopology = false; - bool doingVertexTopology = (pass == 0); + private: + list os; // stack of output files + }; +} - string traditional_className = c.id; - if (isVertex && pass == 0) traditional_className = "VERTEX_TOPOLOGY"; - if (traditional_className == "Surface") traditional_className = "MRIS"; - if (traditional_className == "Face") traditional_className = "face_type_"; - if (traditional_className == "Vertex") traditional_className = "vertex_type_"; - indent() << "struct " - << traditional_className - << " {" << endl; - depth++; +// Section 4: Representation Generators One for each of the representations described above +// +namespace Representation_Generators { + using namespace std; + using namespace ColumnedOutput; + using namespace Abstract_Representation; + using namespace Generator_Utilities; - ColumnedOutput::T cols; + struct Generate_Representation : public Generate_Base { + Generate_Representation( + ostream & os, + Representation & representation) : Generate_Base(os, representation) {} + virtual void generateRepresentationClasses() = 0; + }; - for (auto & d : c.dmbr) { + struct Generate_usingHow : public Generate_Representation { - if (d->commentNature == ComList) - isInVertexTopology = d->comment == "LIST_OF_VERTEX_TOPOLOGY_ELTS"; - if (isVertex && (doingVertexTopology != isInVertexTopology)) continue; + Generate_usingHow( + ostream & os, + Representation & representation) : Generate_Representation(os, representation) + { + if (representation.reprClassName == "MRIS") indent() << "#define SEPARATE_VERTEX_TOPOLOGY" << endl; + generateRepresentationClasses(); + generateMacros(); + } - if (!d->type && d->commentNature != ComGeneral) continue; + void generateRepresentationClasses() + { + ColumnedOutput::T* colsPtr; + + walkClasses(representation, + [&](Representation::PropHow const & propHow) { + return propHow.how ? propHow.how->secondaryName() : representation.reprClassName; + }, + [&](string const & classId) { + indent() << "struct " + << classId + << " {" << endl; + depth++; + colsPtr = new ColumnedOutput::T; + }, + [&](Prop& prop, How* how, bool write) { + if (write || !how) return; + if (!prop.type && prop.commentNature != ComGeneral) return; + + auto & cols = *colsPtr; const char * comment = "//"; - if (d->type) { - cols << d->type->id << endC << Just_left << d->id << endC << ";"; + if (prop.type) { + auto memberType = how->memberType(prop); + cols << memberType << endC << Just_left << how->memberId(prop) << endC << ";"; comment = " //"; - if (d->repeatedSize) { - cols << ignoreWidth << comment << " size() is " << d->repeatedSize->id; + if (prop.repeatedSize) { + cols << ignoreWidth << comment << " size() is " << prop.repeatedSize->id; comment = ". "; } } - if (d->comment.size()) cols << ignoreWidth << comment << " " << d->comment; + if (prop.comment.size()) cols << ignoreWidth << comment << " " << prop.comment; cols << endR; + }, + [&](string const & classId) { + colsPtr->append(tos(), depth); + delete colsPtr; colsPtr = nullptr; + depth--; + indent() << "}; // " << classId << endl << endl; } - cols.append(tos(), depth); - - depth--; - indent() << "}; // " << traditional_className << endl << endl; - } + ); } - void generateMacros(Clss & c) { + void generateMacros() { + if (representation.reprClassName != "MRIS") return; - bool eltEmitted = false; + bool eltEmitted = false; bool endlPending = false; bool endMPending = false; auto emitEndOfMacroIfNeeded = [&] { @@ -379,439 +618,246 @@ namespace Generator { if (endMPending) indent() << "// end of macro" << endl << endl; endMPending = false; }; - bool isVertexTopology = false; + string secondaryName; - for (auto & d : c.dmbr) { - - if (d->isGeneralComment()) continue; + for (auto & propHow : representation.implements) { + auto & prop = *propHow.prop; + auto & how = *propHow.how; + if (secondaryName != how.secondaryName()) { + secondaryName = how.secondaryName(); + emitEndOfMacroIfNeeded(); + } + if (prop.isGeneralComment()) continue; - if (eltEmitted ) { tos() << " SEP"; eltEmitted = false; } + if (eltEmitted) { tos() << " SEP"; eltEmitted = false; } if (endlPending) { tos() << " \\" << endl; endlPending = false; } - if (!d->type) { - switch (d->commentNature) { + if (!prop.type) { + switch (prop.commentNature) { case ComList: emitEndOfMacroIfNeeded(); - indent() << "#define " << d->comment << " \\" << endl; eltEmitted = false; endlPending = false; endMPending = true; + indent() << "#define " << prop.comment << " \\" << endl; eltEmitted = false; endlPending = false; endMPending = true; depth++; break; case ComListSublist: - indent() << d->comment; eltEmitted = true; endlPending = true; + indent() << prop.comment; eltEmitted = true; endlPending = true; break; } - } else if (endMPending) { - const char* macro = (d->nohash) ? "ELTX" : "ELTT"; - auto t = d->type; + } + else if (endMPending) { + const char* macro = (prop.nohash) ? "ELTX" : "ELTT"; + auto t = prop.type; if (auto tp = t->toPointerType()) { macro = "ELTP"; t = tp->target; } - indent() << macro << "(" << t->id << "," << d->id << ") "; eltEmitted = true; endlPending = true; + indent() << macro << "(" << t->id << "," << prop.id << ") "; eltEmitted = true; endlPending = true; } } emitEndOfMacroIfNeeded(); } - Generate_mris( - ostream & os, - Built const & built) : Generate_Base(os, built) - { - indent() << "#define SEPARATE_VERTEX_TOPOLOGY" << endl; - for (auto & cp : built) generateClass(*cp); - for (auto & cp : built) generateMacros(*cp); - } - }; - - - struct Mrispv_implemented_properties : public IsImplementedSupplier { - set implemented_names; - Mrispv_implemented_properties() { - static const char* implemented_properties[] = { - // in for the metric properties calculations - "status", - "origxyz_status", - "nvertices", "vertices", - "nfaces", "faces", - "nsize", - "radius", - // in out for the metric properties calculations - "dist_nsize", - // out for the metric properties calculations - "xlo", - "xhi", - "ylo", - "yhi", - "zlo", - "zhi", - "xctr", - "yctr", - "zctr", - "total_area", - "avg_vertex_area", - "avg_vertex_dist", - "std_vertex_dist", - "neg_orig_area", - "neg_area", - // in for the metric properties calculations - "v_ripflag", - "v_num", - "v_f", - // in out for the metric properties calculations - "v_dist_capacity", - "v_border", - "v_x", - "v_y", - "v_z", - "v_origarea", - // out for the metric properties calculations - "v_area", - "v_nx", - "v_ny", - "v_nz", - "v_neg", - "v_dist", - // in for the metric properties calculations - "f_ripflag", - "f_v", - "f_norm_orig_area", - // in out for the metric properties calculations - // out for the metric properties calculations - "f_area", - "f_normSet", - "f_norm", - "f_angle", - nullptr }; - - for (auto i = implemented_properties; *i; i++) { - implemented_names.insert(*i); - } - - // "v_VSize", - // ELT(const, VERTEX_TOPOLOGY const *, vertices_topology) \ - // ELTX(const, FACE_TOPOLOGY const *, faces_topology) - } - - struct ImplementedProperty { - bool isImplemented, isVector; - string name; - }; - - ImplementedProperty property(Clss const & c, Dmbr const & d) { - string vectorPrefix; - if (c.id == "Vertex") vectorPrefix = "v_"; else - if (c.id == "Face") vectorPrefix = "f_"; else - if (c.id == "Surface") vectorPrefix = ""; else - assert(false); - - ImplementedProperty ip; - ip.isImplemented = false; - ip.isVector = vectorPrefix.size() > 0; - ip.name = vectorPrefix + d.id; - - ip.isImplemented = (implemented_names.find(ip.name) != implemented_names.end()); - - return ip; - } - - virtual bool isImplemented(Clss const & c, Dmbr const & d) { - return property(c, d).isImplemented; - } - } mrispv_implemented_properties; - - - struct Generate_mrispv : public Generate_Base { - - void generateClass(Clss & c) { - ColumnedOutput::T cols; - - for (auto & d : c.dmbr) { - - if (!d->type && d->commentNature != ComGeneral) continue; - - const char * comment = "//"; - if (d->type) { - - auto property = mrispv_implemented_properties.property(c, *d); - if (!property.isImplemented) continue; - - cols << d->type->id << endC; - if (property.isVector) cols << "*" << endC; - cols << Just_left << property.name << endC << ";"; - comment = " //"; - if (d->repeatedSize) { - cols << ignoreWidth << comment << " size() is " << d->repeatedSize->id; - comment = ". "; - } - } - - if (d->comment.size()) cols << ignoreWidth << comment << " " << d->comment; - cols << endR; - } - - cols.append(tos(), depth); - } - - void generateMacros(Clss & c) { - } - - Generate_mrispv( - ostream & os, - Built const & built) : Generate_Base(os, built) - { + }; +} - indent() << "struct MRISPV {" << endl; - depth++; - for (auto & cp : built) generateClass(*cp); - depth--; - indent() << "};" << endl; - for (auto & cp : built) generateMacros(*cp); - } - }; +// Section 5: Accessor Generators One for each of the representations described above +// +namespace Accessor_Generators { + using namespace std; + using namespace ColumnedOutput; + using namespace Abstract_Representation; + using namespace Generator_Utilities; + using namespace Representation_Generators; - // Generating the various Surface Vector Face accessors - // struct Generate_abstract_spec_Base; struct Generate_abstract_inco_Base; - struct Generate_SurfaceFromMRIS_inco; - struct Generate_SurfaceFromMRIS_spec; - struct Generate_SurfaceFromMRIS_impl; - - struct Generate_SurfaceFromMRISPV_inco; - struct Generate_SurfaceFromMRISPV_spec; - struct Generate_SurfaceFromMRISPV_impl; + struct Generate_Surface_inco; + struct Generate_Surface_spec; + struct Generate_Surface_impl; - struct Generate_abstract_Base : public Generate_Base { + struct Generate_Accessor : public Generate_Base { - std::string absolutePns(Phase::T p) { - return "SurfaceFromMRIS_" + Phase::namespaceName(p); + std::string absolutePhaseNamespace(Phase::T p) { + return "SurfaceFrom" + representation.reprClassName + "_" + Phase::namespaceName(p); } virtual Generate_abstract_spec_Base* toGenerate_abstract_spec_Base () { return nullptr; } virtual Generate_abstract_inco_Base* toGenerate_abstract_inco_Base () { return nullptr; } - virtual Generate_SurfaceFromMRIS_spec* toGenerate_SurfaceFromMRIS_spec () { return nullptr; } - virtual Generate_SurfaceFromMRIS_impl* toGenerate_SurfaceFromMRIS_impl () { return nullptr; } - virtual Generate_SurfaceFromMRIS_inco* toGenerate_SurfaceFromMRIS_inco () { return nullptr; } - - virtual Generate_SurfaceFromMRISPV_spec* toGenerate_SurfaceFromMRISPV_spec() { return nullptr; } - virtual Generate_SurfaceFromMRISPV_impl* toGenerate_SurfaceFromMRISPV_impl() { return nullptr; } - virtual Generate_SurfaceFromMRISPV_inco* toGenerate_SurfaceFromMRISPV_inco() { return nullptr; } - - virtual string classPrefix(Clss & c) = 0; - virtual void beginClass (Phase::T p, Clss & c) = 0; - virtual void endClass (Phase::T p, Clss & c) = 0; - - struct IsImplemented { - IsImplementedSupplier* supplier; - IsImplemented() : supplier(nullptr) {} - } isImplementedSupplier; - bool isImplemented(Clss const & c, Dmbr const & d) const { - return isImplementedSupplier.supplier->isImplemented(c, d); - } - - string baseClass(Phase::T p, Clss& c) { -#if 1 - return "Repr_Elt"; -#else - string result; - auto const enhances = Phase::enhances[p]; - if (enhances == Phase::end) { - result = "Repr_Elt"; - } - else { - result = Phase::namespaceName(enhances); - result += "::"; - result += c.id; - } - return result; -#endif - } - - Id retTypeId(Clss const & c, Dmbr const & d) { - auto t = d.type; - auto tr = t->toPointerToRepeatedType(); + virtual Generate_Surface_spec* toGenerate_SurfaceFromMRIS_spec () { return nullptr; } + virtual Generate_Surface_impl* toGenerate_SurfaceFromMRIS_impl () { return nullptr; } + virtual Generate_Surface_inco* toGenerate_SurfaceFromMRIS_inco () { return nullptr; } - if (c.id == "Vertex") { - if (d.id == "f") return "Face"; - if (d.id == "n") return "size_t"; - if (d.id == "v") return "Vertex"; + virtual string classMemberPrefix(string const & classId) = 0; + virtual void beginClass (Phase::T p, string const & classId) = 0; + virtual void endClass (Phase::T p, string const & classId) = 0; - } else if (c.id == "Face") { - if (d.id == "v") return "Vertex"; - - } else if (c.id == "Surface") { - if (d.id == "vertices") return "Vertex"; - if (d.id == "faces") return "Face"; - } - - if (tr) return tr->target->id; - - if (t->id == "PVERTEX") return "Vertex"; - if (t->id == "PFACE") return "Face"; - - return t->id; - } - - virtual void generateClass(Phase::T p, Clss & c) { - beginClass(p, c); + virtual void generateAccessorClasses(Phase::T p) + { + string currClassId; + bool writeCommented; + ColumnedOutput::T* colsPtr = nullptr; + vector deferredComGeneral; + string classNameDotDot; + bool writers; + + auto maybeEndC = [&](bool needsSep = true) { + auto & cols = *colsPtr; + if (toGenerate_abstract_spec_Base()) cols << endC; + else if (needsSep) cols << " "; + }; - for (int w = 0; w < 2; w++) { - auto const write = (w==1); - - bool writeCommented = false; + auto maybeJust = [&](Justify j) { + return toGenerate_abstract_spec_Base() ? j : Just_none; + }; - ColumnedOutput::T cols; { + walkClasses(representation, + [&](Representation::PropHow const & propHow) { + return propHow.prop->accessorClassId; + }, + [&](string const & classId) { + beginClass(p, classId); + currClassId = classId; + writeCommented = false; + colsPtr = new ColumnedOutput::T; + deferredComGeneral.clear(); + classNameDotDot = classMemberPrefix(classId); + writers = false; + }, + [&](Prop& prop, How* how, bool write) { typedef void os; typedef void indent; + auto & cols = *colsPtr; - auto maybeEndC = [&](bool needsSep = true) { - if (toGenerate_abstract_spec_Base()) cols << endC; - else if (needsSep) cols << " "; - }; - - auto maybeJust = [&](Justify j) { - return toGenerate_abstract_spec_Base() ? j : Just_none; - }; - - vector deferredComGeneral; - - for (auto & dp : c.dmbr) { - auto const & d = *dp; + if (currClassId == "Vertex" && !writers && write) { + auto & cols = *colsPtr; + if (toGenerate_abstract_spec_Base()) + cols << "inline "; + else + cols << ignoreWidth; + cols << "void"; + maybeEndC(); + cols << classMemberPrefix(currClassId) << maybeJust(Just_left) << "which_coords"; + maybeEndC(false); + cols << ignoreWidth + << "(int which, float *x, float *y, float *z) const"; + maybeEndC(); + generate_which_coords(p, currClassId, cols, false); + cols << endR; + } + writers = write; - if (d.isGeneralComment()) { - if (toGenerate_abstract_spec_Base()) { - deferredComGeneral.push_back(dp); - } - continue; + if (prop.isGeneralComment()) { + if (toGenerate_abstract_spec_Base()) { + deferredComGeneral.push_back(&prop); } + return; + } - if (c.id == "Surface" && d.id == "vertices") bpt(); - - if (!d.type) continue; + if (!prop.type) return; + if (!how) return; + if (how->isImplDetail()) return; - if (!isImplemented(c, d)) continue; + bool canRead = (prop.firstReadingPhase <= p); + bool canWrite = (prop.firstWritingPhase <= p && p <= prop.lastWritingPhase); + if (p == Phase::AllM) canWrite = (prop.firstWritingPhase != Phase::end); - bool canRead = (d.firstReadingPhase <= p); - bool canWrite = (d.firstWritingPhase <= p && p <= d.lastWritingPhase); - if (p == Phase::AllM) canWrite = (d.firstWritingPhase != Phase::end); - - if ((!write && !canRead) - || ( write && !canWrite) - ) { + if ((!write && !canRead) + || (write && !canWrite) + ) { - // Throw away general comments that precede variables that are thrown away. - // - deferredComGeneral.clear(); + // Throw away general comments that precede variables that are thrown away. + // + deferredComGeneral.clear(); - // Skip this one - continue; - } + // Skip this one + return; + } - if (c.id == "Surface") { - if (d.id == "vertices_topology") continue; - } - - for (auto deferred : deferredComGeneral) { - cols << ignoreWidth << "// " << deferred->comment << endR; - } - deferredComGeneral.clear(); + for (auto deferred : deferredComGeneral) { + cols << ignoreWidth << "// " << deferred->comment << endR; + } + deferredComGeneral.clear(); - if (write && !writeCommented) { - writeCommented = true; cols << endR << "" << endR; - } + if (write && !writeCommented) { + writeCommented = true; cols << endR << "" << endR; + } - auto t = d.type; - auto tr = t->toPointerToRepeatedType(); - auto rti = retTypeId(c, d); + if (toGenerate_abstract_spec_Base()) + cols << "inline "; + else + cols << ignoreWidth; - if (toGenerate_abstract_spec_Base()) - cols << "inline "; - else - cols << ignoreWidth; + string fname = how->getId(prop);; + if (write) { + fname = how->setId(prop); + cols << "void"; + } else { + cols << how->retType(prop); + } + maybeEndC(); + + cols << classNameDotDot << maybeJust(Just_left) << fname; + maybeEndC(false); + + cols << "("; + maybeEndC(false); + auto s = how->indexArg(prop); + if (s.size()) { + cols << s; + } + bool hasSep = false; + if (write && s.size()) { + cols << ","; + hasSep = true; + } + maybeEndC(write && hasSep); + if (write) cols << maybeJust(Just_right) << how->setToArg(prop); + maybeEndC(false); + cols << ")"; + if (!write) cols << " const"; + maybeEndC(); + + generateBeforeComment(cols, prop, write); - string fname = d.id; - if (write) { - cols << "void"; - fname = "set_" + d.id; - } else { - cols << rti; - } - maybeEndC(); - cols << classPrefix(c) << maybeJust(Just_left) << fname; - maybeEndC(false); - - cols << "("; - maybeEndC(false); - bool needsSep = false; - bool indexingAVector = (c.id=="Face" && d.id=="v"); - if (t->toPointerToRepeatedType() || indexingAVector) { - cols << "size_t i"; - needsSep = true; - } - if (write && (tr || indexingAVector)) { - cols << ","; - needsSep = true; - } - maybeEndC(write && needsSep); - if (write) cols << maybeJust(Just_right) << rti << " to"; - maybeEndC(false); - cols << ")"; - if (!write) cols << " const"; - maybeEndC(); - generateBeforeComment(cols,d,write); - - const char* comment = " //"; - if (tr && d.repeatedSize) { - cols << comment << " size() is " << d.repeatedSize->id; - comment = ". "; - } - if (d.comment.size()) cols << comment << " " << d.comment; - cols << endR; - generateMoreLines(cols,c,d,write); + const char* comment = " //"; + if (prop.repeatedSize) { + cols << comment << " size() is " << prop.repeatedSize->id; + comment = ". "; } - if (!write && c.id == "Vertex") { - if (toGenerate_abstract_spec_Base()) - cols << "inline "; - else - cols << ignoreWidth; - cols << "void"; - maybeEndC(); - cols << classPrefix(c) << maybeJust(Just_left) << "which_coords"; - maybeEndC(false); - cols << ignoreWidth - << "(int which, float *x, float *y, float *z) const"; - maybeEndC(); - generate_which_coords(p, c, cols, write); - cols << endR; - } - } cols.append(tos(),depth); - } - endClass(p, c); + if (prop.comment.size()) cols << comment << " " << prop.comment; + cols << endR; + + generateMoreLines(cols, currClassId, prop, *how, write); + }, + + [&](string const & classId) { + colsPtr->append(tos(), depth); + endClass(p, classId); + delete colsPtr; colsPtr = nullptr; + }); } virtual void generateBeforeComment(ColumnedOutput::T& cols, bool const write) { cols << ";"; } - virtual void generateBeforeComment(ColumnedOutput::T& cols, Dmbr const & d, bool const write) { + virtual void generateBeforeComment(ColumnedOutput::T& cols, Prop const & d, bool const write) { generateBeforeComment(cols, write); } - virtual void generateMoreLines(ColumnedOutput::T& cols, Clss const & c, Dmbr const & d, bool const write) { + virtual void generateMoreLines(ColumnedOutput::T& cols, string const & classId, Prop const & prop, How const & how, bool const write) { } - virtual void generate_which_coords(Phase::T p, Clss & c, ColumnedOutput::T& cols, bool const write) { + virtual void generate_which_coords(Phase::T p, string const & classId, ColumnedOutput::T& cols, bool const write) { generateBeforeComment(cols, write); } - virtual void generateNamespaceMacros(Phase::T p) { - } - - void generateNamespace(string const & parent, string const & name, string const & representation) { + void generateNamespace(string const & parent, string const & name, Representation & representation) { indent() << "namespace " << name << " {" << endl; depth++; - indent() << "typedef " << representation << " Representation;" << endl; + indent() << "typedef " << representation.reprClassName << " Representation;" << endl; for (int doModifiers = 0; doModifiers < 2; doModifiers++) { for (auto p = Phase::T(); p < Phase::end; p = Phase::T(p + 1)) { @@ -831,8 +877,7 @@ namespace Generator { } indent() << "namespace " << pns << " {" << endl; - generateNamespaceMacros(p); - for (auto & cp : built) generateClass(p, *cp); + generateAccessorClasses(p); indent() << "} // namespace " << pns << endl; if (child_os) { @@ -857,9 +902,12 @@ namespace Generator { indent() << "Repr_Elt(Repr_Elt const & src) : repr(src.repr), idx(src.idx) {}" << endl; tos() << endl; for (auto p = Phase::T(); p < Phase::end; p = Phase::T(p + 1)) { - for (auto & cp : built) { - indent() << "friend struct " << name << "::" << Phase::namespaceName(p) << "::" << cp->id << ";" << endl; - } + auto isFriend = [&](string const & classId) { + indent() << "friend struct " << name << "::" << Phase::namespaceName(p) << "::" << classId << ";" << endl; + }; + isFriend("Face"); + isFriend("Vertex"); + isFriend("Surface"); } depth--; indent() << "};" << endl; @@ -869,513 +917,591 @@ namespace Generator { indent() << "} // " << name << endl; } - Generate_abstract_Base(ostream & os, Built const & built) : Generate_Base(os, built) + Generate_Accessor(ostream & os, Representation & representation) : Generate_Base(os, representation) { } }; - struct Generate_abstract_inco_Base : public Generate_abstract_Base { + struct Generate_abstract_inco_Base : public Generate_Accessor { virtual Generate_abstract_inco_Base* toGenerate_abstract_inco_Base () { return this; } Generate_abstract_inco_Base( ostream & os, string const & parent, - Built const & built) : Generate_abstract_Base(os, built) + Representation & representation) : Generate_Accessor(os, representation) { } - virtual void generateNamespaceMacros(Phase::T p) { + virtual string classMemberPrefix(string const & classId) { return ""; } + virtual void beginClass(Phase::T p, string const & classId) {} + virtual void endClass (Phase::T p, string const & classId) {} + + virtual void generateAccessorClasses(Phase::T p) { + walkClasses(representation, + [&](Representation::PropHow const & propHow) { return propHow.prop->accessorClassId; }, + [&](string const & classId) { + depth++; + indent() << "struct " << classId << ";" << endl; + depth--; }, + [&](Prop& prop, How* how, bool write) {}, + [&](string const & classId) {}); } - virtual string classPrefix(Clss & c) { return ""; } - virtual void beginClass(Phase::T p, Clss & c) {} - virtual void endClass(Phase::T p, Clss & c) {} - - virtual void generateClass(Phase::T p, Clss & c) { - depth++; - indent() << "struct " << c.id << ";" << endl; - depth--; - } }; - struct Generate_abstract_spec_Base : public Generate_abstract_Base { + struct Generate_abstract_spec_Base : public Generate_Accessor { virtual Generate_abstract_spec_Base* toGenerate_abstract_spec_Base() { return this; } Generate_abstract_spec_Base( ostream & os, string const & parent, - Built const & built) : Generate_abstract_Base(os, built) + Representation & representation) : Generate_Accessor(os, representation) { } - virtual string classPrefix(Clss & c) { + virtual string classMemberPrefix(string const & classId) { return ""; } - virtual void beginClass(Phase::T p, Clss & c) { - bool isSurface = (c.id == "Surface"); + virtual void beginClass(Phase::T p, string const & classId) { + auto const phaseNamespaceId = Phase::namespaceName(p); + bool isSurface = (classId == "Surface"); - indent() << "struct " << c.id << " : public " << baseClass(p,c) << " {" << endl; + indent() << "struct " << classId << " : public Repr_Elt {" << endl; depth++; - + { + if (classId != "Surface") { indent() << "typedef " << phaseNamespaceId << "::Surface Surface;" << endl; } + if (classId != "Face") { indent() << "typedef " << phaseNamespaceId << "::Face Face;" << endl; } + if (classId != "Vertex") { indent() << "typedef " << phaseNamespaceId << "::Vertex Vertex;" << endl; } + } + ColumnedOutput::T cols; - cols << "inline " << c.id << endC << "(" << endC << "" << endC << ");" << endR; - cols << "inline " << c.id << endC << "(" << endC << "" << c.id << " const & src" << endC << ");" << endR; - cols << "inline " << c.id << endC << "(" << endC << "Representation* representation" << (isSurface?"":", size_t idx") << endC << ");" << endR; + cols << "inline " << classId << endC << "(" << endC << "" << endC << ");" << endR; + cols << "inline " << classId << endC << "(" << endC << "" << classId << " const & src" << endC << ");" << endR; + cols << "inline " << classId << endC << "(" << endC << "Representation* representation" << (isSurface?"":", size_t idx") << endC << ");" << endR; - bool const isModifier = (Phase::namespaceName(p).back() == 'M'); + bool const isModifier = (phaseNamespaceId.back() == 'M'); for (auto pLater = Phase::T(p + 1); pLater < Phase::end; pLater = Phase::T(pLater + 1)) { auto pnsLater = Phase::namespaceName(pLater); if (isModifier && pLater != Phase::AllM) continue; - cols << "inline " << c.id << endC - << "(" << endC << pnsLater << "::" << c.id << " const & src" << endC << ");" + cols << "inline " << classId << endC + << "(" << endC << pnsLater << "::" << classId << " const & src" << endC << ");" << endR; } - if (c.id == "Face") { + if (classId == "Face") { cols << "int fno" << endC << "() const { return idx; }" << endR; } - if (c.id == "Vertex") { + if (classId == "Vertex") { cols << "int vno" << endC << "() const { return idx; }" << endR; } - + if (classId == "Surface") { + generateVariousSurfaceMethods(p, cols); + } + cols.append(tos(), depth); tos() << endl; } - virtual void endClass(Phase::T p, Clss & c) { + void generateVariousSurfaceMethods(Phase::T p, ColumnedOutput::T & cols) { + if (p == Phase::XYZPositionM || p == Phase::DistortM || p == Phase::DistortM) { + cols << "void freeDistsButNotOrig() { MRISfreeDistsButNotOrig(repr); }" << endR; + } + } + + virtual void endClass(Phase::T p, string const & classId) { // indent() << absolutePns(p) << "_" << c.id << " // implementation details" << endl; depth--; - indent() << "};" << endl << endl; + indent() << "}; // " << classId << endl << endl; } }; - struct Generate_abstract_impl_Base : public Generate_abstract_Base { + struct Generate_abstract_impl_Base : public Generate_Accessor { Generate_abstract_impl_Base( ostream & os, string const & parent, - Built const & built) : Generate_abstract_Base(os, built) { + Representation & representation) : Generate_Accessor(os, representation) { } - virtual string classPrefix(Clss & c) { - return c.id + "::"; + virtual string classMemberPrefix(string const & classId) { + return classId + "::"; } - virtual void beginClass(Phase::T p, Clss & c) { + virtual void beginClass(Phase::T p, string const & classId) { ColumnedOutput::T cols; - bool isSurface = (c.id == "Surface"); + bool isSurface = (classId == "Surface"); - cols << classPrefix(c) << c.id << endC << "(" << endC << "" << endC << ") {}" << endR; - cols << classPrefix(c) << c.id << endC << "(" << endC << "Representation* representation" << (isSurface?"":", size_t idx") << endC - << ") : " << baseClass(p, c) << "(representation," << (isSurface ? "0" : "idx" ) << ") {}" << endR; - cols << classPrefix(c) << c.id << endC << "(" << endC << "" << c.id << " const & src" << endC << ") : " << baseClass(p, c) << "(src) {}" << endR; + cols << classMemberPrefix(classId) << classId << endC << "(" << endC << "" << endC << ") {}" << endR; + cols << classMemberPrefix(classId) << classId << endC << "(" << endC << "Representation* representation" << (isSurface?"":", size_t idx") << endC + << ") : Repr_Elt(representation," << (isSurface ? "0" : "idx" ) << ") {}" << endR; + cols << classMemberPrefix(classId) << classId << endC << "(" << endC << "" << classId << " const & src" << endC << ") : Repr_Elt(src) {}" << endR; bool const isModifier = (Phase::namespaceName(p).back() == 'M'); for (auto pLater = Phase::T(p + 1); pLater < Phase::end; pLater = Phase::T(pLater + 1)) { if (isModifier && pLater != Phase::AllM) continue; - cols << classPrefix(c) << c.id << endC << "(" << endC << Phase::namespaceName(pLater) << "::" << c.id << " const & src" << endC << ") : " << baseClass(p, c) << "(src) {}" << endR; + cols << classMemberPrefix(classId) << classId << endC << "(" << endC << Phase::namespaceName(pLater) << "::" << classId << " const & src" << endC << ") : Repr_Elt(src) {}" << endR; } cols.append(tos(),depth); tos() << endl; } - virtual void endClass(Phase::T p, Clss & c) { + virtual void endClass(Phase::T p, string const & classId) { tos() << endl << endl; } - virtual void generateBeforeComment(ColumnedOutput::T& cols, Dmbr const & d, bool const write) { + virtual void generateBeforeComment(ColumnedOutput::T& cols, Prop const & d, bool const write) { cols << "{"; } }; - // SurfaceFromMRIS - // - struct Generate_SurfaceFromMRIS_IsImplemented : public IsImplementedSupplier { - } generate_SurfaceFromMRIS_IsImplemented; - - struct Generate_SurfaceFromMRIS_inco : public Generate_abstract_inco_Base { - virtual Generate_SurfaceFromMRIS_inco* toGenerate_SurfaceFromMRIS_inco() { return this; } - Generate_SurfaceFromMRIS_inco( + struct Generate_Surface_inco : public Generate_abstract_inco_Base { + virtual Generate_Surface_inco* toGenerate_Surface_inco() { return this; } + Generate_Surface_inco( ostream & os, string const & parent, - Built const & built) : Generate_abstract_inco_Base(os, parent, built) + Representation & representation) : Generate_abstract_inco_Base(os, parent, representation) { - isImplementedSupplier.supplier = &generate_SurfaceFromMRIS_IsImplemented; - generateNamespace(parent, "SurfaceFromMRIS", "MRIS"); + generateNamespace(parent, "SurfaceFrom" + representation.reprClassName, representation); } }; - struct Generate_SurfaceFromMRIS_spec : public Generate_abstract_spec_Base { - virtual Generate_SurfaceFromMRIS_spec* toGenerate_SurfaceFromMRIS_spec() { return this; } + struct Generate_Surface_spec : public Generate_abstract_spec_Base { + virtual Generate_Surface_spec* toGenerate_Surface_spec() { return this; } - Generate_SurfaceFromMRIS_spec( + Generate_Surface_spec( ostream & os, string const & parent, - Built const & built) : Generate_abstract_spec_Base(os, parent, built) + Representation & representation) : Generate_abstract_spec_Base(os, parent, representation) { - isImplementedSupplier.supplier = &generate_SurfaceFromMRIS_IsImplemented; - generateNamespace(parent, "SurfaceFromMRIS", "MRIS"); + generateNamespace(parent, "SurfaceFrom" + representation.reprClassName, representation); } }; - struct Generate_SurfaceFromMRIS_impl : public Generate_abstract_impl_Base { - virtual Generate_SurfaceFromMRIS_impl* toGenerate_SurfaceFromMRIS_impl() { return this; } + struct Generate_Surface_impl : public Generate_abstract_impl_Base { + virtual Generate_Surface_impl* toGenerate_Surface_impl() { return this; } - Generate_SurfaceFromMRIS_impl( + Generate_Surface_impl( ostream & os, string const & parent, - Built const & built) : Generate_abstract_impl_Base(os, parent, built) + Representation & representation) : Generate_abstract_impl_Base(os, parent, representation) { - isImplementedSupplier.supplier = &generate_SurfaceFromMRIS_IsImplemented; - generateNamespace(parent, "SurfaceFromMRIS", "MRIS"); + generateNamespace(parent, "SurfaceFrom" + representation.reprClassName, representation); } - virtual void generateMoreLines(ColumnedOutput::T& cols, Clss const & c, Dmbr const & d, bool const write) { - auto t = d.type; - auto tr = t->toPointerToRepeatedType(); + virtual void generateMoreLines(ColumnedOutput::T& cols, string const & classId, Prop const & prop, How const & how, bool const write) { + bool const hasIndexArg = how.indexArg(prop).size(); cols << ignoreWidth << Just_left << " "; - string raw = "repr->"; - if (d.mrisVector) raw += d.mrisVector, raw += "[idx]."; - raw += d.id; - if (tr) raw += "[i]"; - - if (c.id == "Face" && d.id == "v") { - if (!write) { - cols << "return Vertex(repr,repr->faces[idx].v[i])"; - } - else { - cols << "cheapAssert(repr == to.repr); repr->faces[idx].v[i] = to.idx"; - } - } - else if (c.id == "Vertex" && d.id == "f") { - if (!write) { - cols << "return Face(repr," << raw << ")"; - } - else { - cols << "cheapAssert(repr == to.repr); " << raw << " = to.idx"; - } - } - else if (c.id == "Vertex" && d.id == "v") { - if (!write) { - cols << "return Vertex(repr," << raw << ")"; - } - else { - cols << "cheapAssert(repr == to.repr); " << raw << " = to.idx"; - } - } - else if (c.id == "Surface" && (d.id == "v_temporal_pole" || d.id == "v_frontal_pole" || d.id == "v_occipital_pole")) { - if (!write) { - cols << "return Vertex(repr," << raw << " - repr->vertices)"; - } - else { - cols << "cheapAssert(repr == to.repr); " << raw << " = repr->vertices + to.idx"; - } - } - else if (c.id == "Surface" && d.id == "vertices") { - bpt(); - if (!write) { - cols << "return Vertex(repr,i)"; - } - else { - assert(false); - } - } - else if (c.id == "Surface" && d.id == "faces") { - if (!write) { - cols << "return Face(repr,i)"; - } - else { - assert(false); - } - } - else { - string cvtPrefix = "", cvtFromPrefix = ""; - string cvtSuffix = "", cvtFromSuffix = ""; - if (c.id == "Vertex" && d.id == "n") { - cvtPrefix = "size_t("; cvtFromPrefix = tr->target->id + "("; - cvtSuffix = cvtFromSuffix = ")"; - } + string getSetExpr = how.getSetExpr(how.reprNoArrow(),prop,write); - if (!write) cols << "return " << cvtPrefix; - cols << raw; - if (write) cols << " = " << cvtFromPrefix << "to" << cvtFromSuffix; else cols << cvtSuffix; - } - cols << ";" << endR; + if (!write) cols << "return "; + cols << getSetExpr << ";"; + cols << endR; cols << ignoreWidth << Just_left << "}" << endR; } - virtual void generate_which_coords(Phase::T p, Clss & c, ColumnedOutput::T& cols, bool const write) { + virtual void generate_which_coords(Phase::T p, string const & classId, ColumnedOutput::T& cols, bool const write) { + if (representation.reprClassName == "MRIS") + generate_which_coords_MRIS(p, classId, cols, write); + else + generate_which_coords_other(p, classId, cols, write); + } + + void generate_which_coords_MRIS(Phase::T p, string const & classId, ColumnedOutput::T& cols, bool const write) { cols << ignoreWidth << Just_left << "{" << endR; cols << ignoreWidth << Just_left << " " << endC; cols << "MRISvertexCoord2XYZ_float(&repr->vertices[idx], which, x, y, z);" << endR; cols << ignoreWidth << Just_left << "}" << endR; } - }; + void generate_which_coords_other(Phase::T p, string const & classId, ColumnedOutput::T& cols, bool const write) { + cols << ignoreWidth << Just_left << "{" << endR; + cols << ignoreWidth << Just_left << " " << endR; + // cols << "repr->vertexCoord2XYZ(idx, which, x, y, z);" << endR; - // SurfaceFromMRISPV - // - struct Generate_SurfaceFromMRISPV_inco : public Generate_abstract_inco_Base { - virtual Generate_SurfaceFromMRISPV_inco* toGenerate_SurfaceFromMRISPV_inco() { return this; } - Generate_SurfaceFromMRISPV_inco( - ostream & os, - string const & parent, - Built const & built) : Generate_abstract_inco_Base(os, parent, built) - { - isImplementedSupplier.supplier = &mrispv_implemented_properties; - generateNamespace(parent, "SurfaceFromMRISPV", "MRISPV"); + cols << "#define CASE(WHICH, FIELD) \\" << endR; + cols << " case WHICH: \\" << endR; + cols << " *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \\" << endR; + cols << " break;" << endR; + cols << "" << endR; + cols << " switch (which) {" << endR; + + for (auto & propHow : representation.implements) { + auto const & prop = *propHow.prop; + auto const how = propHow.how; + if (!how) continue; + if (prop.which == "") continue; + bool canRead = (prop.firstReadingPhase <= p); + if (!canRead) continue; + assert(prop.type->id == "float"); + cols << (" CASE(" + prop.which + "," + prop.id.substr(0, prop.id.size() - 1) + ")") << endR; + } + + cols << " default:" << endR; + cols << " *x = *y = *z = 0.0;" << endR; + cols << " ErrorExit(ERROR_UNSUPPORTED, \"which_coords: unsupported which %d\", which);" << endR; + cols << " break;" << endR; + cols << " }" << endR; + cols << "" << endR; + cols << "#undef CASE" << endR; + + cols << ignoreWidth << Just_left << "}" << endR; } }; - struct Generate_SurfaceFromMRISPV_spec : public Generate_abstract_spec_Base { - virtual Generate_SurfaceFromMRISPV_spec* toGenerate_SurfaceFromMRISPV_spec() { return this; } +} + +// Section 6: main Invoke some of the generators +// +namespace Representations { + using namespace Abstract_Representation; + static void build(std::vector & representations); +} - Generate_SurfaceFromMRISPV_spec( - ostream & os, - string const & parent, - Built const & built) : Generate_abstract_spec_Base(os, parent, built) - { - isImplementedSupplier.supplier = &mrispv_implemented_properties; - generateNamespace(parent, "SurfaceFromMRISPV", "MRISPV"); +void generate(std::vector & representations) +{ + using namespace std; + + for (auto representationP : representations) { + auto & representation = *representationP; + + { ofstream os(createFilesWithin + representation.rootHeaderFile); + Representation_Generators::Generate_usingHow(os, representation); } - }; + string const root_fnm = "mrisurf_SurfaceFrom" + representation.reprClassName + "_generated"; + ofstream os(createFilesWithin + root_fnm + ".h"); + os << "#pragma once" << endl; - struct Generate_SurfaceFromMRISPV_impl : public Generate_abstract_impl_Base { - virtual Generate_SurfaceFromMRISPV_impl* toGenerate_SurfaceFromMRISPV_impl() { return this; } + auto fnm_inco = root_fnm + "_prefix"; + os << "#include \"./" << fnm_inco << ".h\"" << endl; + { + ofstream os_inco(createFilesWithin + fnm_inco + ".h"); + Accessor_Generators::Generate_Surface_inco(os_inco, fnm_inco, representation); + } - Generate_SurfaceFromMRISPV_impl( - ostream & os, - string const & parent, - Built const & built) : Generate_abstract_impl_Base(os, parent, built) { - isImplementedSupplier.supplier = &mrispv_implemented_properties; - generateNamespace(parent, "SurfaceFromMRISPV", "MRISPV"); + Accessor_Generators::Generate_Surface_spec(os, root_fnm, representation); } - virtual void generateMoreLines(ColumnedOutput::T& cols, Clss const & c, Dmbr const & d, bool const write) { - auto implemented = mrispv_implemented_properties.property(c, d); + auto fnm_impl = root_fnm + "_suffix"; + os << "#include \"./" << fnm_impl << ".h\"" << endl; + { + ofstream os_impl(createFilesWithin + fnm_impl + ".h"); + Accessor_Generators::Generate_Surface_impl(os_impl, fnm_impl, representation); + } + } - auto t = d.type; - auto tr = t->toPointerToRepeatedType(); - cols << ignoreWidth << Just_left << " "; + auto cmd = "dir " + createFilesWithin; + std::cout << cmd << endl; + ::system(cmd.c_str()); +} - string raw = "repr->" + implemented.name; - if (implemented.isVector) raw += "[idx]"; - if (tr) raw += "[i]"; +int main(int argc, const char* *argv) +{ + // Build the data structure that describes all about the surface, vertex, face, etc. + std::vector representations; + Representations::build(representations); - if (c.id == "Face" && d.id == "v") { - if (!write) { - cols << "return Vertex(repr," << raw << "[i]" << ")"; - } - else { - cols << "cheapAssert(repr == to.repr); " << raw << "[i]" << " = to.idx"; - } - } - else if (c.id == "Vertex" && d.id == "f") { - if (!write) { - cols << "return Face(repr," << raw << ")"; - } - else { - cols << "cheapAssert(repr == to.repr); " << raw << " = to.idx"; - } - } - else if (c.id == "Vertex" && d.id == "v") { - if (!write) { - cols << "return Vertex(repr," << raw << ")"; - } - else { - cols << "cheapAssert(repr == to.repr); " << raw << " = to.idx"; - } - } - else if (c.id == "Surface" && (d.id == "v_temporal_pole" || d.id == "v_frontal_pole" || d.id == "v_occipital_pole")) { - if (!write) { - cols << "return Vertex(repr," << raw << " - repr->vertices)"; - } - else { - cols << "cheapAssert(repr == to.repr); " << raw << " = repr->vertices + to.idx"; - } - } - else if (c.id == "Surface" && d.id == "vertices") { - bpt(); - if (!write) { - cols << "return Vertex(repr,i)"; - } - else { - assert(false); - } - } - else if (c.id == "Surface" && d.id == "faces") { - if (!write) { - cols << "return Face(repr,i)"; - } - else { - assert(false); - } - } - else { - string cvtPrefix = "", cvtFromPrefix = ""; - string cvtSuffix = "", cvtFromSuffix = ""; - if (c.id == "Vertex" && d.id == "n") { - cvtPrefix = "size_t("; cvtFromPrefix = tr->target->id + "("; - cvtSuffix = cvtFromSuffix = ")"; - } + // Walk the data structure to output the sources needed for a variety of different purposes + // + createFilesWithin = (argc > 1) ? argv[1] : "./tmp"; + generate(representations); - if (!write) cols << "return " << cvtPrefix; - cols << raw; - if (write) cols << " = " << cvtFromPrefix << "to" << cvtFromSuffix; else cols << cvtSuffix; - } - cols << ";" << endR; - cols << ignoreWidth << Just_left << "}" << endR; - } - - virtual void generate_which_coords(Phase::T p, Clss & c, ColumnedOutput::T& cols, bool const write) { - cols << ignoreWidth << Just_left << "{" << endR; - cols << ignoreWidth << Just_left << " " << endR; - // cols << "repr->vertexCoord2XYZ(idx, which, x, y, z);" << endR; - -cols << "#define CASE(WHICH, FIELD) \\" << endR; -cols << " case WHICH: \\" << endR; -cols << " *x = this->FIELD##x(); *y = this->FIELD##y(); *z = this->FIELD##z(); \\" << endR; -cols << " break;" << endR; -cols << "" << endR; -cols << " switch (which) {" << endR; - - for (auto & dp : c.dmbr) { - auto const & d = *dp; - if (d.which == "") continue; - if (!isImplemented(c, d)) continue; - bool canRead = (d.firstReadingPhase <= p); - if (!canRead) continue; - assert(d.type->id == "float"); -cols << (" CASE("+d.which+","+d.id.substr(0,d.id.size()-1)+")") << endR; - } - -cols << " default:" << endR; -cols << " *x = *y = *z = 0.0;" << endR; -cols << " ErrorExit(ERROR_UNSUPPORTED, \"which_coords: unsupported which %d\", which);" << endR; -cols << " break;" << endR; -cols << " }" << endR; -cols << "" << endR; -cols << "#undef CASE" << endR; - - - cols << ignoreWidth << Just_left << "}" << endR; - } - }; + // Done + return 0; +} + +// Section 7: Representations Define the properties, what each representation supports, what each phase can access +// +namespace Representations { - // Generate + // MRIS support // - void generate(Built const & built) { - - // Generate the various representations - // - if (true) { - ofstream os(createFilesWithin + "mrisurf_FACE_VERTEX_MRIS_generated.h"); - Generate_mris(os, built); + struct How_FACE : public HowDirect { + How_FACE() { this->m_secondaryName = "face_type_"; } + virtual string storeId(Prop const & prop) const { + return "faces[idx]."+HowDirect::storeId(prop); } - if (true) { - ofstream os(createFilesWithin + "mrisurf_MRIS_PropertiesInVectors.h"); - Generate_mrispv(os, built); + }; + struct How_FACE_v : public How_FACE { + virtual string retType(Prop const & prop) const { return "Vertex"; } + virtual string indexArg(Prop const & prop) const { return "size_t i"; } + virtual string getSetExpr(string const & reprNoArrow, Prop const & prop, bool write) const { + if (!write) return How_FACE::getSetExpr(reprNoArrow, prop, write); + return "cheapAssert(" + reprNoArrow + " == to.repr); " + reprNoArrow + "->faces[idx].v[i] = to.idx"; } + }; + struct How_VT : public HowDirect { + How_VT() { this->m_secondaryName = "VERTEX_TOPOLOGY"; } + virtual string storeId(Prop const & prop) const { + return "vertices_topology[idx]." + HowDirect::storeId(prop); + } + }; + struct How_VT_indexed : public How_VT { + virtual string indexArg(Prop const & prop) const { return "size_t i"; } + }; + struct How_VT_f : public How_VT_indexed { + virtual string retType(Prop const & prop) const { return "Face"; } + virtual string getSetExpr(string const & reprNoArrow, Prop const & prop, bool write) const { + if (!write) return How_VT_indexed::getSetExpr(reprNoArrow, prop, write); + return "cheapAssert(" + reprNoArrow + " == to.repr); " + reprNoArrow + "->vertices_topology[idx].f[i] = to.idx"; + } + }; + struct How_VT_n : public How_VT_indexed { + virtual string retType(Prop const & prop) const { return "size_t"; } + }; + struct How_VT_e : public How_VT_indexed { + virtual string retType(Prop const & prop) const { return "int"; } + }; + struct How_VT_v : public How_VT_indexed { + virtual string retType(Prop const & prop) const { return "Vertex"; } + virtual string getSetExpr(string const & reprNoArrow, Prop const & prop, bool write) const { + if (!write) return How_VT_indexed::getSetExpr(reprNoArrow, prop, write); + return "cheapAssert(" + reprNoArrow + " == to.repr); " + reprNoArrow + "->vertices_topology[idx].v[i] = to.idx"; + } + }; - // Generate the Surface Vector Face accessors to the various representations - // - if (true) { - string const root_fnm = "mrisurf_SurfaceFromMRIS_generated"; - ofstream os(createFilesWithin + root_fnm + ".h"); - os << "#pragma once" << endl; - - auto fnm_inco = root_fnm + "_prefix"; - os << "#include \"./" << fnm_inco << ".h\"" << endl; - { - ofstream os_inco(createFilesWithin + fnm_inco + ".h"); - Generate_SurfaceFromMRIS_inco(os_inco, fnm_inco, built); - } - - { - Generate_SurfaceFromMRIS_spec(os, root_fnm, built); - } + struct How_V : public HowDirect { + How_V() { this->m_secondaryName = "vertex_type_"; } + virtual string storeId(Prop const & prop) const { + return "vertices[idx]." + HowDirect::storeId(prop); + } + }; + struct How_V_indexed : public How_V { + virtual string indexArg(Prop const & prop) const { return "size_t i"; } + }; + struct How_V_indexed_float : public How_V_indexed { + virtual string retType(Prop const & prop) const { return "float"; } + }; - auto fnm_impl = root_fnm + "_suffix"; - os << "#include \"./" << fnm_impl << ".h\"" << endl; - { - ofstream os_impl(createFilesWithin + fnm_impl + ".h"); - Generate_SurfaceFromMRIS_impl(os_impl, fnm_impl, built); - } + struct How_MRIS : public HowDirect { How_MRIS() { this->m_secondaryName = "MRIS"; } }; + struct How_MRIS_hidden : public How_MRIS { How_MRIS_hidden() { m_isImplDetail = true; } }; + struct How_MRIS_vertex : public How_MRIS { + virtual string retType(Prop const & prop) const { return "Vertex"; } + virtual string getSetExpr(string const & reprNoArrow, Prop const & prop, bool write) const { + if (!write) return "Vertex(" + reprNoArrow + ", " + reprNoArrow + "->" + prop.id + " - " + reprNoArrow + "->vertices)"; + return "cheapAssert(" + reprNoArrow + " == to.repr); " + reprNoArrow + "->"+ prop.id +" = " + reprNoArrow + "->vertices + to.idx"; + } + }; + struct How_MRIS_indexed : public How_MRIS { + virtual string indexArg(Prop const & prop) const { return "size_t i"; } + }; + struct How_MRIS_indexed_vertices : public How_MRIS_indexed { + virtual string retType(Prop const & prop) const { return "Vertex"; } + virtual string getSetExpr(string const & reprNoArrow, Prop const & prop, bool write) const { + if (!write) return "Vertex(" + reprNoArrow + ", i)"; + return "TBD"; } + }; + struct How_MRIS_indexed_faces : public How_MRIS_indexed { + virtual string retType(Prop const & prop) const { return "Face"; } + virtual string getSetExpr(string const & reprNoArrow, Prop const & prop, bool write) const { + if (!write) return "Face(" + reprNoArrow + ", i)"; + return "TBD"; + } + }; + struct How_MRIS_indexed_MRI_EDGE : public How_MRIS_indexed { + virtual string retType(Prop const & prop) const { return "MRI_EDGE"; } + }; + struct How_MRIS_indexed_MRI_CORNER : public How_MRIS_indexed { + virtual string retType(Prop const & prop) const { return "MRI_CORNER"; } + }; + struct How_MRIS_indexed_FaceNormCacheEntry : public How_MRIS_indexed { + virtual string retType(Prop const & prop) const { return "FaceNormCacheEntry"; } + }; + struct How_MRIS_indexed_FaceNormDeferredEntry : public How_MRIS_indexed { + virtual string retType(Prop const & prop) const { return "FaceNormDeferredEntry"; } + }; + struct How_MRIS_indexed_STRIP : public How_MRIS_indexed { + virtual string retType(Prop const & prop) const { return "STRIP"; } + }; + struct How_MRIS_indexed_float : public How_MRIS_indexed { + virtual string retType(Prop const & prop) const { return "float"; } + }; - if (true) { - string const root_fnm = "mrisurf_SurfaceFromMRISPV_generated"; - ofstream os(createFilesWithin + root_fnm + ".h"); - os << "#pragma once" << endl; - auto fnm_inco = root_fnm + "_prefix"; - os << "#include \"./" << fnm_inco << ".h\"" << endl; - { - ofstream os_inco(createFilesWithin + fnm_inco + ".h"); - Generate_SurfaceFromMRISPV_inco(os_inco, fnm_inco, built); - } + // MRISPV support + // + struct HowPV_Face : public HowDirect { + HowPV_Face() { } + virtual string memberType(Prop const & prop) const { // the type of the field in the classId + return storeType(prop) + "*"; + } + virtual string memberId(Prop const & prop) const { // the id of field in the classId + return "f_" + prop.id; // it might need to be indexed by [idx] + } + virtual string storeType(Prop const & prop) const { + return prop.type->id; + } + virtual string storeId(Prop const & prop) const { + return memberId(prop) + "[idx]"; + } + }; + struct HowPV_F_indexed : public HowPV_Face { + virtual string indexArg(Prop const & prop) const { return "size_t i"; } + }; + struct HowPV_Face_v : public HowPV_Face { + virtual string retType(Prop const & prop) const { return "Vertex"; } + virtual string indexArg(Prop const & prop) const { return "size_t i"; } + virtual string getSetExpr(string const & reprNoArrow, Prop const & prop, bool write) const { + if (!write) return HowPV_Face::getSetExpr(reprNoArrow, prop, write); + return "cheapAssert(" + reprNoArrow + " == to.repr); " + reprNoArrow + "->f_v[idx][i] = to.idx"; + } + }; + struct HowPV_V : public HowDirect { + HowPV_V() { } + virtual string memberType(Prop const & prop) const { // the type of the field in the classId + return prop.type->id + "*"; + } + virtual string memberId(Prop const & prop) const { // the id of field in the classId + return "v_" + prop.id; // it might need to be indexed by [idx] + } + virtual string storeType(Prop const & prop) const { + return prop.type->id; + } + virtual string storeId(Prop const & prop) const { + return memberId(prop) + "[idx]"; + } + }; + struct HowPV_V_indexed : public HowPV_V { + virtual string indexArg(Prop const & prop) const { return "size_t i"; } + }; + struct HowPV_V_f : public HowPV_V_indexed { + virtual string retType(Prop const & prop) const { return "Face"; } + virtual string getSetExpr(string const & reprNoArrow, Prop const & prop, bool write) const { + if (!write) return "Face(" + reprNoArrow + ", " + reprNoArrow + "->v_f[idx][i])"; + return "cheapAssert(" + reprNoArrow + " == to.repr); " + reprNoArrow + "->v_f[idx][i] = to.idx"; + } + }; + struct HowPV_V_n : public HowPV_V_indexed { + virtual string retType(Prop const & prop) const { return "size_t"; } + }; + struct HowPV_V_e : public HowPV_V_indexed { + virtual string retType(Prop const & prop) const { return "int"; } + }; + struct HowPV_V_v : public HowPV_V_indexed { + virtual string retType(Prop const & prop) const { return "Vertex"; } + virtual string getSetExpr(string const & reprNoArrow, Prop const & prop, bool write) const { + if (!write) return HowPV_V_indexed::getSetExpr(reprNoArrow, prop, write); + return "cheapAssert(" + reprNoArrow + " == to.repr); " + reprNoArrow + "->v_v[idx][i] = to.idx"; + } + }; - { - Generate_SurfaceFromMRISPV_spec(os, root_fnm, built); - } + struct HowPV_V_indexed_float : public HowPV_V_indexed { + virtual string retType(Prop const & prop) const { return "float"; } + }; - auto fnm_impl = root_fnm + "_suffix"; - os << "#include \"./" << fnm_impl << ".h\"" << endl; - { - ofstream os_impl(createFilesWithin + fnm_impl + ".h"); - Generate_SurfaceFromMRISPV_impl(os_impl, fnm_impl, built); - } + struct HowPV_MRIS : public HowDirect { HowPV_MRIS() { this->m_secondaryName = ""; } }; + struct HowPV_MRIS_hidden : public HowPV_MRIS { HowPV_MRIS_hidden() { m_isImplDetail = true; } }; + struct HowPV_MRIS_vertex : public HowPV_MRIS { + virtual string retType(Prop const & prop) const { return "Vertex"; } + virtual string getSetExpr(string const & reprNoArrow, Prop const & prop, bool write) const { + if (!write) return "Vertex(" + reprNoArrow + ", " + reprNoArrow + "->" + prop.id + " - " + reprNoArrow + "->vertices)"; + return "cheapAssert(" + reprNoArrow + " == to.repr); " + reprNoArrow + "->" + prop.id + " = " + reprNoArrow + "->vertices + to.idx"; + } + }; + struct HowPV_MRIS_indexed : public HowPV_MRIS { + virtual string indexArg(Prop const & prop) const { return "size_t i"; } + }; + struct HowPV_MRIS_indexed_vertices : public HowPV_MRIS_indexed { + virtual string retType(Prop const & prop) const { return "Vertex"; } + virtual string getSetExpr(string const & reprNoArrow, Prop const & prop, bool write) const { + if (!write) return "Vertex(" + reprNoArrow + ", i)"; + return "TBD"; + } + }; + struct HowPV_MRIS_indexed_faces : public HowPV_MRIS_indexed { + virtual string retType(Prop const & prop) const { return "Face"; } + virtual string getSetExpr(string const & reprNoArrow, Prop const & prop, bool write) const { + if (!write) return "Face(" + reprNoArrow + ", i)"; + return "TBD"; } + }; + struct HowPV_MRIS_indexed_MRI_EDGE : public HowPV_MRIS_indexed { + virtual string retType(Prop const & prop) const { return "MRI_EDGE"; } + }; + struct HowPV_MRIS_indexed_MRI_CORNER : public HowPV_MRIS_indexed { + virtual string retType(Prop const & prop) const { return "MRI_CORNER"; } + }; + struct HowPV_MRIS_indexed_FaceNormCacheEntry : public HowPV_MRIS_indexed { + virtual string retType(Prop const & prop) const { return "FaceNormCacheEntry"; } + }; + struct HowPV_MRIS_indexed_FaceNormDeferredEntry : public HowPV_MRIS_indexed { + virtual string retType(Prop const & prop) const { return "FaceNormDeferredEntry"; } + }; + struct HowPV_MRIS_indexed_STRIP : public HowPV_MRIS_indexed { + virtual string retType(Prop const & prop) const { return "STRIP"; } + }; + struct HowPV_MRIS_indexed_float : public HowPV_MRIS_indexed { + virtual string retType(Prop const & prop) const { return "float"; } + }; - auto cmd = "dir " + createFilesWithin; - cout << cmd << endl; - system(cmd.c_str()); - } -} + // MRIS_MP support + // It only supports a limited set of properties itself + // and an even smaller set are requested from an underlying MRIS or another MRIS_MP + // + // It looks a lot like a subset of MRISPV + // + struct HowMP_likePV : public HowRedirect { + HowMP_likePV(How* how) : HowRedirect(how) {} + virtual string secondaryName() const { return ""; } + }; + struct HowMP_fromMRIS : public HowRedirect { + HowMP_fromMRIS(How * how) : HowRedirect(how) {} + virtual string secondaryName() const { return ""; } + virtual string reprNoArrow() const { return HowRedirect::reprNoArrow() + "->underlyingMRIS"; } + }; -int main(int argc, const char* *argv) -{ - // Build the data structure that describes all about the surface, vertex, face, etc. - auto clssVec = Generator::build(); + struct HowMP_fromMRIS_MP : public HowRedirect { + HowMP_fromMRIS_MP(How* how) : HowRedirect(how) {} + virtual string secondaryName() const { return ""; } + virtual string reprNoArrow() const { return HowRedirect::reprNoArrow() + "->in_src"; } + }; - // Walk the data structure to output the sources needed for a variety of different purposes + struct HowMP_FaceNorm : public HowPV_Face { + virtual string retType(Prop const & prop) const { return "FloatXYZ"; } + virtual string storeType(Prop const & prop) const { return retType(prop); } + }; + // Apply // - Generator::createFilesWithin = (argc > 1) ? argv[1] : "./tmp"; - Generator::generate(clssVec); - - // Done - return 0; -} + struct RepresentationX : public Representation { + RepresentationX(const char* rootHeaderFile, string const & surfaceClassName) : Representation(rootHeaderFile, surfaceClassName) { hows.push_back(nullptr); } + std::vector hows; + }; + static void doMRIS_MP(RepresentationX & rep_MRIS, RepresentationX & rep_MRISPV, RepresentationX & rep_MRIS_MP); -namespace Generator { + static void build(std::vector & final_representations) + { + // Types are used to describe how properties are passed in (to Set), stored, and returned + // + // Atomic types are passed in by value, stored by value, returned by value + // + auto t_bool = new AtomicType("bool"); - static Built build() { + auto t_char = new AtomicType("char"); + auto t_short = new AtomicType("short"); + auto t_int = new AtomicType("int"); + auto t_long = new AtomicType("long"); + auto t_uchar = new AtomicType("uchar"); + auto t_ushort = new AtomicType("ushort"); + auto t_uint = new AtomicType("uint"); + auto t_ulong = new AtomicType("ulong"); - auto t_double = new AtomicType("double"); - auto t_float = new AtomicType("float"); - auto t_char = new AtomicType("char"); - auto t_short = new AtomicType("short"); - auto t_int = new AtomicType("int"); - auto t_long = new AtomicType("long"); - auto t_uchar = new AtomicType("uchar"); - auto t_ushort = new AtomicType("ushort"); - auto t_uint = new AtomicType("uint"); - auto t_ulong = new AtomicType("ulong"); - auto t_bool = new AtomicType("bool"); + auto t_double = new AtomicType("double"); + auto t_float = new AtomicType("float"); + auto t_constFloat = new AtomicType("const float"); auto t_pVoid = new AtomicType("p_void"); auto t_ppVoid = new AtomicType("p_p_void"); @@ -1391,6 +1517,7 @@ namespace Generator { auto t_VERTEX_TOPOLOGY = new AtomicType("VERTEX_TOPOLOGY"); auto t_FACE = new AtomicType("FACE"); auto t_MRI_EDGE = new AtomicType("MRI_EDGE"); + auto t_MRI_CORNER = new AtomicType("MRI_CORNER"); auto t_FaceNormCacheEntry = new AtomicType("FaceNormCacheEntry"); auto t_FaceNormDeferredEntry = new AtomicType("FaceNormDeferredEntry"); auto t_STRIP = new AtomicType("STRIP"); @@ -1401,6 +1528,8 @@ namespace Generator { auto t_MRIS_subject_name_t = new AtomicType("MRIS_subject_name_t"); auto t_COLOR_TABLE = new AtomicType("COLOR_TABLE"); + // Pointer types are passed in by value, stored by value, returned by value + // auto t_PMATRIX = new PointerType("PMATRIX", t_MATRIX); auto t_PDMATRIX = new PointerType("PDMATRIX", t_DMATRIX); auto t_PVERTEX = new PointerType("PVERTEX", t_VERTEX); @@ -1410,417 +1539,661 @@ namespace Generator { auto t_PCOLOR_TABLE = new PointerType("PCOLOR_TABLE", t_COLOR_TABLE); auto t_PMRI = new PointerType("PMRI", t_MRI); - auto t_PR_float = new PointerToRepeatedType("pSeveralFloat" , t_float); - auto t_PR_int = new PointerToRepeatedType("pSeveralInt" , t_int); - auto t_PR_uchar = new PointerToRepeatedType("pSeveralUchar" , t_uchar); - auto t_PR_VERTEX = new PointerToRepeatedType("pSeveralVERTEX" , t_VERTEX); - auto t_PR_VERTEX_TOPOLOGY = new PointerToRepeatedType("pSeveralVERTEX_TOPOLOGY" , t_VERTEX_TOPOLOGY); - auto t_PR_FACE = new PointerToRepeatedType("pSeveralFACE" , t_FACE); - auto t_PR_MRI_EDGE = new PointerToRepeatedType("pSeveralMRI_EDGE" , t_MRI_EDGE); - auto t_PR_FaceNormCacheEntry = new PointerToRepeatedType("pSeveralFaceNormCacheEntry" , t_FaceNormCacheEntry); - auto t_PR_FaceNormDeferredEntry = new PointerToRepeatedType("pSeveralFaceNormDeferredEntry" , t_FaceNormDeferredEntry); - auto t_PR_STRIP = new PointerToRepeatedType("pSeveralSTRIP" , t_STRIP); + // These are passed in by TBD, stored as a count and a pointer, by TBD. + // + auto t_PR_float = new PointerToRepeatedAtomicType("pSeveralFloat" , t_float); + auto t_PR_constFloat = new PointerToRepeatedAtomicType("pSeveralConstFloat" , t_constFloat); + auto t_PR_int = new PointerToRepeatedAtomicType("pSeveralInt" , t_int); + auto t_PR_uchar = new PointerToRepeatedAtomicType("pSeveralUchar" , t_uchar); + auto t_PR_VERTEX = new PointerToRepeatedAtomicType("pSeveralVERTEX" , t_VERTEX); + auto t_PR_VERTEX_TOPOLOGY = new PointerToRepeatedAtomicType("pSeveralVERTEX_TOPOLOGY" , t_VERTEX_TOPOLOGY); + auto t_PR_FACE = new PointerToRepeatedAtomicType("pSeveralFACE" , t_FACE); + auto t_PR_MRI_EDGE = new PointerToRepeatedAtomicType("pSeveralMRI_EDGE" , t_MRI_EDGE); + auto t_PR_MRI_CORNER = new PointerToRepeatedAtomicType("pSeveralMRI_CORNER" , t_MRI_CORNER); + auto t_PR_FaceNormCacheEntry = new PointerToRepeatedAtomicType("pSeveralFaceNormCacheEntry" , t_FaceNormCacheEntry); + auto t_PR_FaceNormDeferredEntry = new PointerToRepeatedAtomicType("pSeveralFaceNormDeferredEntry" , t_FaceNormDeferredEntry); + auto t_PR_STRIP = new PointerToRepeatedAtomicType("pSeveralSTRIP" , t_STRIP); + + // As the following is executed, the properties go into all the representations currently in the set. + // + std::set representations; + + string accessorClassId; + + auto rep_MRIS = new RepresentationX("mrisurf_FACE_VERTEX_MRIS_generated.h" , "MRIS"); + auto rep_MRISPV = new RepresentationX("mrisurf_MRIS_PropertiesInVectors.h" , "MRISPV"); + + representations.insert(rep_MRIS); + representations.insert(rep_MRISPV); + + auto howPush = [&](HowDirect* h0, HowDirect* h1) { + rep_MRIS ->hows.push_back(h0); + rep_MRISPV ->hows.push_back(h1); + }; + auto howMod = [&](HowDirect* h0, HowDirect* h1) { + rep_MRIS ->hows.back() = h0; + rep_MRISPV ->hows.back() = h1; + }; + auto howPop = [&]() { + rep_MRIS ->hows.pop_back(); + rep_MRISPV ->hows.pop_back(); + }; + + auto makeProp = [&](Type* t, Id i, Phase::T rb, Phase::T wb, Phase::T we, string const & com = "") { + if (rb == Phase::end && wb != Phase::end) rb = wb; + auto added = new Prop(accessorClassId, t, i, rb, wb, we, com); + for (auto & r : representations) { + if (!r) continue; + if (auto how = r->hows.back()) r->implements.push_back(Representation::PropHow(added, how)); + }; + return added; + }; + + auto addProp = [&](Type* t, Id i, string const & com = "") { return makeProp(t, i, phaseRbegin, phaseWbegin, phaseWend, com); }; + auto addPropCom = [&](string const & com) { return makeProp(nullptr, "", Phase::end, Phase::end, Phase::end, com); }; + auto addPropList = [&](string const & com) { return addPropCom(com)->setCommentNature(ComList); }; + auto addPropListSublist = [&](string const & com) { return addPropCom(com)->setCommentNature(ComListSublist); }; + + + // Face + accessorClassId = "Face"; - auto vtx = new Clss("Vertex"); - auto fac = new Clss("Face"); - // auto edg = new Clss("Edge"); - auto sur = new Clss("Surface"); + howPush(new How_FACE,new HowPV_Face); - currentMrisVector = "faces"; - phaseRbegin = phaseWbegin = phaseWend = Phase::TopologyM; + // Describe how the next few properties are to be stored + phaseRbegin = phaseWbegin = phaseWend = Phase::TopologyM; + addPropList("LIST_OF_FACE_ELTS"); - fac->addDmbrList("LIST_OF_FACE_ELTS"); + howPush(new How_FACE_v, new HowPV_Face_v); + addProp(t_vertices_per_face_t, "v"); + howPop(); - fac->addDmbr(t_vertices_per_face_t, "v"); + phaseRbegin = phaseWbegin = phaseWend = Phase::XYZPositionConsequencesM; - phaseRbegin = phaseWbegin = phaseWend = Phase::XYZPositionConsequencesM; + addProp(t_float, "area"); + addProp(t_angles_per_triangle_t, "angle"); - fac->addDmbr(t_float, "area"); - fac->addDmbr(t_angles_per_triangle_t, "angle"); + phaseRbegin = phaseWbegin = Phase::XYZPositionConsequencesM; phaseWend = Phase::end; - phaseRbegin = phaseWbegin = Phase::XYZPositionConsequencesM; phaseWend = Phase::end; + addProp(t_angles_per_triangle_t, "orig_angle"); - fac->addDmbr(t_angles_per_triangle_t, "orig_angle"); + phaseRbegin = phaseWbegin = Phase::ExistenceM; phaseWend = Phase::end; - phaseRbegin = phaseWbegin = Phase::ExistenceM; phaseWend = Phase::end; + addProp(t_char, "ripflag"); + addProp(t_char, "oripflag"); + addProp(t_int, "marked"); - fac->addDmbr(t_char, "ripflag"); - fac->addDmbr(t_char, "oripflag"); - fac->addDmbr(t_int, "marked"); + phaseRbegin = phaseWbegin = phaseWend = Phase::XYZPositionConsequencesM; - phaseRbegin = phaseWbegin = phaseWend = Phase::XYZPositionConsequencesM; + addProp(t_PDMATRIX, "norm"); + addProp(t_A3PDMATRIX, "gradNorm")->setNoHash(); - fac->addDmbr(t_PDMATRIX, "norm"); - fac->addDmbr(t_A3PDMATRIX, "gradNorm")->setNoHash(); + // Vertices + accessorClassId = "Vertex"; + // First the VERTEX_TOPOLOGY members + howPush(new How_VT,new HowPV_V); - currentMrisVector = "vertices_topology"; - phaseRbegin = phaseWbegin = Phase::TopologyM; phaseWend = Phase::end; + phaseRbegin = phaseWbegin = Phase::TopologyM; phaseWend = Phase::end; - // vtx->dmbr(); - // LIST_OF_VERTEX_TOPOLOGY_ELTS - vtx->addDmbrList("LIST_OF_VERTEX_TOPOLOGY_ELTS"); - vtx->addDmbrCom("put the pointers before the ints, before the shorts, before uchars, to reduce size"); - vtx->addDmbrCom("the whole fits in much less than one cache line, so further ordering is no use"); + addPropList("LIST_OF_VERTEX_TOPOLOGY_ELTS"); + addPropCom("put the pointers before the ints, before the shorts, before uchars, to reduce size"); + addPropCom("the whole fits in much less than one cache line, so further ordering is no use"); + howPush(new How_VT_f, new HowPV_V_f); auto vtx_f = - vtx->addDmbr(t_PR_int, "f" , "array[v->num] the fno's of the neighboring faces "); + addProp(t_PR_int, "f" , "array[v->num] the fno's of the neighboring faces "); + howMod(new How_VT_n, new HowPV_V_n); auto vtx_n = - vtx->addDmbr(t_PR_uchar, "n" , "array[v->num] the face.v[*] index for this vertex "); - vtx->addDmbr(t_PR_int, "e" , "edge state for neighboring vertices "); + addProp(t_PR_uchar, "n" , "array[v->num] the face.v[*] index for this vertex "); + howMod(new How_VT_e, new HowPV_V_e); + addProp(t_PR_int, "e" , "edge state for neighboring vertices "); + howPop(); - phaseRbegin = phaseWbegin = Phase::TopologyM; phaseWend = Phase::TopologyM; + phaseRbegin = phaseWbegin = Phase::TopologyM; phaseWend = Phase::TopologyM; + howPush(new How_VT_v,new HowPV_V_v); auto vtx_v = - vtx->addDmbr(t_PR_int, "v" , "array[v->vtotal or more] of vno, head sorted by hops "); + addProp(t_PR_int, "v" , "array[v->vtotal or more] of vno, head sorted by hops "); + howPop(); auto vtx_vnum = - vtx->addDmbr(t_short, "vnum" , "number of 1-hop neighbors should use [p]VERTEXvnum(i, "); + addProp(t_short, "vnum" , "number of 1-hop neighbors should use [p]VERTEXvnum(i) "); - vtx->addDmbr(t_short, "v2num" , "number of 1, or 2-hop neighbors "); - vtx->addDmbr(t_short, "v3num" , "number of 1,2,or 3-hop neighbors "); + addProp(t_short, "v2num" , "number of 1, or 2-hop neighbors "); + addProp(t_short, "v3num" , "number of 1,2,or 3-hop neighbors "); auto vtx_vtotal = - vtx->addDmbr(t_short, "vtotal" , "total # of neighbors. copy of vnum.nsizeCur "); + addProp(t_short, "vtotal" , "total # of neighbors. copy of vnum.nsizeCur "); - vtx->addDmbr(t_short, "nsizeMaxClock" , "copy of mris->nsizeMaxClock when v#num ") + addProp(t_short, "nsizeMaxClock" , "copy of mris->nsizeMaxClock when v#num ") ->setNoHash(); - vtx->addDmbr(t_uchar, "nsizeMax" , "the max nsize that was used to fill in vnum etc "); - vtx->addDmbr(t_uchar, "nsizeCur" , "index of the current v#num in vtotal "); + addProp(t_uchar, "nsizeMax" , "the max nsize that was used to fill in vnum etc "); + addProp(t_uchar, "nsizeCur" , "index of the current v#num in vtotal "); auto vtx_num = - vtx->addDmbr(t_uchar, "num" , "number of neighboring faces "); + addProp(t_uchar, "num" , "number of neighboring faces "); vtx_f->setPRSize(vtx_num); vtx_n->setPRSize(vtx_num); vtx_v->setPRSize(vtx_vtotal); - currentMrisVector = "vertices"; + // The the VERTEX members + howPush(new How_V, new HowPV_V); - phaseRbegin = Phase::XYZPositionM; phaseWbegin = Phase::end; phaseWend = Phase::end; + phaseRbegin = Phase::XYZPositionM; phaseWbegin = Phase::end; phaseWend = Phase::end; - vtx->addDmbrList("LIST_OF_VERTEX_ELTS_1"); + addPropList("LIST_OF_VERTEX_ELTS_1"); + addPropCom("managed by MRISfreeDists[_orig] and MRISmakeDists[_orig]"); - vtx->addDmbrCom("managed by MRISfreeDists[_orig] and MRISmakeDists[_orig]"); + howPush(new How_V_indexed_float, new HowPV_V_indexed_float); auto vtx_dist = - vtx->addDmbr(t_PR_float, "dist" , "distance to neighboring vertices based on xyz "); - auto vtx_dist_orig = - vtx->addDmbr(t_PR_float, "dist_orig" , "distance to neighboring vertices based on origxyz"); - vtx->addDmbr(t_int, "dist_capacity" , "-- should contain at least vtx_vtotal elements "); - vtx->addDmbr(t_int, "dist_orig_capacity", "-- should contain at least vtx_vtotal elements "); - - vtx_dist->setPRSize (vtx_vtotal); - vtx_dist_orig->setPRSize(vtx_vtotal); - - phaseRbegin = phaseWbegin = Phase::XYZPositionM; phaseWend = Phase::XYZPositionM; - - vtx->addDmbrCom(""); - vtx->addDmbr(t_float, "x" , "current coordinates ")->setWhich("CURRENT_VERTICES"); - vtx->addDmbr(t_float, "y" , "use MRISsetXYZ() to set"); - vtx->addDmbr(t_float, "z" ); - - phaseRbegin = Phase::XYZPositionM; phaseWbegin = Phase::end; phaseWend = Phase::end; - - vtx->addDmbrCom(""); - vtx->addDmbr(t_float, "origx" , "original coordinates, see also MRIS::origxyz_status")->setWhich("ORIGINAL_VERTICES"); - vtx->addDmbr(t_float, "origy" , "use MRISsetOriginalXYZ(, "); - vtx->addDmbr(t_float, "origz" , "or MRISsetOriginalXYZfromXYZ to set"); - - phaseRbegin = phaseWbegin = Phase::XYZPositionConsequencesM; phaseWend = Phase::end; - - vtx->addDmbrCom(""); - vtx->addDmbr(t_float, "nx")->setWhich("VERTEX_NORMALS"); - vtx->addDmbr(t_float, "ny"); - vtx->addDmbr(t_float, "nz", "curr normal"); - - phaseRbegin = phaseWbegin = Phase::DistortM; phaseWend = Phase::end; - - vtx->addDmbr(t_float, "pnx")->setWhich("PIAL_NORMALS"); - vtx->addDmbr(t_float, "pny"); - vtx->addDmbr(t_float, "pnz", "pial normal"); - - vtx->addDmbrCom(""); - vtx->addDmbr(t_float, "wnx")->setWhich("WHITE_NORMALS"); - vtx->addDmbr(t_float, "wny"); - vtx->addDmbr(t_float, "wnz", "white normal"); - vtx->addDmbr(t_float, "onx"); - vtx->addDmbr(t_float, "ony"); - vtx->addDmbr(t_float, "onz", "original normal"); - vtx->addDmbr(t_float, "dx"); - vtx->addDmbr(t_float, "dy"); - vtx->addDmbr(t_float, "dz", "current change in position"); - vtx->addDmbr(t_float, "odx"); - vtx->addDmbr(t_float, "ody"); - vtx->addDmbr(t_float, "odz", "last change of position (for momentum, "); - vtx->addDmbr(t_float, "tdx"); - vtx->addDmbr(t_float, "tdy"); - vtx->addDmbr(t_float, "tdz", "temporary storage for averaging gradient"); - vtx->addDmbr(t_float, "curv", "curr curvature"); - vtx->addDmbr(t_float, "curvbak"); - vtx->addDmbr(t_float, "val", "scalar data value (file: rh.val, sig2-rh.w)"); - vtx->addDmbr(t_float, "imag_val", "imaginary part of complex data value"); - - phaseRbegin = phaseWbegin = Phase::XYZPositionM; phaseWend = Phase::end; - - vtx->addDmbr(t_float, "cx")->setWhich("CANONICAL_VERTICES"); - vtx->addDmbr(t_float, "cy"); - vtx->addDmbr(t_float, "cz", "coordinates in canonical coordinate system"); - - phaseRbegin = phaseWbegin = Phase::DistortM; phaseWend = Phase::end; - - vtx->addDmbr(t_float, "tx")->setWhich("TMP_VERTICES"); - vtx->addDmbr(t_float, "ty"); - vtx->addDmbr(t_float, "tz", "tmp coordinate storage"); - vtx->addDmbr(t_float, "t2x")->setWhich("TMP2_VERTICES"); - vtx->addDmbr(t_float, "t2y"); - vtx->addDmbr(t_float, "t2z", "another tmp coordinate storage"); - vtx->addDmbr(t_float, "targx"); - vtx->addDmbr(t_float, "targy"); - vtx->addDmbr(t_float, "targz", "target coordinates"); - vtx->addDmbr(t_float, "pialx")->setWhich("PIAL_VERTICES"); - vtx->addDmbr(t_float, "pialy"); - vtx->addDmbr(t_float, "pialz", "pial surface coordinates"); - vtx->addDmbr(t_float, "whitex")->setWhich("WHITE_VERTICES"); - vtx->addDmbr(t_float, "whitey"); - vtx->addDmbr(t_float, "whitez", "white surface coordinates"); - vtx->addDmbr(t_float, "l4x"); - vtx->addDmbr(t_float, "l4y"); - vtx->addDmbr(t_float, "l4z", "layerIV surface coordinates"); - vtx->addDmbr(t_float, "infx")->setWhich("INFLATED_VERTICES"); - vtx->addDmbr(t_float, "infy"); - vtx->addDmbr(t_float, "infz", "inflated coordinates"); - vtx->addDmbr(t_float, "fx")->setWhich("FLATTENED_VERTICES"); - vtx->addDmbr(t_float, "fy"); - vtx->addDmbr(t_float, "fz", "flattened coordinates"); - vtx->addDmbr(t_int, "px"); - vtx->addDmbr(t_int, "qx"); - vtx->addDmbr(t_int, "py"); - vtx->addDmbr(t_int, "qy"); - vtx->addDmbr(t_int, "pz"); - vtx->addDmbr(t_int, "qz", "rational coordinates for exact calculations"); - vtx->addDmbr(t_float, "e1x"); - vtx->addDmbr(t_float, "e1y"); - vtx->addDmbr(t_float, "e1z", "1st basis vector for the local tangent plane"); - vtx->addDmbr(t_float, "e2x"); - vtx->addDmbr(t_float, "e2y"); - vtx->addDmbr(t_float, "e2z", "2nd basis vector for the local tangent plane"); - vtx->addDmbr(t_float, "pe1x"); - vtx->addDmbr(t_float, "pe1y"); - vtx->addDmbr(t_float, "pe1z", "1st basis vector for the local tangent plane"); - vtx->addDmbr(t_float, "pe2x"); - vtx->addDmbr(t_float, "pe2y"); - vtx->addDmbr(t_float, "pe2z", "2nd basis vector for the local tangent plane"); - - vtx->addDmbrList("LIST_OF_VERTEX_ELTS_3"); - - vtx->addDmbr(t_float, "nc", "curr length normal comp "); - vtx->addDmbr(t_float, "val2", "complex comp data value (file: sig3-rh.w) "); - vtx->addDmbr(t_float, "valbak", "scalar data stack "); - vtx->addDmbr(t_float, "val2bak", "complex comp data stack "); - vtx->addDmbr(t_float, "stat", "statistic "); - vtx->addDmbrCom(""); - - vtx->addDmbr(t_int, "undefval", "[previously dist=0] "); - vtx->addDmbr(t_int, "old_undefval", "for smooth_val_sparse "); - vtx->addDmbr(t_int, "fixedval", "[previously val=0] "); - vtx->addDmbrCom(""); - - vtx->addDmbr(t_float, "fieldsign", "fieldsign--final: -1, \"0\", \"1\" (file: rh.fs) "); - vtx->addDmbr(t_float, "fsmask", "significance mask (file: rh.fm) "); - vtx->addDmbr(t_float, "d", "for distance calculations "); - - vtx->addDmbrList("LIST_OF_VERTEX_ELTS_5"); - - vtx->addDmbr(t_int, "annotation", "area label (defunct--now from label file name!) "); - vtx->addDmbr(t_char, "oripflag"); - vtx->addDmbr(t_char, "origripflag", "cuts flags "); - - vtx->addDmbrList("LIST_OF_VERTEX_ELTS_7"); - - vtx->addDmbr(t_pVoid, "vp", "to store user's information ")->setNoHash(); - vtx->addDmbr(t_float, "theta"); - vtx->addDmbr(t_float, "phi", "parameterization "); + addProp(t_PR_float, "dist" , "distance to neighboring vertices based on xyz "); + vtx_dist->setPRSize(vtx_vtotal); + auto vtx_dist_orig = + addProp(t_PR_float, "dist_orig" , "distance to neighboring vertices based on origxyz"); + vtx_dist_orig->setPRSize(vtx_vtotal); + howPop(); + + addProp(t_int, "dist_capacity" , "-- should contain at least vtx_vtotal elements "); + addProp(t_int, "dist_orig_capacity", "-- should contain at least vtx_vtotal elements "); + + phaseRbegin = phaseWbegin = Phase::XYZPositionM; phaseWend = Phase::XYZPositionM; + addPropCom(""); + + addProp(t_float, "x" , "current coordinates ")->setWhich("CURRENT_VERTICES"); + addProp(t_float, "y" , "use MRISsetXYZ() to set"); + addProp(t_float, "z" ); + + phaseRbegin = Phase::XYZPositionM; phaseWbegin = Phase::end; phaseWend = Phase::end; + + addPropCom(""); + addProp(t_float, "origx" , "original coordinates, see also MRIS::origxyz_status")->setWhich("ORIGINAL_VERTICES"); + addProp(t_float, "origy" , "use MRISsetOriginalXYZ(, "); + addProp(t_float, "origz" , "or MRISsetOriginalXYZfromXYZ to set"); + + phaseRbegin = phaseWbegin = Phase::XYZPositionConsequencesM; phaseWend = Phase::end; + + addPropCom(""); + addProp(t_float, "nx")->setWhich("VERTEX_NORMALS"); + addProp(t_float, "ny"); + addProp(t_float, "nz", "curr normal"); + + phaseRbegin = phaseWbegin = Phase::DistortM; phaseWend = Phase::end; + + addProp(t_float, "pnx")->setWhich("PIAL_NORMALS"); + addProp(t_float, "pny"); + addProp(t_float, "pnz", "pial normal"); + + addPropCom(""); + + addProp(t_float, "wnx")->setWhich("WHITE_NORMALS"); + addProp(t_float, "wny"); + addProp(t_float, "wnz", "white normal"); + addProp(t_float, "onx"); + addProp(t_float, "ony"); + addProp(t_float, "onz", "original normal"); + addProp(t_float, "dx"); + addProp(t_float, "dy"); + addProp(t_float, "dz", "current change in position"); + addProp(t_float, "odx"); + addProp(t_float, "ody"); + addProp(t_float, "odz", "last change of position (for momentum, "); + addProp(t_float, "tdx"); + addProp(t_float, "tdy"); + addProp(t_float, "tdz", "temporary storage for averaging gradient"); + addProp(t_float, "curv", "curr curvature"); + addProp(t_float, "curvbak"); + addProp(t_float, "val", "scalar data value (file: rh.val, sig2-rh.w)"); + addProp(t_float, "imag_val", "imaginary part of complex data value"); + + phaseRbegin = phaseWbegin = Phase::XYZPositionM; phaseWend = Phase::end; + + addProp(t_float, "cx")->setWhich("CANONICAL_VERTICES"); + addProp(t_float, "cy"); + addProp(t_float, "cz", "coordinates in canonical coordinate system"); + + phaseRbegin = phaseWbegin = Phase::DistortM; phaseWend = Phase::end; + + addProp(t_float, "tx")->setWhich("TMP_VERTICES"); + addProp(t_float, "ty"); + addProp(t_float, "tz", "tmp coordinate storage"); + addProp(t_float, "t2x")->setWhich("TMP2_VERTICES"); + addProp(t_float, "t2y"); + addProp(t_float, "t2z", "another tmp coordinate storage"); + addProp(t_float, "targx"); + addProp(t_float, "targy"); + addProp(t_float, "targz", "target coordinates"); + addProp(t_float, "pialx")->setWhich("PIAL_VERTICES"); + addProp(t_float, "pialy"); + addProp(t_float, "pialz", "pial surface coordinates"); + addProp(t_float, "whitex")->setWhich("WHITE_VERTICES"); + addProp(t_float, "whitey"); + addProp(t_float, "whitez", "white surface coordinates"); + addProp(t_float, "l4x"); + addProp(t_float, "l4y"); + addProp(t_float, "l4z", "layerIV surface coordinates"); + addProp(t_float, "infx")->setWhich("INFLATED_VERTICES"); + addProp(t_float, "infy"); + addProp(t_float, "infz", "inflated coordinates"); + addProp(t_float, "fx")->setWhich("FLATTENED_VERTICES"); + addProp(t_float, "fy"); + addProp(t_float, "fz", "flattened coordinates"); + addProp(t_int, "px"); + addProp(t_int, "qx"); + addProp(t_int, "py"); + addProp(t_int, "qy"); + addProp(t_int, "pz"); + addProp(t_int, "qz", "rational coordinates for exact calculations"); + addProp(t_float, "e1x"); + addProp(t_float, "e1y"); + addProp(t_float, "e1z", "1st basis vector for the local tangent plane"); + addProp(t_float, "e2x"); + addProp(t_float, "e2y"); + addProp(t_float, "e2z", "2nd basis vector for the local tangent plane"); + addProp(t_float, "pe1x"); + addProp(t_float, "pe1y"); + addProp(t_float, "pe1z", "1st basis vector for the local tangent plane"); + addProp(t_float, "pe2x"); + addProp(t_float, "pe2y"); + addProp(t_float, "pe2z", "2nd basis vector for the local tangent plane"); + + addPropList("LIST_OF_VERTEX_ELTS_3"); + + addProp(t_float, "nc", "curr length normal comp "); + addProp(t_float, "val2", "complex comp data value (file: sig3-rh.w) "); + addProp(t_float, "valbak", "scalar data stack "); + addProp(t_float, "val2bak", "complex comp data stack "); + addProp(t_float, "stat", "statistic "); + addPropCom(""); + + addProp(t_int, "undefval", "[previously dist=0] "); + addProp(t_int, "old_undefval", "for smooth_val_sparse "); + addProp(t_int, "fixedval", "[previously val=0] "); + addPropCom(""); + + addProp(t_float, "fieldsign", "fieldsign--final: -1, \"0\", \"1\" (file: rh.fs) "); + addProp(t_float, "fsmask", "significance mask (file: rh.fm) "); + addProp(t_float, "d", "for distance calculations "); + + addPropList("LIST_OF_VERTEX_ELTS_5"); + + addProp(t_int, "annotation", "area label (defunct--now from label file name!) "); + addProp(t_char, "oripflag"); + addProp(t_char, "origripflag", "cuts flags "); + + addPropList("LIST_OF_VERTEX_ELTS_7"); + + addProp(t_pVoid, "vp", "to store user's information ")->setNoHash(); + addProp(t_float, "theta"); + addProp(t_float, "phi", "parameterization "); - phaseRbegin = phaseWbegin = phaseWend = Phase::XYZPositionConsequencesM; + phaseRbegin = phaseWbegin = phaseWend = Phase::XYZPositionConsequencesM; - vtx->addDmbr(t_float, "area"); - - phaseRbegin = phaseWbegin = Phase::DistortM; phaseWend = Phase::end; - - vtx->addDmbr(t_float, "origarea"); - vtx->addDmbr(t_float, "group_avg_area"); - vtx->addDmbr(t_float, "K", "Gaussian curvature "); - vtx->addDmbr(t_float, "H", "mean curvature "); - vtx->addDmbr(t_float, "k1"); - vtx->addDmbr(t_float, "k2", "the principal curvatures "); - vtx->addDmbr(t_float, "mean"); - vtx->addDmbr(t_float, "mean_imag", "imaginary part of complex statistic "); - vtx->addDmbr(t_float, "std_error"); - vtx->addDmbr(t_uint, "flags"); - vtx->addDmbr(t_int, "fno", "face that this vertex is in "); - vtx->addDmbr(t_int, "cropped"); - vtx->addDmbr(t_short, "marked", "for a variety of uses "); - vtx->addDmbr(t_short, "marked2"); - vtx->addDmbr(t_short, "marked3"); - vtx->addDmbr(t_char, "neg", "1 if the normal vector is inverted "); - vtx->addDmbr(t_char, "border", "flag "); - - phaseRbegin = phaseWbegin = Phase::ExistenceM; phaseWend = Phase::end; - - vtx->addDmbr(t_char, "ripflag", "vertex no longer exists - placed last to load the next vertex into cache"); - - vtx->addDmbrList("LIST_OF_VERTEX_ELTS"); - vtx->addDmbrListSublist("LIST_OF_VERTEX_ELTS_1"); - vtx->addDmbrListSublist("LIST_OF_VERTEX_ELTS_3"); - vtx->addDmbrListSublist("LIST_OF_VERTEX_ELTS_5"); - vtx->addDmbrListSublist("LIST_OF_VERTEX_ELTS_7"); - - // edg->dmbr(); - - currentMrisVector = nullptr; - phaseWbegin = phaseWend = Phase::TopologyM; - - sur->addDmbrList("LIST_OF_MRIS_ELTS_1"); - - phaseRbegin = Phase::TopologyM; phaseWbegin = phaseWend = Phase::end; + addProp(t_float, "area"); + + phaseRbegin = phaseWbegin = Phase::DistortM; phaseWend = Phase::end; + + addProp(t_float, "origarea"); + addProp(t_float, "group_avg_area"); + addProp(t_float, "K", "Gaussian curvature "); + addProp(t_float, "H", "mean curvature "); + addProp(t_float, "k1"); + addProp(t_float, "k2", "the principal curvatures "); + addProp(t_float, "mean"); + addProp(t_float, "mean_imag", "imaginary part of complex statistic "); + addProp(t_float, "std_error"); + addProp(t_uint, "flags"); + addProp(t_int, "fno", "face that this vertex is in "); + addProp(t_int, "cropped"); + addProp(t_short, "marked", "for a variety of uses "); + addProp(t_short, "marked2"); + addProp(t_short, "marked3"); + addProp(t_char, "neg", "1 if the normal vector is inverted "); + addProp(t_char, "border", "flag "); + + phaseRbegin = phaseWbegin = Phase::ExistenceM; phaseWend = Phase::end; + + addProp(t_char, "ripflag", "vertex no longer exists - placed last to load the next vertex into cache"); + + addPropList("LIST_OF_VERTEX_ELTS"); + addPropListSublist("LIST_OF_VERTEX_ELTS_1"); + addPropListSublist("LIST_OF_VERTEX_ELTS_3"); + addPropListSublist("LIST_OF_VERTEX_ELTS_5"); + addPropListSublist("LIST_OF_VERTEX_ELTS_7"); + + // Edge + + // Surface + accessorClassId = "Surface"; + howPush(new How_MRIS, new HowPV_MRIS); + + phaseWbegin = phaseWend = Phase::TopologyM; + + addPropList("LIST_OF_MRIS_ELTS_1"); + + phaseRbegin = Phase::TopologyM; phaseWbegin = phaseWend = Phase::end; - sur->addDmbrCom("Fields being maintained by specialist functions"); - sur->addDmbr(t_int, "nverticesFrozen", "# of vertices on surface is frozen"); - sur->addDmbr(t_int, "nvertices", "# of vertices on surface, change by calling MRISreallocVerticesAndFaces et al"); - sur->addDmbr(t_int, "nfaces", "# of faces on surface, change by calling MRISreallocVerticesAndFaces et al"); - sur->addDmbr(t_bool, "faceAttachmentDeferred", "defer connecting faces to vertices for performance reasons"); - sur->addDmbr(t_int, "nedges", "# of edges on surface"); - sur->addDmbr(t_int, "nstrips"); - sur->addDmbr(t_PR_VERTEX_TOPOLOGY, "vertices_topology"); - sur->addDmbr(t_PR_VERTEX, "vertices"); - sur->addDmbr(t_ppVoid, "dist_storage", "the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored")->setNoHash(); - sur->addDmbr(t_ppVoid, "dist_orig_storage", "the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored")->setNoHash(); - sur->addDmbr(t_int, "tempsAssigned", "State of various temp fields that can be borrowed if not already in use"); - - phaseRbegin = Phase::TopologyM; phaseWbegin = phaseWend = Phase::end; - sur->addDmbr(t_PR_FACE, "faces"); - sur->addDmbr(t_PR_MRI_EDGE, "edges"); - sur->addDmbr(t_PR_FaceNormCacheEntry, "faceNormCacheEntries"); - sur->addDmbr(t_PR_FaceNormDeferredEntry, "faceNormDeferredEntries"); - - phaseRbegin = phaseWbegin = Phase::XYZPositionConsequencesM; phaseWend = Phase::end; - sur->addDmbr(t_PR_STRIP, "strips"); - - phaseRbegin = phaseWbegin = Phase::XYZPositionConsequencesM; phaseWend = Phase::end; - sur->addDmbr(t_float, "xctr"); - sur->addDmbr(t_float, "yctr"); - sur->addDmbr(t_float, "zctr"); - sur->addDmbr(t_float, "xlo"); - sur->addDmbr(t_float, "ylo"); - sur->addDmbr(t_float, "zlo"); - sur->addDmbr(t_float, "xhi"); - sur->addDmbr(t_float, "yhi"); - sur->addDmbr(t_float, "zhi"); - sur->addDmbr(t_float, "x0", "center of spherical expansion"); - sur->addDmbr(t_float, "y0"); - sur->addDmbr(t_float, "z0"); - sur->addDmbr(t_PVERTEX, "v_temporal_pole"); // WEIRD THAT THESE ARE POINTERS TO VERTICES - sur->addDmbr(t_PVERTEX, "v_frontal_pole"); - sur->addDmbr(t_PVERTEX, "v_occipital_pole"); - sur->addDmbr(t_float, "max_curv"); - sur->addDmbr(t_float, "min_curv"); - sur->addDmbr(t_float, "total_area"); - sur->addDmbr(t_double, "avg_vertex_area"); - - phaseRbegin = phaseWbegin = Phase::XYZPositionConsequencesM; phaseWend = Phase::XYZPositionConsequencesM; - sur->addDmbr(t_double, "avg_vertex_dist", "set by MRIScomputeAvgInterVertexDist"); - sur->addDmbr(t_double, "std_vertex_dist"); - sur->addDmbr(t_float, "orig_area"); - sur->addDmbr(t_float, "neg_area"); - sur->addDmbr(t_float, "neg_orig_area", "amount of original surface in folds"); + addPropCom("Fields being maintained by specialist functions"); + addProp(t_int, "nverticesFrozen", "# of vertices on surface is frozen"); + addProp(t_int, "nvertices", "# of vertices on surface, change by calling MRISreallocVerticesAndFaces et al"); + addProp(t_int, "nfaces", "# of faces on surface, change by calling MRISreallocVerticesAndFaces et al"); + addProp(t_bool, "faceAttachmentDeferred", "defer connecting faces to vertices for performance reasons"); + addProp(t_int, "nedges", "# of edges on surface"); + addProp(t_int, "ncorners", "# of triangle corners"); + addProp(t_int, "nstrips"); + + howPush(new How_MRIS_hidden, new HowPV_MRIS_hidden); + addProp(t_PR_VERTEX_TOPOLOGY, "vertices_topology"); + howMod(new How_MRIS_indexed_vertices, new HowPV_MRIS_indexed_vertices); + addProp(t_PR_VERTEX, "vertices"); + howPop(); + addProp(t_ppVoid, "dist_storage", "the malloced/realloced vertex dist fields, so those fields can be quickly nulled and restored")->setNoHash(); + addProp(t_ppVoid, "dist_orig_storage", "the malloced/realloced vertex dist_orig fields, so those fields can be quickly nulled and restored")->setNoHash(); + addProp(t_int, "tempsAssigned", "State of various temp fields that can be borrowed if not already in use"); + + phaseRbegin = Phase::TopologyM; phaseWbegin = phaseWend = Phase::end; + + howPush(new How_MRIS_indexed_faces, new HowPV_MRIS_indexed_faces); + addProp(t_PR_FACE, "faces"); + howMod(new How_MRIS_indexed_MRI_EDGE, new HowPV_MRIS_indexed_MRI_EDGE); + addProp(t_PR_MRI_EDGE, "edges"); + howMod(new How_MRIS_indexed_MRI_CORNER, new HowPV_MRIS_indexed_MRI_CORNER); + addProp(t_PR_MRI_CORNER, "corners"); + howMod(new How_MRIS_indexed_FaceNormCacheEntry, new HowPV_MRIS_indexed_FaceNormCacheEntry); + addProp(t_PR_FaceNormCacheEntry, "faceNormCacheEntries"); + howMod(new How_MRIS_indexed_FaceNormDeferredEntry, new HowPV_MRIS_indexed_FaceNormDeferredEntry); + addProp(t_PR_FaceNormDeferredEntry, "faceNormDeferredEntries"); + howPop(); + + phaseRbegin = phaseWbegin = Phase::XYZPositionConsequencesM; phaseWend = Phase::end; + howPush(new How_MRIS_indexed_STRIP, new HowPV_MRIS_indexed_STRIP); + addProp(t_PR_STRIP, "strips"); + howPop(); + + phaseRbegin = phaseWbegin = Phase::XYZPositionConsequencesM; phaseWend = Phase::end; + + addProp(t_float, "xctr"); + addProp(t_float, "yctr"); + addProp(t_float, "zctr"); + addProp(t_float, "xlo"); + addProp(t_float, "ylo"); + addProp(t_float, "zlo"); + addProp(t_float, "xhi"); + addProp(t_float, "yhi"); + addProp(t_float, "zhi"); + addProp(t_float, "x0", "center of spherical expansion"); + addProp(t_float, "y0"); + addProp(t_float, "z0"); + + addPropCom("v_temporal_pole, v_frontal_pole, and v_occipital_pole don't appear to be used, and are unusual being pointers to vertices"); + howPush(new How_MRIS_vertex, nullptr); + addProp(t_PVERTEX, "v_temporal_pole"); // WEIRD THAT THESE ARE POINTERS TO VERTICES + addProp(t_PVERTEX, "v_frontal_pole"); + addProp(t_PVERTEX, "v_occipital_pole"); + howPop(); + addPropCom(""); + + addProp(t_float, "max_curv"); + addProp(t_float, "min_curv"); + addProp(t_float, "total_area"); + addProp(t_double, "avg_vertex_area"); + + phaseRbegin = phaseWbegin = Phase::XYZPositionConsequencesM; phaseWend = Phase::XYZPositionConsequencesM; + + addProp(t_double, "avg_vertex_dist", "set by MRIScomputeAvgInterVertexDist"); + addProp(t_double, "std_vertex_dist"); + addProp(t_float, "orig_area"); + addProp(t_float, "neg_area"); + addProp(t_float, "neg_orig_area", "amount of original surface in folds"); - phaseRbegin = phaseWbegin = Phase::XYZPositionConsequencesM; phaseWend = Phase::end; - sur->addDmbr(t_int, "zeros"); - sur->addDmbr(t_int, "hemisphere", "which hemisphere"); + phaseRbegin = phaseWbegin = Phase::XYZPositionConsequencesM; phaseWend = Phase::end; + + addProp(t_int, "zeros"); + addProp(t_int, "hemisphere", "which hemisphere"); - phaseRbegin = Phase::ExistenceM; phaseWbegin = Phase::end; phaseWend = Phase::end; - sur->addDmbr(t_int, "initialized"); - - sur->addDmbrList("LIST_OF_MRIS_ELTS_3"); - - sur->addDmbr(t_PLTA, "lta"); - sur->addDmbr(t_PMATRIX, "SRASToTalSRAS_"); - sur->addDmbr(t_PMATRIX, "TalSRASToSRAS_"); - sur->addDmbr(t_int, "free_transform"); - sur->addDmbr(t_double, "radius", "radius (if status==MRIS_SPHERE)"); - sur->addDmbr(t_float, "a"); - sur->addDmbr(t_float, "b"); - sur->addDmbr(t_float, "c", "ellipsoid parameters"); - - phaseRbegin = phaseWbegin = Phase::ExistenceM; phaseWend = Phase::ExistenceM; - sur->addDmbr(t_MRIS_fname_t, "fname", "file it was originally loaded from"); - - phaseRbegin = phaseWbegin = Phase::XYZPositionConsequencesM; phaseWend = Phase::end; - sur->addDmbr(t_float, "Hmin", "min mean curvature"); - sur->addDmbr(t_float, "Hmax", "max mean curvature"); - sur->addDmbr(t_float, "Kmin", "min Gaussian curvature"); - sur->addDmbr(t_float, "Kmax", "max Gaussian curvature"); - sur->addDmbr(t_double, "Ktotal", "total Gaussian curvature"); - - phaseRbegin = phaseWbegin = Phase::ExistenceM; phaseWend = Phase::ExistenceM; - sur->addDmbr(t_MRIS_Status, "status", "type of surface (e.g. sphere,"" plane)"); - sur->addDmbr(t_MRIS_Status, "origxyz_status", "type of surface (e.g. sphere, plane) that this origxyz were obtained from"); - sur->addDmbr(t_int, "patch", "if a patch of the surface"); - - phaseRbegin = phaseWbegin = Phase::XYZPositionConsequencesM; phaseWend = Phase::end; - sur->addDmbr(t_int, "nlabels"); - sur->addDmbr(t_PMRIS_AREA_LABEL, "labels", "nlabels of these (may be null)"); + phaseRbegin = Phase::ExistenceM; phaseWbegin = Phase::end; phaseWend = Phase::end; + + addProp(t_int, "initialized"); + + addPropList("LIST_OF_MRIS_ELTS_3"); + + addProp(t_PLTA, "lta"); + addProp(t_PMATRIX, "SRASToTalSRAS_"); + addProp(t_PMATRIX, "TalSRASToSRAS_"); + addProp(t_int, "free_transform"); + addProp(t_double, "radius", "radius (if status==MRIS_SPHERE)"); + addProp(t_float, "a"); + addProp(t_float, "b"); + addProp(t_float, "c", "ellipsoid parameters"); + + phaseRbegin = phaseWbegin = Phase::ExistenceM; phaseWend = Phase::ExistenceM; + + addProp(t_MRIS_fname_t, "fname", "file it was originally loaded from"); + + phaseRbegin = phaseWbegin = Phase::XYZPositionConsequencesM; phaseWend = Phase::end; + + addProp(t_float, "Hmin", "min mean curvature"); + addProp(t_float, "Hmax", "max mean curvature"); + addProp(t_float, "Kmin", "min Gaussian curvature"); + addProp(t_float, "Kmax", "max Gaussian curvature"); + addProp(t_double, "Ktotal", "total Gaussian curvature"); + + phaseRbegin = phaseWbegin = Phase::ExistenceM; phaseWend = Phase::ExistenceM; + + addProp(t_MRIS_Status, "status", "type of surface (e.g. sphere,"" plane)"); + addProp(t_MRIS_Status, "origxyz_status", "type of surface (e.g. sphere, plane) that this origxyz were obtained from"); + addProp(t_int, "patch", "if a patch of the surface"); + + phaseRbegin = phaseWbegin = Phase::XYZPositionConsequencesM; phaseWend = Phase::end; + + addProp(t_int, "nlabels"); + addProp(t_PMRIS_AREA_LABEL, "labels", "nlabels of these (may be null)"); - phaseRbegin = phaseWbegin = Phase::end; phaseWend = Phase::end; - sur->addDmbr(t_char, "nsize", "size of neighborhoods or -1"); - sur->addDmbr(t_uchar, "vtotalsMightBeTooBig", "MRISsampleDistances sets this"); - sur->addDmbr(t_short, "nsizeMaxClock", "changed whenever an edge is added or removed, which invalidates the vertex v#num values")->setNoHash(); - sur->addDmbr(t_char, "max_nsize", "max the neighborhood size has been set to (typically 3)"); - sur->addDmbr(t_char, "dist_nsize", "max mrisComputeVertexDistances has computed distances out to"); - sur->addDmbr(t_char, "dist_orig_nsize", "max mrisComputeOriginalVertexDistances has computed distances out to"); - sur->addDmbr(t_char, "dist_alloced_flags", "two flags, set when any dist(1) or dist_orig(2) allocated"); - sur->addDmbr(t_float, "avg_nbrs", "mean # of vertex neighbors"); - - phaseRbegin = phaseWbegin = Phase::XYZPositionM; phaseWend = Phase::end; - sur->addDmbr(t_pVoid, "vp", "for misc. use")->setNoHash(); - sur->addDmbr(t_float, "alpha", "rotation around z-axis"); - sur->addDmbr(t_float, "beta", "rotation around y-axis"); - sur->addDmbr(t_float, "gamma", "rotation around x-axis"); - sur->addDmbr(t_float, "da"); - sur->addDmbr(t_float, "db"); - sur->addDmbr(t_float, "dg", "old deltas"); - sur->addDmbr(t_int, "type", "what type of surface was this initially"); - - phaseRbegin = Phase::ExistenceM; phaseWbegin = Phase::end; phaseWend = Phase::end; - sur->addDmbr(t_int, "max_vertices", "may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces"); - sur->addDmbr(t_int, "max_faces", "may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces"); - - sur->addDmbr(t_MRIS_subject_name_t, "subject_name", "name of the subject"); - sur->addDmbr(t_float, "canon_area"); - sur->addDmbr(t_int, "noscale", "don't scale by surface area if true"); - sur->addDmbr(t_PR_float, "dx2", "an extra set of gradient (not always alloced)"); - sur->addDmbr(t_PR_float, "dy2"); - sur->addDmbr(t_PR_float, "dz2"); - sur->addDmbr(t_PCOLOR_TABLE, "ct"); - sur->addDmbr(t_int, "useRealRAS", "if 0 (default), vertex position is a conformed volume RAS with c_(r,\"a\",\"s\")=0. " - "else is a real RAS (volume stored RAS)"); - sur->addDmbr(t_VOL_GEOM, "vg", "volume info from which this surface is created. valid iff vg.valid = 1"); - sur->addDmbr(t_MRIS_cmdlines_t, "cmdlines")->setNoHash(); - sur->addDmbr(t_int, "ncmds"); - sur->addDmbr(t_float, "group_avg_surface_area", "average of total surface area for group"); - sur->addDmbr(t_int, "group_avg_vtxarea_loaded", "average vertex area for group at each vertex"); - sur->addDmbr(t_int, "triangle_links_removed", "for quad surfaces"); - sur->addDmbr(t_pVoid, "user_parms", "for whatever the user wants to hang here")->setNoHash(); - sur->addDmbr(t_PMATRIX, "m_sras2vox", "for converting surface ras to voxel"); - sur->addDmbr(t_PMRI, "mri_sras2vox", "volume that the above matrix is for"); - sur->addDmbr(t_pVoid, "mht")->setNoHash(); - sur->addDmbr(t_pVoid, "temps")->setNoHash(); - - sur->addDmbrList("LIST_OF_MRIS_ELTS"); - sur->addDmbrListSublist("LIST_OF_MRIS_ELTS_1"); - sur->addDmbrListSublist("LIST_OF_MRIS_ELTS_3"); + phaseRbegin = phaseWbegin = Phase::end; phaseWend = Phase::end; + + addProp(t_char, "nsize", "size of neighborhoods or -1"); + addProp(t_uchar, "vtotalsMightBeTooBig", "MRISsampleDistances sets this"); + addProp(t_short, "nsizeMaxClock", "changed whenever an edge is added or removed, which invalidates the vertex v#num values")->setNoHash(); + addProp(t_char, "max_nsize", "max the neighborhood size has been set to (typically 3)"); + addProp(t_char, "dist_nsize", "max mrisComputeVertexDistances has computed distances out to"); + addProp(t_char, "dist_orig_nsize", "max mrisComputeOriginalVertexDistances has computed distances out to"); + addProp(t_char, "dist_alloced_flags", "two flags, set when any dist(1) or dist_orig(2) allocated"); + addProp(t_float, "avg_nbrs", "mean # of vertex neighbors"); + + phaseRbegin = phaseWbegin = Phase::XYZPositionM; phaseWend = Phase::end; + + addProp(t_pVoid, "vp", "for misc. use")->setNoHash(); + addProp(t_float, "alpha", "rotation around z-axis"); + addProp(t_float, "beta", "rotation around y-axis"); + addProp(t_float, "gamma", "rotation around x-axis"); + addProp(t_float, "da"); + addProp(t_float, "db"); + addProp(t_float, "dg", "old deltas"); + addProp(t_int, "type", "what type of surface was this initially"); + + phaseRbegin = Phase::ExistenceM; phaseWbegin = Phase::end; phaseWend = Phase::end; + + addProp(t_int, "max_vertices", "may be bigger than nvertices, set by calling MRISreallocVerticesAndFaces"); + addProp(t_int, "max_faces", "may be bigger than nfaces, set by calling MRISreallocVerticesAndFaces"); + + addProp(t_MRIS_subject_name_t, "subject_name", "name of the subject"); + addProp(t_float, "canon_area"); + addProp(t_int, "noscale", "don't scale by surface area if true"); + howPush(new How_MRIS_indexed_float, new HowPV_MRIS_indexed_float); + addProp(t_PR_float, "dx2", "an extra set of gradient (not always alloced)"); + addProp(t_PR_float, "dy2"); + addProp(t_PR_float, "dz2"); + howPop(); + addProp(t_PCOLOR_TABLE, "ct"); + addProp(t_int, "useRealRAS", "if 0 (default), vertex position is a conformed volume RAS with c_(r,\"a\",\"s\")=0. " + "else is a real RAS (volume stored RAS)"); + addProp(t_VOL_GEOM, "vg", "volume info from which this surface is created. valid iff vg.valid = 1"); + addProp(t_MRIS_cmdlines_t, "cmdlines")->setNoHash(); + addProp(t_int, "ncmds"); + addProp(t_float, "group_avg_surface_area", "average of total surface area for group"); + addProp(t_int, "group_avg_vtxarea_loaded", "average vertex area for group at each vertex"); + addProp(t_int, "triangle_links_removed", "for quad surfaces"); + addProp(t_pVoid, "user_parms", "for whatever the user wants to hang here")->setNoHash(); + addProp(t_PMATRIX, "m_sras2vox", "for converting surface ras to voxel"); + addProp(t_PMRI, "mri_sras2vox", "volume that the above matrix is for"); + addProp(t_pVoid, "mht")->setNoHash(); + addProp(t_pVoid, "temps")->setNoHash(); + + addPropList("LIST_OF_MRIS_ELTS"); + addPropListSublist("LIST_OF_MRIS_ELTS_1"); + addPropListSublist("LIST_OF_MRIS_ELTS_3"); - Built built; - built.push_back(fac); - built.push_back(vtx); - built.push_back(sur); - return built; + + // rather than polluting the above list with the MRIS_MP information, that is pulled into here... + // + auto rep_MRIS_MP = new RepresentationX("mrisurf_MRIS_MPPropertiesInVectors.h", "MRIS_MP"); + doMRIS_MP(*rep_MRIS, *rep_MRISPV, *rep_MRIS_MP); + + final_representations.clear(); + final_representations.push_back(rep_MRIS); + final_representations.push_back(rep_MRISPV); + final_representations.push_back(rep_MRIS_MP); + } + + static void doMRIS_MP(RepresentationX & rep_MRIS, RepresentationX & rep_MRISPV, RepresentationX & rep_MRIS_MP) + { + + struct PropHowMap : public std::map { + PropHowMap(RepresentationX & r) { + for (auto & ph : r.implements) (*this)[ph.prop->key()] = &ph; + } + } rep_MRISPV_propHowMap(rep_MRISPV); + + enum Action { NotImpl, Stored, FromMRIS }; + std::map actions; + auto insert = [&](const char* id, Action action = Stored) { + actions[id] = action; + }; + { + insert("Surface.status", FromMRIS); + insert("Surface.patch", FromMRIS); + insert("Surface.noscale", FromMRIS); + insert("Surface.origxyz_status"); + insert("Surface.nvertices"); + insert("Surface.vertices"); + insert("Surface.nfaces"); + insert("Surface.faces"); + insert("Surface.faceNormCacheEntries"); + insert("Surface.faceNormDeferredEntries"); + insert("Surface.nsize"); + insert("Surface.radius"); + insert("Surface.faces_topology"); + insert("Surface.dist_nsize"); + insert("Surface.xctr"); + insert("Surface.yctr"); + insert("Surface.zctr"); + insert("Surface.xlo"); + insert("Surface.xhi"); + insert("Surface.ylo"); + insert("Surface.yhi"); + insert("Surface.zlo"); + insert("Surface.zhi"); + insert("Surface.total_area"); + insert("Surface.avg_vertex_area"); + insert("Surface.avg_vertex_dist"); + insert("Surface.std_vertex_dist"); + insert("Surface.orig_area"); + insert("Surface.neg_orig_area"); + insert("Surface.neg_area"); + + insert("Vertex.ripflag"); + insert("Vertex.VSize"); + insert("Vertex.whitex"); + insert("Vertex.whitey"); + insert("Vertex.whitez"); + insert("Vertex.pialx"); + insert("Vertex.pialy"); + insert("Vertex.pialz"); + insert("Vertex.wnx"); + insert("Vertex.wny"); + insert("Vertex.wnz"); + insert("Vertex.dist_orig"); + insert("Vertex.x"); + insert("Vertex.y"); + insert("Vertex.z"); + insert("Vertex.dx"); + insert("Vertex.dy"); + insert("Vertex.dz"); + insert("Vertex.dist_capacity"); + insert("Vertex.border"); + insert("Vertex.cx"); + insert("Vertex.cy"); + insert("Vertex.cz"); + insert("Vertex.curv"); + insert("Vertex.origx"); + insert("Vertex.origy"); + insert("Vertex.origz"); + insert("Vertex.origarea"); + insert("Vertex.fno"); + insert("Vertex.area"); + insert("Vertex.nx"); + insert("Vertex.ny"); + insert("Vertex.nz"); + insert("Vertex.neg"); + insert("Vertex.dist"); + + insert("Face.ripflag"); + insert("Face.v"); + insert("Face.norm_orig_area"); + insert("Face.orig_angle"); + insert("Face.area"); + insert("Face.normSet"); + insert("Face.norm"); + insert("Face.angle"); + } + + auto const how_implementationDetail = new HowDirect(); + how_implementationDetail->m_isImplDetail = true; + + auto implementationDetail = [&]( + string type, string id, string comment) + { + rep_MRIS_MP.implements.push_back( + Representation::PropHow( + new Prop("",new AtomicType(type),id, Phase::end, Phase::ExistenceM,comment), + how_implementationDetail)); + }; + + implementationDetail("MRIS*", "underlyingMRIS", "for properties that are read from the underlying MRIS"); + implementationDetail("MRIS_MP*", "in_src", "since the in are not written, they can be shared by copies"); + implementationDetail("int", "in_ref_count", "check the src doesn't go away"); + implementationDetail("VERTEX_TOPOLOGY const *", "vertices_topology", "pointer copied from MRIS"); + implementationDetail("FACE_TOPOLOGY const *", "faces_topology", "pointer copied from MRIS"); + + implementationDetail("int*", "v_VSize", ""); + implementationDetail("float**", "v_dist_buffer", ""); + implementationDetail("const float*", "f_norm_orig_area", ""); + implementationDetail("char*", "f_normSet", ""); + + for (size_t i = 0; i < rep_MRIS.implements.size(); i++) { + auto & propHow = rep_MRIS.implements[i]; + auto prop = propHow.prop; + auto iPropKey = prop->key(); + auto it = actions.find(iPropKey); + if (it == actions.end()) continue; + + + switch (it->second) { + case NotImpl: + break; + case FromMRIS: + rep_MRIS_MP.implements.push_back(Representation::PropHow(prop, new HowMP_fromMRIS(propHow.how))); + break; + case Stored: { + auto it = rep_MRISPV_propHowMap.find(iPropKey); + assert(it != rep_MRISPV_propHowMap.end()); + auto & pvPropHowImpl = *it->second; + How* how = new HowMP_likePV(pvPropHowImpl.how); + if (iPropKey == "Face.norm") { + std::cout << "Found " << iPropKey << std::endl; + how = new HowMP_FaceNorm; + } + rep_MRIS_MP.implements.push_back(Representation::PropHow(prop, how)); + } break; + } + } } }