Doxygen Source Code Documentation
r_new_resam_dset.c File Reference
#include "mrilib.h"#include "r_misc.h"#include "r_new_resam_dset.h"Go to the source code of this file.
Defines | |
| #define | LR_RESAM_IN_FAIL -1 |
| #define | LR_RESAM_IN_NONE 0 |
| #define | LR_RESAM_IN_REORIENT 1 |
| #define | LR_RESAM_IN_RESAM 2 |
Functions | |
| int | apply_dataxes (THD_3dim_dataset *dset, THD_dataxes *dax) |
| int | apply_orientation (THD_3dim_dataset *dset, FD_brick *fdb, char orient[]) |
| int | valid_resam_inputs (THD_3dim_dataset *, THD_3dim_dataset *, double, double, double, char[], int) |
| THD_3dim_dataset * | r_new_resam_dset (THD_3dim_dataset *din, THD_3dim_dataset *min, double dx, double dy, double dz, char orient[], int resam, int *sublist) |
| int | r_fill_resampled_data_brick (THD_3dim_dataset *dset, int resam) |
| int | r_dxyz_mod_dataxes (double dx, double dy, double dz, THD_dataxes *daxin, THD_dataxes *daxout) |
| Boolean | r_is_valid_orient_str (char ostr[]) |
| int | r_orient_str2vec (char ostr[], THD_ivec3 *ovec) |
Variables | |
| char * | this_file = "r_new_resam_dset.c" |
Define Documentation
|
|
Definition at line 45 of file r_new_resam_dset.c. Referenced by r_new_resam_dset(), and valid_resam_inputs(). |
|
|
Definition at line 46 of file r_new_resam_dset.c. Referenced by valid_resam_inputs(). |
|
|
Definition at line 47 of file r_new_resam_dset.c. Referenced by r_new_resam_dset(), and valid_resam_inputs(). |
|
|
Definition at line 48 of file r_new_resam_dset.c. Referenced by r_new_resam_dset(), and valid_resam_inputs(). |
Function Documentation
|
||||||||||||
|
Definition at line 597 of file r_new_resam_dset.c. References ADN_none, ADN_nxyz, ADN_xyzdel, ADN_xyzorg, THD_3dim_dataset::daxes, EDIT_dset_items(), LOAD_FVEC3, LOAD_IVEC3, THD_dataxes::nxx, THD_dataxes::nyy, THD_dataxes::nzz, THD_3dim_dataset::wod_daxes, THD_dataxes::xxdel, THD_dataxes::xxorg, THD_dataxes::yydel, THD_dataxes::yyorg, THD_dataxes::zzdel, and THD_dataxes::zzorg. Referenced by r_new_resam_dset().
00598 {
00599 THD_ivec3 ivnxyz;
00600 THD_fvec3 fvdel, fvorg;
00601
00602 LOAD_IVEC3( ivnxyz, dax->nxx, dax->nyy, dax->nzz );
00603 LOAD_FVEC3( fvorg, dax->xxorg, dax->yyorg, dax->zzorg );
00604 LOAD_FVEC3( fvdel, dax->xxdel, dax->yydel, dax->zzdel );
00605
00606 EDIT_dset_items( dset,
00607 ADN_nxyz, ivnxyz,
00608 ADN_xyzdel, fvdel,
00609 ADN_xyzorg, fvorg,
00610 ADN_none );
00611
00612 /* prepare the dataset for warping */
00613 *dset->wod_daxes = *dax; /* used for actual warp */
00614 *dset->daxes = *dax;
00615
00616 return 0;
00617 }
|
|
||||||||||||||||
|
Definition at line 547 of file r_new_resam_dset.c. References FD_brick::a123, a2, abs, ADN_none, ADN_nxyz, ADN_xyzdel, ADN_xyzorg, ADN_xyzorient, THD_3dim_dataset::daxes, FD_brick::del1, FD_brick::del2, FD_brick::del3, EDIT_dset_items(), THD_ivec3::ijk, LOAD_FVEC3, LOAD_IVEC3, FD_brick::n1, FD_brick::n2, FD_brick::n3, r_orient_str2vec(), THD_dataxes::xxdel, THD_dataxes::xxorg, THD_dataxes::yydel, THD_dataxes::yyorg, THD_dataxes::zzdel, and THD_dataxes::zzorg. Referenced by r_new_resam_dset().
00549 {
00550 THD_dataxes * daxp = dset->daxes;
00551 THD_ivec3 ivnxyz, ivorient;
00552 THD_fvec3 fvdel, fvorg;
00553 float org4[4], del4[4];
00554 int aa1, aa2, aa3;
00555 int a1, a2, a3;
00556 int ret_val;
00557
00558 LOAD_IVEC3(ivnxyz, fdb->n1, fdb->n2, fdb->n3);
00559
00560 if ( (ret_val = r_orient_str2vec(orient, &ivorient)) != 0 )
00561 return ret_val;
00562
00563 LOAD_FVEC3( fvdel,
00564 ORIENT_sign[ivorient.ijk[0]]=='+' ? fdb->del1 : -fdb->del1,
00565 ORIENT_sign[ivorient.ijk[1]]=='+' ? fdb->del2 : -fdb->del2,
00566 ORIENT_sign[ivorient.ijk[2]]=='+' ? fdb->del3 : -fdb->del3 );
00567
00568 /* use original org and delta with permuted index to get new orgs */
00569 org4[1] = daxp->xxorg; org4[2] = daxp->yyorg; org4[3] = daxp->zzorg;
00570 del4[1] = daxp->xxdel; del4[2] = daxp->yydel; del4[3] = daxp->zzdel;
00571
00572 a1 = fdb->a123.ijk[0]; a2 = fdb->a123.ijk[1]; a3 = fdb->a123.ijk[2];
00573 aa1 = abs(a1); aa2 = abs(a2); aa3 = abs(a3);
00574
00575 LOAD_FVEC3( fvorg,
00576 (a1 > 0) ? org4[aa1] : org4[aa1]+(fdb->n1-1)*del4[aa1],
00577 (a2 > 0) ? org4[aa2] : org4[aa2]+(fdb->n2-1)*del4[aa2],
00578 (a3 > 0) ? org4[aa3] : org4[aa3]+(fdb->n3-1)*del4[aa3] );
00579
00580 /* now update the current brick with our new orientation data */
00581 EDIT_dset_items( dset,
00582 ADN_nxyz, ivnxyz,
00583 ADN_xyzdel, fvdel,
00584 ADN_xyzorg, fvorg,
00585 ADN_xyzorient, ivorient,
00586 ADN_none );
00587 return 0;
00588 }
|
|
||||||||||||||||||||||||
|
Definition at line 298 of file r_new_resam_dset.c. References ISVALID_DATAXES, THD_dataxes::nxx, THD_dataxes::nyy, THD_dataxes::nzz, THD_dataxes::xxdel, THD_dataxes::xxmax, THD_dataxes::xxmin, THD_dataxes::xxorg, THD_dataxes::yydel, THD_dataxes::yymax, THD_dataxes::yymin, THD_dataxes::yyorg, THD_dataxes::zzdel, THD_dataxes::zzmax, THD_dataxes::zzmin, and THD_dataxes::zzorg. Referenced by r_new_resam_dset().
00301 {
00302 double rex, rey, rez;
00303 double lxx, lyy, lzz;
00304 int ret_val;
00305
00306 if ( ! ISVALID_DATAXES( daxin ) || ! ISVALID_DATAXES( daxout ) )
00307 return -1;
00308
00309 *daxout = *daxin; /* start with a copy */
00310
00311 if ( dx <= 0.0 || dy <= 0.0 || dz <= 0.0 )
00312 return -1; /* having duplicated the structures */
00313
00314 rex = (daxout->xxdel > 0) ? dx : -dx; /* signed voxel sizes */
00315 rey = (daxout->yydel > 0) ? dy : -dy;
00316 rez = (daxout->zzdel > 0) ? dz : -dz;
00317
00318 lxx = daxin->nxx * daxin->xxdel; /* signed lengths of data box */
00319 lyy = daxin->nyy * daxin->yydel;
00320 lzz = daxin->nzz * daxin->zzdel;
00321
00322 daxout->nxx = (int)( lxx/rex + 0.499 ); /* so this is > 0 */
00323 daxout->nyy = (int)( lyy/rey + 0.499 );
00324 daxout->nzz = (int)( lzz/rez + 0.499 );
00325
00326 /* go from old edge to old center, then back out to new edge */
00327 daxout->xxorg = daxin->xxorg + 0.5*(lxx - daxin->xxdel)
00328 - 0.5*(daxout->nxx - 1)*rex;
00329
00330 daxout->yyorg = daxin->yyorg + 0.5*(lyy - daxin->yydel)
00331 - 0.5*(daxout->nyy - 1)*rey;
00332
00333 daxout->zzorg = daxin->zzorg + 0.5*(lzz - daxin->zzdel)
00334 - 0.5*(daxout->nzz - 1)*rez;
00335
00336 /* dave new dimensions */
00337 daxout->xxdel = rex;
00338 daxout->yydel = rey;
00339 daxout->zzdel = rez;
00340
00341 /* create a new bounding box */
00342 /* (note that xxdel<0 implies we must swap min/max) */
00343 daxout->xxmin = daxout->xxorg;
00344 daxout->xxmax = daxout->xxorg + (daxout->nxx-1)*daxout->xxdel;
00345 if ( daxout->xxmin > daxout->xxmax )
00346 {
00347 double tmp = daxout->xxmin;
00348 daxout->xxmin = daxout->xxmax;
00349 daxout->xxmax = tmp;
00350 }
00351
00352 daxout->yymin = daxout->yyorg;
00353 daxout->yymax = daxout->yyorg + (daxout->nyy-1)*daxout->yydel;
00354 if ( daxout->yymin > daxout->yymax )
00355 {
00356 double tmp = daxout->yymin;
00357 daxout->yymin = daxout->yymax;
00358 daxout->yymax = tmp;
00359 }
00360
00361 daxout->zzmin = daxout->zzorg;
00362 daxout->zzmax = daxout->zzorg + (daxout->nzz-1)*daxout->zzdel;
00363 if ( daxout->zzmin > daxout->zzmax )
00364 {
00365 double tmp = daxout->zzmin;
00366 daxout->zzmin = daxout->zzmax;
00367 daxout->zzmax = tmp;
00368 }
00369
00370 #ifdef EXTEND_BBOX
00371 daxout->xxmin -= 0.5 * daxout->xxdel;
00372 daxout->xxmax += 0.5 * daxout->xxdel;
00373 daxout->yymin -= 0.5 * daxout->yydel;
00374 daxout->yymax += 0.5 * daxout->yydel;
00375 daxout->zzmin -= 0.5 * daxout->zzdel;
00376 daxout->zzmax += 0.5 * daxout->zzdel;
00377 #endif
00378
00379 return ret_val = 0;
00380 }
|
|
||||||||||||
|
Definition at line 205 of file r_new_resam_dset.c. References ADDTO_KILL, AFNI_dataset_slice(), THD_diskptr::byte_order, DATABLOCK_MEM_MALLOC, THD_3dim_dataset::daxes, THD_3dim_dataset::dblk, DBLK_BRICK_FACTOR, THD_datablock::diskptr, dptr, DSET_BRICK_TYPE, DSET_LOADED, DSET_lock, EDIT_substitute_brick(), FAIL, free, IDENTITY_WARP, THD_3dim_dataset::kl, malloc, THD_datablock::malloc_type, mri_data_pointer(), mri_datum_size(), mri_free(), mri_short_order(), myXtNew, THD_diskptr::nvals, THD_dataxes::nxx, THD_dataxes::nyy, nz, THD_dataxes::nzz, STORAGE_BY_BRICK, THD_diskptr::storage_mode, THD_load_statistics(), this_file, THD_3dim_dataset::warp, and THD_3dim_dataset::wod_flag. Referenced by r_new_resam_dset().
00206 {
00207 THD_diskptr * diskptr = dset->dblk->diskptr;
00208 MRI_IMAGE * im;
00209 char * newdata, * dptr;
00210 float bfac;
00211 int ival, dsize;
00212 int nx, ny, nz, nxy, nxyz, nv;
00213 int slice;
00214
00215 if ( DSET_LOADED(dset) )
00216 {
00217 fprintf( stderr, "error <%s>: trying to fill pre-loaded dataset\n",
00218 this_file );
00219 return FAIL;
00220 }
00221
00222 DSET_lock(dset); /* since it will just sit in memory for now */
00223
00224 /* a basic warp is needed if header is written out - PLUTO_add_dset() */
00225 dset->warp = myXtNew( THD_warp );
00226 *dset->warp = IDENTITY_WARP;
00227 ADDTO_KILL( dset->kl, dset->warp );
00228
00229 diskptr->byte_order = mri_short_order();
00230 diskptr->storage_mode = STORAGE_BY_BRICK;
00231
00232 /* note new dimensions */
00233 nx = dset->daxes->nxx; ny = dset->daxes->nyy; nz = dset->daxes->nzz;
00234 nv = diskptr->nvals;
00235
00236 nxy = nx * ny;
00237 nxyz = nx * ny * nz;
00238
00239 /* recompute sub-bricks */
00240 for ( ival = 0; ival < nv; ival++ ) /* for each sub-brick */
00241 {
00242 /* first create memory to deposit the slices into */
00243 dsize = mri_datum_size( DSET_BRICK_TYPE(dset, ival) );
00244
00245 if ( (newdata = (char *)malloc( nxyz * dsize )) == NULL )
00246 {
00247 fprintf( stderr, "r frdb: alloc failure: %d bytes!\n",
00248 nxyz * dsize );
00249 return FAIL;
00250 }
00251
00252 dptr = newdata; /* we will copy images at dptr */
00253
00254 /* force return of unscaled slices for output - reset fac at end */
00255 bfac = DBLK_BRICK_FACTOR(dset->dblk,ival);
00256 DBLK_BRICK_FACTOR(dset->dblk,ival) = 0.0;
00257
00258 /* for each slice, insert it into memory */
00259 for ( slice = 0; slice < nz; slice++)
00260 {
00261 im = AFNI_dataset_slice( dset, 3, slice, ival, resam );
00262 if ( im == NULL )
00263 {
00264 fprintf( stderr, "r_fill_resampled_data_brick: failure to "
00265 "compute dataset slice %d\n", slice );
00266 free( newdata );
00267 return FAIL;
00268 }
00269
00270 memcpy( (void *)dptr, mri_data_pointer(im), nxy*dsize );
00271 mri_free( im );
00272 dptr += nxy*dsize;
00273 }
00274
00275 DBLK_BRICK_FACTOR(dset->dblk,ival) = bfac;
00276 /* we now have the raw brick data, so insert it into the brick */
00277 EDIT_substitute_brick(dset, ival, DSET_BRICK_TYPE(dset,ival),
00278 (void *)newdata);
00279 }
00280
00281 dset->dblk->malloc_type = DATABLOCK_MEM_MALLOC;
00282 dset->wod_flag = False; /* since data is now in memory */
00283
00284 /* recompute statistics */
00285 THD_load_statistics( dset );
00286
00287 return 0; /* OK */
00288 }
|
|
|
Definition at line 389 of file r_new_resam_dset.c. Referenced by valid_resam_inputs().
00390 {
00391 int o1, o2, o3;
00392
00393 if ( ostr == NULL )
00394 return False;
00395
00396 o1 = ORCODE(toupper(ostr[0]));
00397 o2 = ORCODE(toupper(ostr[1]));
00398 o3 = ORCODE(toupper(ostr[2]));
00399
00400 if ( ( o1 != ILLEGAL_TYPE ) &&
00401 ( o2 != ILLEGAL_TYPE ) &&
00402 ( o3 != ILLEGAL_TYPE ) &&
00403 OR3OK(o1,o2,o3) )
00404 return True;
00405 else
00406 return False;
00407 }
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 74 of file r_new_resam_dset.c. References ADN_none, ADN_prefix, apply_dataxes(), apply_orientation(), DATAXES_TYPE, THD_3dim_dataset::daxes, THD_3dim_dataset::dblk, THD_datablock::diskptr, DSET_delete, EDIT_dset_items(), EDIT_empty_copy(), THD_3dim_dataset::idcode, ISVALID_3DIM_DATASET, LR_RESAM_IN_FAIL, LR_RESAM_IN_REORIENT, LR_RESAM_IN_RESAM, THD_dataxes::parent, r_dxyz_mod_dataxes(), r_fill_resampled_data_brick(), THD_copy_dset_subs(), THD_delete_3dim_dataset(), THD_init_diskptr_names(), THD_oriented_brick(), this_file, THD_dataxes::type, THD_warp::type, valid_resam_inputs(), THD_3dim_dataset::view_type, THD_3dim_dataset::vox_warp, THD_3dim_dataset::warp_parent, THD_3dim_dataset::warp_parent_idcode, THD_3dim_dataset::wod_daxes, and THD_3dim_dataset::wod_flag. Referenced by main(), RCREND_reload_dataset(), and RCREND_reload_func_dset().
00084 {
00085 THD_3dim_dataset * dout;
00086 THD_3dim_dataset * dtmp;
00087 THD_dataxes new_daxes;
00088 FD_brick * fdb = NULL;
00089 int work;
00090 char * l_orient, l_orient_s[4] = "";
00091
00092 /* if we have a master, do not rely on orient - use local memory */
00093 if ( min ) l_orient = l_orient_s;
00094 else l_orient = orient;
00095
00096 work = valid_resam_inputs( din, min, dx, dy, dz, l_orient, resam );
00097
00098 if ( work == LR_RESAM_IN_FAIL )
00099 return NULL;
00100
00101 if ( sublist )
00102 dtmp = THD_copy_dset_subs(din, sublist);
00103 else
00104 dtmp = din;
00105
00106 dout = EDIT_empty_copy( dtmp ); /* create new brick */
00107 if( ! ISVALID_3DIM_DATASET( dout ) )
00108 {
00109 fprintf( stderr, "ERROR: <%s> - failed to duplicate datset at %p\n",
00110 this_file, din );
00111 return NULL;
00112 }
00113
00114 /* give junk name */
00115 EDIT_dset_items(dout, ADN_prefix, "junk_resample", ADN_none );
00116
00117 /* possibly update view type to that of the master */
00118 if ( min &&
00119 (dout->view_type != min->view_type) &&
00120 (dout->dblk && dout->dblk->diskptr) )
00121 {
00122 dout->view_type = min->view_type;
00123 THD_init_diskptr_names( dout->dblk->diskptr, NULL, NULL, NULL,
00124 min->view_type, True );
00125 }
00126
00127
00128 /* re-orient the brick? */
00129 if ( work & LR_RESAM_IN_REORIENT )
00130 {
00131 if ( ( fdb = THD_oriented_brick( dout, l_orient ) ) == NULL )
00132 {
00133 fprintf( stderr, "<%s>: failed to create THD_brick with orient "
00134 "string <%.6s>\n", this_file, l_orient );
00135 THD_delete_3dim_dataset( dout, FALSE );
00136 return NULL;
00137 }
00138
00139 if ( apply_orientation( dout, fdb, l_orient ) != 0 )
00140 {
00141 THD_delete_3dim_dataset( dout, FALSE );
00142 return NULL;
00143 }
00144 }
00145
00146 new_daxes = *dout->daxes; /* in case we don't resample */
00147
00148 /* resample the brick? */
00149 if ( work & LR_RESAM_IN_RESAM )
00150 {
00151 /*-- given dx, dy and dz, create a new THD_dataxes structure ---- */
00152 new_daxes.type = DATAXES_TYPE;
00153
00154 /* fill new_daxes, from the master, new dxyz, or both */
00155 if ( min && dx == 0.0 ) new_daxes = *min->daxes;
00156 else
00157 {
00158 /* possibly start with master (must have master's orient) */
00159 if ( min ) *dout->daxes = *min->daxes;
00160
00161 if ( r_dxyz_mod_dataxes(dx, dy, dz, dout->daxes, &new_daxes) != 0 )
00162 {
00163 THD_delete_3dim_dataset( dout, FALSE );
00164 return NULL;
00165 }
00166 }
00167
00168 if ( apply_dataxes( dout, &new_daxes ) != 0 )
00169 {
00170 THD_delete_3dim_dataset( dout, FALSE );
00171 return NULL;
00172 }
00173 }
00174
00175 /* needed by THD_load_datablock() */
00176 dout->warp_parent = dtmp;
00177 dout->warp_parent_idcode = dtmp->idcode; /* needed for HEAD write */
00178
00179 /* needed to warp from parent */
00180 dout->wod_flag = True; /* mark for WOD */
00181 dout->vox_warp->type = ILLEGAL_TYPE; /* mark fo recomputation */
00182 *dout->wod_daxes = new_daxes; /* used for actual warp */
00183
00184 dout->daxes->parent = (XtPointer)dout; /* parent is new dset */
00185
00186 if ( r_fill_resampled_data_brick( dout, resam ) != 0 )
00187 {
00188 THD_delete_3dim_dataset( dout, FALSE );
00189 dout = NULL;
00190 }
00191
00192 if ( sublist ) DSET_delete(dtmp);
00193
00194 return dout;
00195 }
|
|
||||||||||||
|
Definition at line 416 of file r_new_resam_dset.c. References THD_ivec3::ijk, OR3OK, ORCODE, and this_file. Referenced by apply_orientation().
00417 {
00418 int o1, o2, o3;
00419
00420 if ( !ostr || !ovec )
00421 {
00422 fprintf( stderr, "%s: r_orient_str2vec - invalid parameter pair "
00423 "(%p,%p)\n", this_file, ostr, ovec );
00424 return -1;
00425 }
00426
00427 ovec->ijk[0] = o1 = ORCODE(toupper(ostr[0]));
00428 ovec->ijk[1] = o2 = ORCODE(toupper(ostr[1]));
00429 ovec->ijk[2] = o3 = ORCODE(toupper(ostr[2]));
00430
00431 if ( ( o1 == ILLEGAL_TYPE ) ||
00432 ( o2 == ILLEGAL_TYPE ) ||
00433 ( o3 == ILLEGAL_TYPE ) ||
00434 ( !OR3OK(o1,o2,o3) ) )
00435 {
00436 fprintf( stderr, "%s: r_orient_str2vec - bad ostr <%.4s>\n",
00437 this_file, ostr );
00438 return -2;
00439 }
00440
00441 return 0;
00442 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 456 of file r_new_resam_dset.c. References THD_3dim_dataset::daxes, ISVALID_3DIM_DATASET, ISVALID_DATAXES, LAST_RESAM_TYPE, LR_RESAM_IN_FAIL, LR_RESAM_IN_NONE, LR_RESAM_IN_REORIENT, LR_RESAM_IN_RESAM, r_is_valid_orient_str(), this_file, THD_dataxes::xxorient, THD_dataxes::yyorient, and THD_dataxes::zzorient. Referenced by r_new_resam_dset().
00459 {
00460 int ret_val = LR_RESAM_IN_NONE;
00461
00462 if( ! ISVALID_3DIM_DATASET(dset) )
00463 {
00464 fprintf( stderr, "ERROR: <%s> - invalid input dataset\n", this_file );
00465 return LR_RESAM_IN_FAIL;
00466 }
00467
00468 /* validate the resampling mode - this is required in any case */
00469 if ( resam < 0 || resam > LAST_RESAM_TYPE )
00470 {
00471 fprintf( stderr, "ERROR: <%s> - invalid resample mode of %d\n",
00472 this_file, resam );
00473 return LR_RESAM_IN_FAIL;
00474 }
00475
00476 if( mset ) /* behold, the master! */
00477 {
00478 /* validate mset and its thd_dataxes structure */
00479 if ( ! ISVALID_3DIM_DATASET(mset) || !ISVALID_DATAXES(mset->daxes) )
00480 {
00481 fprintf( stderr, "ERROR: <%s> - invalid master dataset\n",
00482 this_file );
00483 return LR_RESAM_IN_FAIL;
00484 }
00485
00486 /* we should have orientation memory with a master */
00487 if ( ! orient )
00488 {
00489 fprintf( stderr, "ERROR: <%s> - orientation memory should "
00490 "come with master\n", this_file );
00491 return LR_RESAM_IN_FAIL;
00492 }
00493
00494 /* we have a master - get orientation now, dxyz will come later */
00495 orient[0] = ORIENT_typestr[mset->daxes->xxorient][0];
00496 orient[1] = ORIENT_typestr[mset->daxes->yyorient][0];
00497 orient[2] = ORIENT_typestr[mset->daxes->zzorient][0];
00498 orient[3] = '\0';
00499
00500 /* validate any new dxyz */
00501 if ( dx != 0.0 && (dx < 0.0 || dy <= 0.0 || dz <= 0.0) )
00502 {
00503 fprintf( stderr, "ERROR: <%s> - invalid (dx,dy,dz) = (%f,%f,%f)\n",
00504 this_file, dx, dy, dz );
00505 return LR_RESAM_IN_FAIL;
00506 }
00507
00508 return LR_RESAM_IN_RESAM | LR_RESAM_IN_REORIENT; /* we're good to go */
00509 }
00510
00511 /* so no master dataset, validate dxyz and orientation */
00512
00513 /* validate resampling */
00514 if ( dx == 0.0 && dy == 0.0 && dz == 0.0 ) /* no resampling */
00515 ret_val &= ~LR_RESAM_IN_RESAM;
00516 else if ( dx <= 0.0 || dy <= 0.0 || dz <= 0.0 )
00517 {
00518 fprintf( stderr, "ERROR: <%s> - invalid (dx,dy,dz) = (%f,%f,%f)\n",
00519 this_file, dx, dy, dz );
00520 return LR_RESAM_IN_FAIL;
00521 }
00522 else
00523 ret_val |= LR_RESAM_IN_RESAM;
00524
00525 /* validate orientation */
00526 if ( orient == NULL )
00527 ret_val &= ~LR_RESAM_IN_REORIENT;
00528 else if ( r_is_valid_orient_str ( orient ) == False )
00529 {
00530 fprintf( stderr, "ERROR: <%s> - invalid orientation string <%.6s>\n",
00531 this_file, orient );
00532 return LR_RESAM_IN_FAIL;
00533 }
00534 else
00535 ret_val |= LR_RESAM_IN_REORIENT;
00536
00537 return ret_val;
00538 }
|
Variable Documentation
|
|
Definition at line 50 of file r_new_resam_dset.c. Referenced by r_fill_resampled_data_brick(), r_new_resam_dset(), r_orient_str2vec(), and valid_resam_inputs(). |