663 for (
int i = 0 ; i < 6 ; i ++ ) {
1017 for (
int i = 0 ; i < 2 ; i ++ )
1018 for (
int j = 0 ; j < 2 ; j ++ )
1019 for (
int k = 0 ; k < 2 ; k ++ ) {
1020 if (
getDataAt( ox + i, oy + j, oz + k ) < 0 ) {
1033 for ( i = 0 ; i <
getSizeX() ; i ++ )
1034 for ( j = 0 ; j <
getSizeY() ; j ++ )
1035 for ( k = 0 ; k <
getSizeZ() ; k ++ )
1041 for (
int m = 0 ; m < 6 ; m ++ )
1178 int edge[6] = { 0,0,0,0,0,0 } ;
1179 int faceflag[ 12 ] ;
1184 for ( i = -1 ; i < 1 ; i ++ )
1185 for ( j = -1 ; j < 1 ; j ++ )
1186 for ( k = -1 ; k < 1 ; k ++ )
1188 if (
hasCell( ox + i, oy + j, oz + k ) )
1190 cellflag[ ct ] = 1 ;
1194 cellflag[ ct ] = 0 ;
1199 for ( i = 0 ; i < 12 ; i ++ )
1202 for ( j = 0 ; j < 4 ; j ++ )
1215 if ( faceflag[ i ] )
1220 ox - 1 + ((
faceCells[i][0] >> 2 ) & 1 ),
1221 oy - 1 + ((
faceCells[i][0] >> 1 ) & 1 ),
1224 ox - 1 + ((
faceCells[i][1] >> 2 ) & 1 ),
1225 oy - 1 + ((
faceCells[i][1] >> 1 ) & 1 ),
1227 if ( ((v1 >> (2 * (2 - i/4))) & 1) ||
1228 ((v2 >> (2 * (2 - i/4) + 1 )) & 1) )
1235 if ( faceflag[ i ] )
1246 for ( i = 0 ; i < 6 ; i ++ )
1248 if ( edge[ i ] == 1 )
1253 while( numones > 0 )
1256 for ( i = 0 ; i < 6 ; i ++ )
1258 if ( edge[ i ] == 1 )
1272 for ( j = 0 ; j < 4 ; j ++ )
1275 if ( faceflag[ f ] )
1304 if ( edge[ e2 ] == 1 )
1308 else if ( edge[ e2 ] == 0 )
1464 for ( i = 0 ; i < 6 ; i ++ )
1520 for ( i = 0 ; i < 6 ; i ++ )
1534 int val = (int)fvol->
getDataAt( nx, ny, nz) ;
1535 if ( (( val >> ( 2 * ( i / 2 ) ) ) & 1) == 0 )
1582 int c1 = 0 , c2 = 0 ;
1585 for ( i = 0 ; i < 6 ; i ++ )
1596 if ( val > 0 && val < MAX_ERODE && nvol->
getDataAt( nx, ny, nz ) == 0 )
1604 if ( c1 == 1 && c2 == 1 )
1792 int c1 = 0 , c2 = 0 ;
1795 for ( i = 0 ; i < 6 ; i ++ )
1814 if ( c1 == 1 && c2 == 1 )
1827 int edge[6] = { 0,0,0,0,0,0 } ;
1828 int faceflag[ 12 ] ;
1829 int hasFeatureFace = 0 ;
1832 for ( i = 0 ; i < 12 ; i ++ )
1835 int hasFeature = 1 ;
1837 for ( j = 0 ; j < 4 ; j ++ )
1853 if ( faceflag[ i ] == 1 && hasFeature )
1859 if ( faceflag[ i ] )
1868 if ( tot == 0 || hasFeatureFace == 0 )
1875 for ( i = 0 ; i < 6 ; i ++ )
1877 if ( edge[ i ] == 1 )
1882 while( numones > 0 )
1885 for ( i = 0 ; i < 6 ; i ++ )
1887 if ( edge[ i ] == 1 )
1901 for ( j = 0 ; j < 4 ; j ++ )
1904 if ( faceflag[ f ] )
1933 if ( edge[ e2 ] == 1 )
1937 else if ( edge[ e2 ] == 0 )
2143 for ( i = 0 ; i < 12 ; i ++ )
2146 for ( j = 0 ; j < 4 ; j ++ )
2169 if ( ct == -1 || ct >= 1 )
2320 double vox[3][3][3] ;
2323 for ( i = -1 ; i < 2 ; i ++ )
2324 for ( j = -1 ; j < 2 ; j ++ )
2325 for ( k = -1 ; k < 2 ; k ++ )
2327 double tval =
getDataAt( ox + i, oy + j, oz + k ) ;
2344 vox[ i + 1 ][ j + 1 ][ k + 1 ] = tval ;
2385 double vox[3][3][3] ;
2388 for ( i = -1 ; i < 2 ; i ++ )
2389 for ( j = -1 ; j < 2 ; j ++ )
2390 for ( k = -1 ; k < 2 ; k ++ )
2392 double tval =
getDataAt( ox + i, oy + j, oz + k ) ;
2409 vox[ i + 1 ][ j + 1 ][ k + 1 ] = tval ;
2564 int rvalue = 0, nx, ny, nz ;
2585 for ( i = 0 ; i < 6 ; i ++ )
2704 int head = 0, tail = 1 ;
2706 for ( i = 0 ; i < 3 ; i ++ )
2707 for ( j = 0 ; j < 3 ; j ++ )
2708 for ( k = 0 ; k < 3 ; k ++ )
2730 while ( head != tail )
2732 int x = queue[head][0] ;
2733 int y = queue[head][1] ;
2734 int z = queue[head][2] ;
2737 for ( i = 0 ; i < 6 ; i ++ )
2742 if ( nx >=0 && nx < 3 && ny >=0 && ny < 3 && nz >=0 && nz < 3 )
2744 if ( vox[nx][ny][nz] && ! vis[nx][ny][nz] )
2746 queue[tail][0] = nx ;
2747 queue[tail][1] = ny ;
2748 queue[tail][2] = nz ;
2750 vis[nx][ny][nz] = 1 ;
2773 int head = 0, tail = 1 ;
2775 for ( i = 0 ; i < 3 ; i ++ )
2776 for ( j = 0 ; j < 3 ; j ++ )
2777 for ( k = 0 ; k < 3 ; k ++ )
2798 while ( head != tail )
2800 int x = queue[head][0] ;
2801 int y = queue[head][1] ;
2802 int z = queue[head][2] ;
2805 for ( i = -1 ; i < 2 ; i ++ )
2806 for ( j = -1 ; j < 2 ; j ++ )
2807 for ( k = -1 ; k < 2 ; k ++ )
2812 if ( nx >=0 && nx < 3 && ny >=0 && ny < 3 && nz >=0 && nz < 3 )
2814 if ( vox[nx][ny][nz] && ! vis[nx][ny][nz] )
2816 queue[tail][0] = nx ;
2817 queue[tail][1] = ny ;
2818 queue[tail][2] = nz ;
2820 vis[nx][ny][nz] = 1 ;
2842 for (
int i = 0 ; i < 3 ; i ++ )
2843 for (
int j = 0 ; j < 3 ; j ++ )
2844 for (
int k = 0 ; k < 3 ; k ++ )
2846 if ( vox[i][j][k] < 0 )
2864 for ( i = 0 ; i < 3 ; i ++ )
2865 for ( j = 0 ; j < 3 ; j ++ )
2866 for ( k = 0 ; k < 3 ; k ++ )
2871 for ( i = 0 ; i < 6 ; i ++ )
2876 if ( vox[ nx ][ ny ][ nz ] >= 0 )
2878 tvox[ nx ][ ny ][ nz ] = 1 ;
2879 for ( j = 0 ; j < 4 ; j ++ )
2884 if ( vox[ nnx ][ nny ][ nnz ] >= 0 )
2886 tvox[ nnx ][ nny ][ nnz ] = 1 ;
2897 int nv = 0 , ne = 0, nc = 0 ;
2901 double vox[3][3][3] ;
2903 for ( i = 0 ; i < 3 ; i ++ )
2904 for ( j = 0 ; j < 3 ; j ++ )
2905 for ( k = 0 ; k < 3 ; k ++ )
2907 vox[i][j][k] =
getDataAt( ox - 1 + i, oy - 1 + j, oz - 1 + k ) ;
2911 for ( i = 0 ; i < 6 ; i ++ )
2916 if ( vox[nx][ny][nz] >= 0 )
2918 tvox[ nx ][ ny ][ nz ] = 1 ;
2922 for ( j = 0 ; j < 4 ; j ++ )
2927 if ( vox[nnx][nny][nnz] >= 0 )
2929 if ( tvox[nnx][nny][nnz] == 0 )
2931 tvox[nnx][nny][nnz] = 1 ;
2943 return ( nc - ( nv - ne ) ) ;
3817 printf(
"Thresholding the volume to -1/0...\n") ;
3826 printf(
"Initializing queue...\n") ;
3833 for ( i = 0 ; i <
getSizeX() ; i ++ )
3834 for ( j = 0 ; j <
getSizeY() ; j ++ )
3835 for ( k = 0 ; k <
getSizeZ() ; k ++ )
3839 float v = (float)grayvol->
getDataAt(i,j,k) ;
3840 if ( v <= lowthr || v > highthr || svol->
getDataAt(i,j,k) > 0 )
3846 for (
int m = 0 ; m < 6 ; m ++ )
3861 printf(
"Start erosion to %d...\n", wid) ;
3876 #ifdef NOISE_DIS_HELIX
3880 for (
int curwid = 1 ; curwid <= wid ; curwid ++ )
3886 int numComplex = 0, numSimple = 0 ;
3888 printf(
"Processing %d nodes in layer %d\n", queue2->
getNumElements(), curwid) ;
3896 while ( ele != NULL )
3914 while ( ele != NULL )
3926 #ifdef NOISE_DIS_HELIX
3932 while ( ( ele = queue2->
getNext() ) != NULL )
3937 if ( NOISE_DIS_HELIX <= 1 )
3944 for (
int m = 0 ; m < 6 ; m ++ )
3964 for ( cur = 1 ; cur < NOISE_DIS_HELIX ; cur ++ )
3970 while ( ( ele = queue2->
getNext() ) != NULL )
3976 if ( noisevol->
getDataAt( ox, oy, oz ) == 1 )
3983 for (
int m = 0 ; m < 6 ; m ++ )
4003 printf(
"Maximum feature distance: %d Un-touched: %d\n", cur, queue2->
getNumElements() - visited ) ;
4046 while ( ele != NULL )
4054 scrvol->
setDataAt( ox, oy, oz, score ) ;
4062 queue->
add( gp, score ) ;
4078 queue->
remove( gp, score ) ;
4088 if (
getDataAt( ox, oy, oz ) != curwid || (
int) scrvol->
getDataAt( ox, oy, oz ) != score )
4103 #ifndef NOISE_DIS_HELIX
4112 queue4->
prepend( ox, oy, oz ) ;
4123 for (
int m = 0 ; m < 6 ; m ++ )
4131 queue2->
prepend( nx, ny, nz ) ;
4171 for ( i = -2 ; i < 3 ;i ++ )
4172 for ( j = -2 ; j < 3 ; j ++ )
4173 for ( k = -2 ; k < 3 ; k ++ )
4179 if (
getDataAt( nx, ny, nz ) == curwid )
4184 if ( score != (
int) scrvol->
getDataAt( nx, ny, nz ) )
4187 scrvol->
setDataAt( nx, ny, nz, score ) ;
4194 queue->
add( gp, score ) ;
4203 printf(
"%d complex, %d simple\n", numComplex, numSimple) ;
4206 if ( numSimple == 0 )
4210 printf(
"*************************wierd here*************************\n");
4220 while ( ele != NULL )
4234 for ( i = 0 ; i <
getSizeX() ; i ++ )
4235 for ( j = 0 ; j <
getSizeY() ; j ++ )
4236 for ( k = 0 ; k <
getSizeZ() ; k ++ )
4245 while ( ele != NULL )
4262 printf(
"Thresholding the volume to 0/1...\n") ;
4273 printf(
"Thresholding the volume to -1/0...\n") ;
4282 printf(
"Initializing queue...\n") ;
4289 for ( i = 0 ; i <
getSizeX() ; i ++ )
4290 for ( j = 0 ; j <
getSizeY() ; j ++ )
4291 for ( k = 0 ; k <
getSizeZ() ; k ++ )
4301 for (
int m = 0 ; m < 6 ; m ++ )
4317 printf(
"Start erosion to %d...\n", wid) ;
4332 #ifdef NOISE_DIS_HELIX
4336 for (
int curwid = 1 ; curwid <= wid ; curwid ++ )
4342 int numComplex = 0, numSimple = 0 ;
4344 printf(
"Processing %d nodes in layer %d\n", queue2->
getNumElements(), curwid) ;
4352 while ( ele != NULL )
4370 while ( ele != NULL )
4382 #ifdef NOISE_DIS_HELIX
4388 while ( ( ele = queue2->
getNext() ) != NULL )
4393 if ( NOISE_DIS_HELIX <= 1 )
4400 for (
int m = 0 ; m < 6 ; m ++ )
4420 for ( cur = 1 ; cur < NOISE_DIS_HELIX ; cur ++ )
4426 while ( ( ele = queue2->
getNext() ) != NULL )
4432 if ( noisevol->
getDataAt( ox, oy, oz ) == 1 )
4439 for (
int m = 0 ; m < 6 ; m ++ )
4459 printf(
"Maximum feature distance: %d Un-touched: %d\n", cur, queue2->
getNumElements() - visited ) ;
4502 while ( ele != NULL )
4510 scrvol->
setDataAt( ox, oy, oz, score ) ;
4518 queue->
add( gp, score ) ;
4534 queue->
remove( gp, score ) ;
4544 if (
getDataAt( ox, oy, oz ) != curwid || (
int) scrvol->
getDataAt( ox, oy, oz ) != score )
4559 #ifndef NOISE_DIS_HELIX
4568 queue4->
prepend( ox, oy, oz ) ;
4579 for (
int m = 0 ; m < 6 ; m ++ )
4587 queue2->
prepend( nx, ny, nz ) ;
4624 for ( i = -2 ; i < 3 ;i ++ )
4625 for ( j = -2 ; j < 3 ; j ++ )
4626 for ( k = -2 ; k < 3 ; k ++ )
4632 if (
getDataAt( nx, ny, nz ) == curwid )
4637 if ( score != (
int) scrvol->
getDataAt( nx, ny, nz ) )
4640 scrvol->
setDataAt( nx, ny, nz, score ) ;
4647 queue->
add( gp, score ) ;
4656 printf(
"%d complex, %d simple\n", numComplex, numSimple) ;
4659 if ( numSimple == 0 )
4672 printf(
"Thresholding the volume to 0/1...\n") ;
4683 printf(
"Thresholding the volume to -1/0...\n") ;
4692 printf(
"Initializing queue...\n") ;
4699 for ( i = 0 ; i <
getSizeX() ; i ++ )
4700 for ( j = 0 ; j <
getSizeY() ; j ++ )
4701 for ( k = 0 ; k <
getSizeZ() ; k ++ )
4711 for (
int m = 0 ; m < 4 ; m ++ )
4726 printf(
"Start erosion to %d...\n", wid) ;
4741 #ifdef NOISE_DIS_HELIX
4745 for (
int curwid = 1 ; curwid <= wid ; curwid ++ )
4751 int numComplex = 0, numSimple = 0 ;
4753 printf(
"Processing %d nodes in layer %d\n", queue2->
getNumElements(), curwid) ;
4761 while ( ele != NULL )
4779 while ( ele != NULL )
4791 #ifdef NOISE_DIS_HELIX
4797 while ( ( ele = queue2->
getNext() ) != NULL )
4802 if ( NOISE_DIS_HELIX <= 1 )
4809 for (
int m = 0 ; m < 6 ; m ++ )
4829 for ( cur = 1 ; cur < NOISE_DIS_HELIX ; cur ++ )
4835 while ( ( ele = queue2->
getNext() ) != NULL )
4841 if ( noisevol->
getDataAt( ox, oy, oz ) == 1 )
4848 for (
int m = 0 ; m < 6 ; m ++ )
4868 printf(
"Maximum feature distance: %d Un-touched: %d\n", cur, queue2->
getNumElements() - visited ) ;
4911 while ( ele != NULL )
4920 scrvol->
setDataAt( ox, oy, oz, score ) ;
4928 queue->
add( gp, score ) ;
4944 queue->
remove( gp, score ) ;
4954 if (
getDataAt( ox, oy, oz ) != curwid || (
int) scrvol->
getDataAt( ox, oy, oz ) != score )
4969 #ifndef NOISE_DIS_HELIX
4978 queue4->
prepend( ox, oy, oz ) ;
4989 for (
int m = 0 ; m < 4 ; m ++ )
4997 queue2->
prepend( nx, ny, nz ) ;
5034 for ( i = -2 ; i < 3 ;i ++ )
5035 for ( j = -2 ; j < 3 ; j ++ )
5036 for ( k = -2 ; k < 3 ; k ++ )
5042 if (
getDataAt( nx, ny, nz ) == curwid )
5048 if ( score != (
int) scrvol->
getDataAt( nx, ny, nz ) )
5051 scrvol->
setDataAt( nx, ny, nz, score ) ;
5058 queue->
add( gp, score ) ;
5067 printf(
"%d complex, %d simple\n", numComplex, numSimple) ;
5070 if ( numSimple == 0 )
5078 printf(
"Thresholding the volume to 0/1...\n") ;
5094 printf(
"Thresholding the volume to -1/0...\n") ;
5103 printf(
"Initializing queue...\n") ;
5108 for ( i = 0 ; i <
getSizeX() ; i ++ )
5109 for ( j = 0 ; j <
getSizeY() ; j ++ )
5110 for ( k = 0 ; k <
getSizeZ() ; k ++ )
5115 for (
int m = 0 ; m < 6 ; m ++ )
5130 printf(
"Start erosion to %d...\n", wid) ;
5145 int numComplex = 0, numSimple = 0 ;
5147 printf(
"Processing %d nodes in layer %d\n", queue2->
getNumElements(), wid) ;
5160 while ( ele != NULL )
5171 queue2->
prepend( ox, oy, oz ) ;
5188 for (
int m = 0 ; m < 6 ; m ++ )
5196 queue2->
prepend( nx, ny, nz ) ;
5205 printf(
"Level %d: %d complex, %d simple\n", wid, numComplex, numSimple) ;
5208 if ( numSimple == 0 )
5218 printf(
"Thresholding the volume to 0/1...\n") ;
5697 printf(
"Thresholding the volume to -1/0...\n") ;
5706 printf(
"Initializing queue...\n") ;
5712 for ( i = 0 ; i <
getSizeX() ; i ++ )
5713 for ( j = 0 ; j <
getSizeY() ; j ++ )
5714 for ( k = 0 ; k <
getSizeZ() ; k ++ )
5724 for (
int m = 0 ; m < 6 ; m ++ )
5742 printf(
"Start erosion to %d...\n", wid) ;
5755 for (
int curwid = 1 ; curwid <= wid ; curwid ++ )
5761 int numComplex = 0, numSimple = 0 ;
5763 printf(
"Processing %d nodes in layer %d\n", queue2->
getNumElements(), curwid) ;
5772 while ( ele != NULL )
5780 scrvol->
setDataAt( ox, oy, oz, score ) ;
5788 queue->
add( gp, score ) ;
5804 queue->
remove( gp, score ) ;
5814 if (
getDataAt( ox, oy, oz ) != curwid || (
int) scrvol->
getDataAt( ox, oy, oz ) != score )
5825 queue2->
prepend( ox, oy, oz ) ;
5836 for (
int m = 0 ; m < 6 ; m ++ )
5844 queue2->
prepend( nx, ny, nz ) ;
5851 for ( i = -2 ; i < 3 ;i ++ )
5852 for ( j = -2 ; j < 3 ; j ++ )
5853 for ( k = -2 ; k < 3 ; k ++ )
5859 if (
getDataAt( nx, ny, nz ) == curwid )
5864 if ( score != (
int) scrvol->
getDataAt( nx, ny, nz ) )
5867 scrvol->
setDataAt( nx, ny, nz, score ) ;
5874 queue->
add( gp, score ) ;
5883 printf(
"%d complex, %d simple\n", numComplex, numSimple) ;
5886 if ( numSimple == 0 )
5895 printf(
"Thresholding the volume to 0/1...\n") ;
5929 for ( i = 0 ; i <
getSizeX() ; i ++ )
5930 for ( j = 0 ; j <
getSizeY() ; j ++ )
5931 for ( k = 0 ; k <
getSizeZ() ; k ++ )
5955 while( ( ele = queue2->
getNext() ) != NULL )
5958 queues[ -dis ]->
prepend( ele->
x, ele->
y, ele->
z ) ;
5965 while ( ele != NULL )
5967 for (
int m = 0 ; m < 6 ; m ++ )
5980 queue3->
prepend( nx, ny, nz ) ;
5998 printf(
"Detecting closed rings %d...", dis) ;
6001 for ( i = 0 ; i <
getSizeX() ; i ++ )
6002 for ( j = 0 ; j <
getSizeY() ; j ++ )
6003 for ( k = 0 ; k <
getSizeZ() ; k ++ )
6008 queues[ -dis ]->
prepend( i, j, k ) ;
6025 printf(
"%d nodes\n", ftot) ;
6073 if ( disthr + 2 > - dis )
6075 disthr = - dis - 2 ;
6079 for ( d = - dis ; d > disthr + 1 ; d -- )
6081 queues[ d ]->
reset() ;
6082 while ( (ele = queues[ d ]->getNext() ) != NULL )
6089 for ( d = disthr + 1 ; d >= 2 ; d -- )
6093 queues[ d ]->
reset() ;
6094 ele = queues[ d ]->
getNext() ;
6095 while ( ele != NULL )
6098 for (
int m = 0 ; m < 6 ; m ++ )
6120 queues[ d - 1 ]->
prepend( ele->
x, ele->
y, ele->
z ) ;
6122 ele = queues[ d ]->
remove() ;
6127 ele = queues[ d ]->
getNext() ;
6136 queues[ d ]->
reset() ;
6137 ele = queues[ d ]->
getNext() ;
6138 while ( ele != NULL )
6143 for ( i = -1 ; i < 2 ; i ++ )
6145 for ( j = -1 ; j < 2 ; j ++ )
6147 for ( k = -1 ; k < 2 ; k ++ )
6149 if ( i != 0 && j != 0 && k != 0 )
6153 int nx = ele->
x + i ;
6154 int ny = ele->
y + j ;
6155 int nz = ele->
z + k ;
6176 ele = queues[ d ]->
getNext() ;
6183 queues[ d - 1 ]->
prepend( ele->
x, ele->
y, ele->
z ) ;
6185 ele = queues[ d ]->
remove() ;
6192 printf(
"Non-minimal: %d\n", num) ;
6224 for ( d = -dis ; d >= 2 ; d -- ) {
6258 for ( i = 0 ; i <
getSizeX() ; i ++ )
6259 for ( j = 0 ; j <
getSizeY() ; j ++ )
6260 for ( k = 0 ; k <
getSizeZ() ; k ++ )
6286 while( ( ele = queue2->
getNext() ) != NULL )
6289 queues[ -dis ]->
prepend( ele->
x, ele->
y, ele->
z ) ;
6296 while ( ele != NULL )
6299 for (
int mx = -1 ; mx < 2 ; mx ++ )
6300 for (
int my = -1 ; my < 2 ; my ++ )
6301 for (
int mz = -1 ; mz < 2 ; mz ++ )
6303 if ( mx != 0 && my != 0 && mz != 0 )
6310 int nx = ele->
x + mx ;
6311 int ny = ele->
y + my ;
6312 int nz = ele->
z + mz ;
6322 queue3->
prepend( nx, ny, nz ) ;
6341 printf(
"Detecting closed rings %d...", dis) ;
6344 for ( i = 0 ; i <
getSizeX() ; i ++ )
6345 for ( j = 0 ; j <
getSizeY() ; j ++ )
6346 for ( k = 0 ; k <
getSizeZ() ; k ++ )
6364 queues[ -dis ]->
prepend( i, j, k ) ;
6370 printf(
"%d nodes\n", ftot) ;
6418 if ( disthr + 2 > - dis )
6420 disthr = - dis - 2 ;
6423 for ( d = - dis ; d > disthr + 1 ; d -- )
6425 queues[ d ]->
reset() ;
6426 while ( (ele = queues[ d ]->getNext() ) != NULL )
6432 for (d = disthr + 1 ; d >= 2 ; d -- )
6437 queues[ d ]->
reset() ;
6438 ele = queues[ d ]->
getNext() ;
6439 while ( ele != NULL )
6461 for ( i = 0 ; i < 12 ; i ++ )
6463 int flag = 1, flag2 = 0 ;
6464 for ( j = 0 ; j < 4 ; j ++ )
6472 if ( val > - d && val < 0)
6483 if ( flag && flag2 )
6498 queues[ d - 1 ]->
prepend( ele->
x, ele->
y, ele->
z ) ;
6500 ele = queues[ d ]->
remove() ;
6505 ele = queues[ d ]->
getNext() ;
6513 queues[ d ]->
reset() ;
6514 ele = queues[ d ]->
getNext() ;
6515 while ( ele != NULL )
6520 for ( i = -1 ; i < 2 ; i ++ )
6522 for ( j = -1 ; j < 2 ; j ++ )
6524 for ( k = -1 ; k < 2 ; k ++ )
6526 if ( i != 0 && j != 0 && k != 0 )
6530 int nx = ele->
x + i ;
6531 int ny = ele->
y + j ;
6532 int nz = ele->
z + k ;
6554 ele = queues[ d ]->
getNext() ;
6561 queues[ d - 1 ]->
prepend( ele->
x, ele->
y, ele->
z ) ;
6563 ele = queues[ d ]->
remove() ;
6569 printf(
"Non-minimal: %d\n", num) ;
6604 for (d = -dis ; d >= 2 ; d -- ) {
8677 printf(
"Thresholding the volume to -MAX_ERODE/0...\n") ;
8683 printf(
"Initializing queue...\n") ;
8691 for ( i = 0 ; i <
getSizeX() ; i ++ )
8692 for ( j = 0 ; j <
getSizeY() ; j ++ )
8693 for ( k = 0 ; k <
getSizeZ() ; k ++ )
8699 for (
int m = 0 ; m < 6 ; m ++ )
8714 printf(
"Start erosion to %d...\n", wid) ;
8729 #ifdef NOISE_DIS_SHEET
8733 for (
int curwid = 1 ; curwid <= wid ; curwid ++ )
8739 int numComplex = 0, numSimple = 0 ;
8741 printf(
"Processing %d nodes in layer %d\n", queue2->
getNumElements(), curwid) ;
8749 while ( ele != NULL )
8767 while ( ele != NULL )
8779 #ifdef NOISE_DIS_SHEET
8785 while ( ( ele = queue2->
getNext() ) != NULL )
8790 if ( NOISE_DIS_SHEET <= 1 )
8797 for (
int m = 0 ; m < 6 ; m ++ )
8816 for (
int cur = 1 ; cur < NOISE_DIS_SHEET ; cur ++ )
8821 while ( ( ele = queue2->
getNext() ) != NULL )
8827 if ( noisevol->
getDataAt( ox, oy, oz ) == 1 )
8833 for (
int m = 0 ; m < 6 ; m ++ )
8896 while ( ele != NULL )
8904 scrvol->
setDataAt( ox, oy, oz, score ) ;
8912 queue->
add( gp, score ) ;
8929 queue->
remove( gp, score ) ;
8940 if (
getDataAt( ox, oy, oz ) != curwid || (
int) scrvol->
getDataAt( ox, oy, oz ) != score )
8955 #ifndef NOISE_DIS_SHEET
8967 queue4->
prepend( ox, oy, oz ) ;
8980 for (
int m = 0 ; m < 6 ; m ++ )
8988 queue2->
prepend( nx, ny, nz ) ;
9025 for ( i = -2 ; i < 3 ;i ++ )
9026 for ( j = -2 ; j < 3 ; j ++ )
9027 for ( k = -2 ; k < 3 ; k ++ )
9033 if (
getDataAt( nx, ny, nz ) == curwid )
9038 if ( score != (
int) scrvol->
getDataAt( nx, ny, nz ) )
9041 scrvol->
setDataAt( nx, ny, nz, score ) ;
9048 queue->
add( gp, score ) ;
9057 printf(
"%d complex, %d simple\n", numComplex, numSimple) ;
9060 if ( numSimple == 0 )
9068 printf(
"Thresholding the volume to 0/1...\n") ;
9527 threshold(thr, out, in, boundary,
true);
9533 for (
int i = 0 ; i <
getSizeX() ; i ++ )
9534 for (
int j = 0 ; j <
getSizeY() ; j ++ )
9535 for (
int k = 0 ; k <
getSizeZ() ; k ++ )
EMData stores an image's data and defines core image processing routines.
Template class for a priority queue.
void remove(ValueT *&v, KeyT &k)
Remove an element.
void add(ValueT *v, KeyT k)
Add an element.
bool isEmpty()
Test whether empty.
void prepend(int xx, int yy, int zz)
void SetOrigin(float originX, float originY, float originZ)
void SetSpacing(float spacingX, float spacingY, float spacingZ)
void Pad(int padBy, double padValue)
void SetDataAt(int x, int y, int z, float value)
float GetDataAt(int x, int y, int z)
int GetIndex(int x, int y, int z)
void skeleton(float thr, int off)
int components6(int vox[3][3][3])
int isHelixEnd(int ox, int oy, int oz, Volume *nvol)
void setOrigin(float orgX, float orgY, float orgZ)
int isSimple(int ox, int oy, int oz)
int countInt(double vox[3][3][3])
int getIndex(int x, int y, int z)
int hasCell(int ox, int oy, int oz)
int countIntEuler(int ox, int oy, int oz)
int isPiercable(int ox, int oy, int oz)
void pad(int padBy, double padValue)
int isSheetEnd(int ox, int oy, int oz, Volume *nvol)
int getNumPotComplex(int ox, int oy, int oz)
int hasCompleteHelix(int ox, int oy, int oz)
void curveSkeleton(Volume *grayvol, float lowthr, float highthr, Volume *svol)
insert them back into priority queue
int components26(int vox[3][3][3])
void surfaceSkeletonPres(float thr, Volume *preserve)
for ( int m = 0 ; m < 6 ; m ++ )
int countExt(double vox[3][3][3])
int getNumPotComplex2(int ox, int oy, int oz)
int hasCompleteSheet(int ox, int oy, int oz, Volume *fvol)
int isFeatureFace(int ox, int oy, int oz)
void curveSkeleton2D(float thr, Volume *svol)
void threshold(double thr)
double getDataAt(int x, int y, int z)
void setSpacing(float spx, float spy, float spz)
int getNumNeighbor6(int ox, int oy, int oz)
void setDataAt(int x, int y, int z, double d)
VolumeData * getVolumeData()
const int neighbor64[6][4][3]
const int neighbor6[6][3]
const int edgeFaces[6][4]
const int faceCells[12][2]
const int sheetNeighbor[12][4][3]
const int faceEdges[12][2]
const int neighbor4[4][2]