• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ MRIsetVoxVal函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MRIsetVoxVal函数的典型用法代码示例。如果您正苦于以下问题:C++ MRIsetVoxVal函数的具体用法?C++ MRIsetVoxVal怎么用?C++ MRIsetVoxVal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了MRIsetVoxVal函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: relabel_hypointensities_neighboring_gray

int
relabel_hypointensities_neighboring_gray(MRI *mri)
{
  int    x, y, z, label, changed, i ;
  MRI    *mri_tmp = NULL ;

  for (changed = i = 0 ; i < 2 ; i++) {
    mri_tmp = MRIcopy(mri, mri_tmp) ;
    for (x = 0 ; x < mri->width ; x++) {
      for (y = 0 ; y < mri->height ; y++) {
        for (z = 0 ; z < mri->depth ; z++) {
          label = MRIgetVoxVal(mri_tmp, x, y, z, 0) ;
          if (label != WM_hypointensities) {
            continue ;
          }
          if (MRIneighbors(mri_tmp, x, y, z, Left_Cerebral_Cortex) > 0) {
            MRIsetVoxVal(mri, x, y, z, 0, Left_Cerebral_Cortex) ;
            changed++ ;
          } else if (MRIneighbors(mri_tmp,x,y,z,Right_Cerebral_Cortex) > 0) {
            MRIsetVoxVal(mri, x, y, z, 0, Right_Cerebral_Cortex) ;
            changed++ ;
          }
        }
      }
    }
  }

  printf("%d hypointense voxels neighboring cortex changed\n", changed) ;
  return(NO_ERROR) ;
}
开发者ID:neurodebian,项目名称:freesurfer,代码行数:30,代码来源:mri_relabel_hypointensities.c


示例2: normalize_timepoints_with_samples

static int
normalize_timepoints_with_samples(MRI *mri, GCA_SAMPLE *gcas, int nsamples, int nsoap)
{
  int   frame, i, x, y, z ;
  double target, val ;
  MRI    *mri_ctrl, *mri_bias, *mri_target, *mri_frame ;

  mri_ctrl = MRIcloneDifferentType(mri, MRI_UCHAR) ;
  mri_bias = MRIcloneDifferentType(mri, MRI_FLOAT) ;
  mri_target = MRIcloneDifferentType(mri, MRI_FLOAT) ;

  for (i = 0 ; i < nsamples ; i++)
  {
    if (i == Gdiag_no)
      DiagBreak() ;
    x = nint(gcas[i].x)  ; y = nint(gcas[i].y) ; z = nint(gcas[i].z) ;
    MRIsetVoxVal(mri_ctrl, x, y, z, 0, CONTROL_MARKED) ;
    for (target = 0.0, frame = 0 ; frame < mri->nframes ; frame++)
      target += MRIgetVoxVal(mri, x, y, z, frame) ;
    target /= mri->nframes ;
    MRIsetVoxVal(mri_target, x, y, z, 0, target) ;
  }

  // build a bias correction for each time point (which each has its own frame)
  for (frame = 0 ; frame < mri->nframes ; frame++)
  {
    MRIclear(mri_bias) ; 
    for (i = 0 ; i < nsamples ; i++)
    {
      if (i == Gdiag_no)
        DiagBreak() ;
      x = nint(gcas[i].x)  ; y = nint(gcas[i].y) ; z = nint(gcas[i].z) ;
      target = MRIgetVoxVal(mri_target, x, y, z, 0) ;
      val = MRIgetVoxVal(mri, x, y, z, frame) ;
      if (FZERO(val))
        val = 1.0 ;
      MRIsetVoxVal(mri_bias, x, y, z, 0, target/val) ;
    }
    MRIbuildVoronoiDiagram(mri_bias, mri_ctrl, mri_bias) ;
    MRIsoapBubble(mri_bias, mri_ctrl, mri_bias, nsoap) ;
    mri_frame = MRIcopyFrame(mri, NULL, frame, 0) ;
    MRImultiply(mri_frame, mri_bias, mri_frame) ;
    if (Gdiag & DIAG_WRITE && DIAG_VERBOSE_ON)
    {
      char fname[STRLEN] ;
      sprintf(fname, "frame%d.mgz", frame) ;
      MRIwrite(mri_frame, fname) ;
      sprintf(fname, "bias%d.mgz", frame) ;
      MRIwrite(mri_bias, fname) ;
      sprintf(fname, "target%d.mgz", frame) ;
      MRIwrite(mri_target, fname) ;
    }
    MRIcopyFrame(mri_frame, mri, 0, frame) ;
  }
  MRIfree(&mri_bias) ; MRIfree(&mri_target) ; MRIfree(&mri_ctrl) ;
  return(NO_ERROR) ;
}
开发者ID:guo2004131,项目名称:freesurfer,代码行数:57,代码来源:mri_cal_normalize.c


示例3: MRIcropVolumeToLabel

MRI *
MRIcropVolumeToLabel(MRI *mri_src, 
                     MRI *mri_dst, 
                     LABEL *area, 
                     MRI_SURFACE *mris_white, 
                     MRI_SURFACE *mris_pial)
{
  MHT    *mht_white, *mht_pial ;
  int    x, y, z ;
  VERTEX *v_white, *v_pial ;
  Real   xs, ys, zs ;

  mht_white = MHTfillVertexTableRes(mris_white, NULL, CURRENT_VERTICES, 5.0) ;
  mht_pial = MHTfillVertexTableRes(mris_pial, NULL, CURRENT_VERTICES, 5.0) ;
  if (mri_dst == NULL)
    mri_dst = MRIclone(mri_src, NULL) ;

  MRISclearMarks(mris_white) ; MRISclearMarks(mris_pial) ;
  LabelMarkSurface(area, mris_white) ; LabelMarkSurface(area, mris_pial) ;
  for (x = 0 ; x < mri_src->width ; x++)
  {
    for (y = 0 ; y < mri_src->height ; y++)
    {
      for (z = 0 ; z < mri_src->depth ; z++)
      {
        if (x == Gx && y == Gy && z == Gz)
          DiagBreak() ;
              
        if (MRIgetVoxVal(mri_src, x, y, z, 0) > 0)
        {
          MRISsurfaceRASFromVoxel(mris_white, mri_dst, 
                                  x, y, z, 
                                  &xs, &ys, &zs) ;
          v_white = MHTfindClosestVertexInTable(mht_white, mris_white, 
                                                xs, ys, zs, 1) ;
          v_pial = MHTfindClosestVertexInTable(mht_pial, mris_pial, 
                                               xs, ys, zs, 1) ;
          if ((v_white && v_white->marked == 1) ||
              (v_pial && v_pial->marked == 1))
          {
            MRIsetVoxVal(mri_dst, x, y, z, 0, 255) ;
          }
          else
            MRIsetVoxVal(mri_dst, x, y, z, 0, 0) ;
        }
      }
    }
  }

  MHTfree(&mht_white) ; MHTfree(&mht_pial) ;
  return(mri_dst) ;
}
开发者ID:ewong718,项目名称:freesurfer,代码行数:52,代码来源:mri_ribbon.c


示例4: normalize_PD

static int
normalize_PD(MRI *mri_PD, float target) {
  double mean_PD, scale, val ;
  int    x, y, z ;

  for (mean_PD = 0.0, x = 0 ; x < mri_PD->width ; x++) {
    for (y = 0 ; y < mri_PD->height ; y++) {
      for (z = 0 ; z < mri_PD->depth ; z++) {
        mean_PD += (double)MRIgetVoxVal(mri_PD, x, y, z,0) ;
      }
    }
  }
  mean_PD /= (mri_PD->width * mri_PD->height * mri_PD->depth) ;
  scale = target / mean_PD ;
  printf("mean PD %2.0f, scaling by %2.2f to set mean to %2.0f\n",
         mean_PD, scale, target) ;
  for (mean_PD = 0.0, x = 0 ; x < mri_PD->width ; x++) {
    for (y = 0 ; y < mri_PD->height ; y++) {
      for (z = 0 ; z < mri_PD->depth ; z++) {
        val = (double)MRIgetVoxVal(mri_PD, x, y, z,0) ;
        val *= scale ;
        MRIsetVoxVal(mri_PD, x, y, z,0, val);
      }
    }
  }
  return(NO_ERROR) ;
}
开发者ID:ewong718,项目名称:freesurfer,代码行数:27,代码来源:mri_synthesize.c


示例5: make_atrophy_map

static MRI *
make_atrophy_map(MRI *mri_time1, MRI *mri_time2, MRI *mri_dst, TRANSFORM *transform1, TRANSFORM *transform2,
                 int *gray_labels, int ngray, int *csf_labels, int ncsf) {
  int            x, y, z, label1, label2, n, found, xp, yp, zp, spacing ;
  GCA_MORPH_NODE *gcamn1, *gcamn2 ;
  GCA_MORPH      *gcam1, *gcam2 ;
  float           volume ;

  if (mri_dst == NULL) {
    mri_dst = MRIalloc(mri_time1->width, mri_time1->height, mri_time1->depth, MRI_FLOAT) ;
    MRIcopyHeader(mri_time1, mri_dst) ;
  }

  gcam1 = (GCA_MORPH*)transform1->xform ;
  gcam2 = (GCA_MORPH*)transform2->xform ;
  spacing = gcam1->spacing ;

  for (x = 0 ; x < mri_time1->width ; x++) {
    xp = x / spacing;
    for (y = 0 ; y < mri_time1->height ; y++) {
      yp = y / spacing;
      for (z = 0 ; z < mri_time1->depth ; z++) {
        if (x == Gx && y == Gy && z == Gz)
          DiagBreak() ;
        label1 = MRIgetVoxVal(mri_time1, x, y, z, 0) ;
        label2 = MRIgetVoxVal(mri_time2, x, y, z, 0) ;
        if (label1 == label2)
          continue ;

        /* if label1 was one of the gray types and label2 one of the csf, call it atrophy */
        for (found = n = 0 ; n < ngray ; n++)
          if (label1 == gray_labels[n]) {
            found = 1 ;
            break ;
          }
        if (found == 0)
          continue ;
        for (found = n = 0 ; n < ncsf ; n++)
          if (label2 == csf_labels[n]) {
            found = 1 ;
            break ;
          }
        if (found == 0)
          continue ;
        zp = z / spacing;
        gcamn1 = &gcam1->nodes[xp][yp][zp] ;
        gcamn2 = &gcam2->nodes[xp][yp][zp] ;
        volume = 0 ;
        if (FZERO(gcamn1->area) == 0)
          volume += gcamn1->orig_area / gcamn1->area ;
        if (FZERO(gcamn2->area) == 0)
          volume += gcamn2->orig_area / gcamn2->area ;
        MRIsetVoxVal(mri_dst, x, y, z, 0, volume) ;
      }
    }
  }


  return(mri_dst) ;
}
开发者ID:guo2004131,项目名称:freesurfer,代码行数:60,代码来源:mri_map_atrophy.c


示例6: MRIclone

/*!
  \fn MRI *RFstat2P(MRI *rf, RFS *rfs, MRI *binmask, int TwoSided, MRI *p)
  \brief Converts a stat to a p value. If TwoSided, then computes a p value
      based on an unsigned stat, but the sign is still passed to p.
*/
MRI *RFstat2P(MRI *rf, RFS *rfs, MRI *binmask, int TwoSided, MRI *p)
{
  int c,r,s,f=0,m;
  double v,pval;

  if (RFname2Code(rfs) == -1) return(NULL);
  p = MRIclone(rf,p);

  for (c=0; c < rf->width; c++)
  {
    for (r=0; r < rf->height; r++)
    {
      for (s=0; s < rf->depth; s++)
      {
        if (binmask != NULL)
        {
          m = (int)MRIgetVoxVal(binmask,c,r,s,0);
          if (!m) continue;
        }
        for (f=0; f < rf->nframes; f++)
        {
          v = MRIgetVoxVal(rf,c,r,s,f);
	  if(TwoSided) pval = SIGN(v)*2*RFstat2PVal(rfs,fabs(v));
	  else         pval = RFstat2PVal(rfs,v);
          MRIsetVoxVal(p,c,r,s,f,pval);
        }
      }
    }
  }
  return(p);
}
开发者ID:vgurev,项目名称:freesurfer,代码行数:36,代码来源:randomfields.c


示例7: MRIcombineDistanceTransforms

MRI *
MRIcombineDistanceTransforms(MRI *mri_src1, MRI *mri_src2, MRI *mri_dst)
{
  int   x, y, z, f ;
  float val1, val2 ;

  if (mri_dst == NULL)
  {
    mri_dst = MRIclone(mri_src1, NULL) ;
  }

  for (f = 0 ; f < mri_dst->nframes ; f++)
    for (x = 0 ; x < mri_dst->width ; x++)
      for (y = 0 ; y < mri_dst->height ; y++)
        for (z = 0 ; z < mri_dst->depth ; z++)
        {
          val1 = MRIgetVoxVal(mri_src1, x, y, z, f) ;
          val2 = MRIgetVoxVal(mri_src2, x, y, z, f) ;
          if (val2 < 0 && val1 > 0)
          {
            val1 = val2 ;  // in the interior of 1
          }
          else if (val2 > 0 && val1 > val2)  // exterior of both, but closer to border of 2
          {
            val1 = val2 ;
          }
          else if (val2 < 0 && val1 < val2)
          {
            val1 = val2 ;  // interior of both, but closer to border of 2
          }

          MRIsetVoxVal(mri_dst, x, y, z, f, val1) ;
        }
  return(mri_dst) ;
}
开发者ID:ewong718,项目名称:freesurfer,代码行数:35,代码来源:mri_normalize.c


示例8: normalize_timepoints_with_parzen_window

static int
normalize_timepoints_with_parzen_window(MRI *mri, double cross_time_sigma)
{
  int   frame1, frame2, x, y, z ;
  double val0, val, total, g, norm, total_norm ;

  norm = 1 / sqrt(2 * M_PI * SQR(cross_time_sigma)) ;
  for (x = 0 ; x < mri->width ; x++)
    for (y = 0 ; y < mri->height ; y++)
      for (z = 0 ; z < mri->depth ; z++)
      {
        if (x == Gx && y == Gy && z == Gz)
          DiagBreak() ;
        for (frame1 = 0 ; frame1 < mri->nframes ; frame1++)
        {
          val0 = MRIgetVoxVal(mri, x, y, z, frame1) ;
          for (total = total_norm = 0.0, frame2 = 0 ; frame2 < mri->nframes ; frame2++)
          {
            val = MRIgetVoxVal(mri, x, y, z, frame2) ;
            g = norm * exp( - SQR(val-val0) / (2 * SQR(cross_time_sigma))) ;
            total += g*val ; 
            total_norm += g ;
          }
          total /= total_norm ;
          MRIsetVoxVal(mri, x, y, z, frame1, total) ;
        }
      }


  return(NO_ERROR) ;
}
开发者ID:ewong718,项目名称:freesurfer,代码行数:31,代码来源:mri_fuse_intensity_images.c


示例9: compute_bias

static MRI *
compute_bias(MRI *mri_src, MRI *mri_dst, MRI *mri_bias)
{
  int x, y, z ;
  float bias, src, dst ;

  if (!mri_bias)
    mri_bias = MRIalloc
               (mri_src->width, mri_src->height, mri_src->depth, MRI_FLOAT) ;

  MRIcopyHeader(mri_src, mri_bias) ;
  for (x = 0 ; x < mri_src->width ; x++)
  {
    for (y = 0; y < mri_src->height ; y++)
    {
      for (z = 0 ; z < mri_src->depth ; z++)
      {
        src = MRIgetVoxVal(mri_src, x, y, z, 0) ;
        dst = MRIgetVoxVal(mri_dst, x, y, z, 0) ;
        if (FZERO(src))
        {
          bias = 1 ;
        }
        else
        {
          bias = dst/src ;
        }
        MRIsetVoxVal(mri_bias, x, y, z, 0, bias) ;
      }
    }
  }

  return(mri_bias) ;
}
开发者ID:ewong718,项目名称:freesurfer,代码行数:34,代码来源:mri_normalize.c


示例10: RFexpectedMeanStddev

/*-------------------------------------------------------------------*/
MRI *RFrescale(MRI *rf, RFS *rfs, MRI *binmask, MRI *rfout)
{
  int c,r,s,f,m;
  double v, gmean, gstddev, gmax;

  if (RFname2Code(rfs) == -1) return(NULL);
  RFexpectedMeanStddev(rfs); // expected
  RFglobalStats(rf, binmask, &gmean, &gstddev, &gmax); //actual

  rfout = MRIclone(rf,rfout);

  for (c=0; c < rf->width; c++)
  {
    for (r=0; r < rf->height; r++)
    {
      for (s=0; s < rf->depth; s++)
      {
        if (binmask != NULL)
        {
          m = (int)MRIgetVoxVal(binmask,c,r,s,0);
          if (!m) continue;
        }
        for (f=0; f < rf->nframes; f++)
        {
          v = MRIgetVoxVal(rf,c,r,s,f);
          v = (v - gmean)*(rfs->stddev/gstddev) + rfs->mean;
          MRIsetVoxVal(rfout,c,r,s,f,v);
        }
      }
    }
  }
  return(rfout);
}
开发者ID:vgurev,项目名称:freesurfer,代码行数:34,代码来源:randomfields.c


示例11: MRIbinarize2

/*-------------------------------------------------------------------------------
  MRIbinarize2() - same as MRIbinarize() but passes theshold, low, and hi as
  doubles instead of UCHARs.
  -------------------------------------------------------------------------------*/
MRI * MRIbinarize2(MRI *mri_src, MRI *mri_dst,
                   double threshold, double low_val, double hi_val) {
  int     width, height, depth, x, y, z, f ;
  double  val;

  if (!mri_dst)  mri_dst = MRIclone(mri_src, NULL) ;

  width = mri_src->width ;
  height = mri_src->height ;
  depth = mri_src->depth ;

  for (f = 0 ; f < mri_src->nframes ; f++) {
    for (z = 0 ; z < depth ; z++) {
      for (y = 0 ; y < height ; y++) {
        for (x = 0 ; x < width ; x++) {
          val = MRIgetVoxVal(mri_src, x, y, z, f);
          if (val > threshold) val = hi_val ;
          else                val = low_val ;
          MRIsetVoxVal(mri_dst, x, y, z, f, val) ;
        }
      }
    }
  }

  return(mri_dst) ;
}
开发者ID:ewong718,项目名称:freesurfer,代码行数:30,代码来源:mri_fwhm.c


示例12: apply_bias_field

static int
apply_bias_field(MRI *mri, int nbias, float *bias_coefs[3][2]) {
  int    x, y, z, n ;
  double xb, yb, zb, x0, y0, z0, w0x, w0y, w0z ;
  float  val ;

  x0 = mri->width/2 ;
  y0 = mri->height/2 ;
  z0 = mri->depth/2 ;
  w0x = 2/x0 ;
  w0y = 2/y0 ;
  w0z = 2/z0 ;
  for (x = 0 ; x < mri->width ; x++) {
    for (xb = 1.0, n=1 ; n <= nbias ; n++)
      xb += bias_coefs[0][0][n-1] * cos(w0x*n*(x-x0)) + bias_coefs[0][1][n-1] * sin(w0x*n*(x-x0)) ;
    for (y = 0 ; y < mri->height ; y++) {
      for (yb = 1.0, n=1 ; n <= nbias ; n++)
        yb += bias_coefs[1][0][n-1] * cos(w0y*n*(y-y0)) + bias_coefs[1][1][n-1] * sin(w0y*n*(y-y0)) ;
      for (z = 0 ; z < mri->depth ; z++) {
        for (zb = 1.0, n=1 ; n <= nbias ; n++)
          zb += bias_coefs[2][0][n-1] * cos(w0z*n*(z-z0)) + bias_coefs[2][1][n-1] * sin(w0z*n*(z-z0)) ;
        val = MRIgetVoxVal(mri, x, y, z, 0) ;
        val = val * xb * yb * zb ;
        MRIsetVoxVal(mri, x, y, z, 0, val) ;
      }
    }
  }

  return(NO_ERROR) ;
}
开发者ID:ewong718,项目名称:freesurfer,代码行数:30,代码来源:mri_synthesize.c


示例13: MRIeraseSmallSegments

int
MRIeraseSmallSegments(MRI_SEGMENTATION *mriseg, MRI *mri_seg, int min_voxels)
{
  int         s, v, nerased = 0, x, y, z ;
  MRI_SEGMENT *mseg ;

  if (DIAG_VERBOSE_ON && 0)
    fprintf(stdout, "compacting segments...\n") ;

  for (s = 0 ; s < mriseg->max_segments ; s++)
  {
    mseg = &mriseg->segments[s] ;
    if (mseg->nvoxels < min_voxels)
    {
      if (mseg->voxels)
	for (v = 0 ; v < mseg->nvoxels ; v++)
	{
	  x = mseg->voxels[v].x ; y = mseg->voxels[v].y ; z = mseg->voxels[v].z ;
	  if (x == Gx && y == Gy && z == Gz)
	    printf("MRIeraseSmallSegments: erasing (%d, %d %d)\n", x, y, z) ;
	  MRIsetVoxVal(mri_seg, x, y, z,0, 0) ;
	  nerased++ ;
	}
    }
  }
  return(nerased) ;
}
开发者ID:ewong718,项目名称:freesurfer,代码行数:27,代码来源:mrisegment.c


示例14: CCSegment

/*!
  \fn int CCSegment(MRI *seg, int segid, int segidunknown)
  Constraints a sementation ID to consist of voxels that
  are spatially contiguous (6 face neighbors, not edge
  or corner). The voxels in the largest cluster are not
  changed. The voxels in the other clusters are set to
  segidunknown.
*/
int CCSegment(MRI *seg, int segid, int segidunknown)
{
    MRI_SEGMENTATION *sgmnt;
    int k,kmax,index,c,r,s;

    sgmnt = MRIsegment(seg,segid-.5,segid+.5);
    printf("  Found %d clusters\n",sgmnt->nsegments);

    kmax = 0;
    for (k=0; k < sgmnt->nsegments; k++)
        if (sgmnt->segments[k].nvoxels > sgmnt->segments[kmax].nvoxels)
        {
            kmax = k;
        }

    for (k=0; k < sgmnt->nsegments; k++)
    {
        printf("     %d k %f\n",k,sgmnt->segments[k].area);
        if (k==kmax)
        {
            continue;
        }
        for (index = 0; index < sgmnt->segments[k].nvoxels; index++)
        {
            c = sgmnt->segments[k].voxels[index].x;
            r = sgmnt->segments[k].voxels[index].y;
            s = sgmnt->segments[k].voxels[index].z;
            MRIsetVoxVal(seg,c,r,s,0,segidunknown);
        }
    }
    MRIsegmentFree(&sgmnt);
    return(0);
}
开发者ID:guo2004131,项目名称:freesurfer,代码行数:41,代码来源:mri_aparc2aseg.c


示例15: RFsynth

/*-------------------------------------------------------------------*/
int RFsynth(MRI *rf, RFS *rfs, MRI *binmask)
{
  int c,r,s,f;
  double v,m;

  if (RFname2Code(rfs) == -1) return(1);

  for (c=0; c < rf->width; c++)
  {
    for (r=0; r < rf->height; r++)
    {
      for (s=0; s < rf->depth; s++)
      {
        if (binmask != NULL)
        {
          m = MRIgetVoxVal(binmask,c,r,s,0);
          if (m < 0.5) continue;
        }
        for (f=0; f < rf->nframes; f++)
        {
          v = RFdrawVal(rfs);
          MRIsetVoxVal(rf,c,r,s,f,v);
        }
      }
    }
  }
  return(0);
}
开发者ID:vgurev,项目名称:freesurfer,代码行数:29,代码来源:randomfields.c


示例16: MRIScomputeDistanceMap

MRI *
MRIScomputeDistanceMap(MRI_SURFACE *mris, MRI *mri_distance, int ref_vertex_no)
{
  int    vno ;
  VERTEX *v ;
  double circumference, angle, distance ;
  VECTOR *v1, *v2 ;

  if (mri_distance == NULL)
    mri_distance = MRIalloc(mris->nvertices, 1, 1, MRI_FLOAT) ;

  v1 = VectorAlloc(3, MATRIX_REAL) ; v2 = VectorAlloc(3, MATRIX_REAL) ;
  v = &mris->vertices[ref_vertex_no] ;
  VECTOR_LOAD(v1, v->x, v->y, v->z) ;  /* radius vector */
  circumference = M_PI * 2.0 * V3_LEN(v1) ;
  for (vno = 0 ; vno < mris->nvertices ; vno++)
  {
    v = &mris->vertices[vno] ;
    if (vno == Gdiag_no)
      DiagBreak() ;
    VECTOR_LOAD(v2, v->x, v->y, v->z) ;  /* radius vector */
    angle = fabs(Vector3Angle(v1, v2)) ;
    distance = circumference * angle / (2.0 * M_PI) ;
    MRIsetVoxVal(mri_distance, vno, 0, 0, 0, distance) ;
  }

  VectorFree(&v1) ; VectorFree(&v2) ;
  return(mri_distance) ;
}
开发者ID:guo2004131,项目名称:freesurfer,代码行数:29,代码来源:mris_distance_map.c


示例17: copy_ctrl_points_to_volume

static int
copy_ctrl_points_to_volume(GCA_SAMPLE *gcas, int nsamples, MRI *mri_ctrl, int frame)
{
  int   i, xv, yv, zv, nregions ;

  nregions = mri_ctrl->nframes/2 ;
  for (i = 0 ; i < nsamples ; i++)
  {
    xv = gcas[i].x ; yv = gcas[i].y ; zv = gcas[i].z ;
    if (xv == Ggca_x && yv == Ggca_y && zv == Ggca_z)
      DiagBreak() ;
    MRIsetVoxVal(mri_ctrl, xv, yv, zv, frame, gcas[i].label) ;
    MRIsetVoxVal(mri_ctrl, xv, yv, zv, frame+nregions, gcas[i].means[0]) ;
  }

  return(NO_ERROR) ;
}
开发者ID:guo2004131,项目名称:freesurfer,代码行数:17,代码来源:mri_cal_normalize.c


示例18: discard_PD

static int
discard_PD(MRI *mri_PD, short thresh, short target) {
  int    x, y, z ;
  double  val ;

  for (x = 0 ; x < mri_PD->width ; x++) {
    for (y = 0 ; y < mri_PD->height ; y++) {
      for (z = 0 ; z < mri_PD->depth ; z++) {
        val = MRIgetVoxVal(mri_PD, x, y, z,0) ;
        if (val > thresh)
          MRIsetVoxVal(mri_PD, x, y, z,0, target);
        else
          MRIsetVoxVal(mri_PD, x, y, z,0,0);
      }
    }
  }
  return(NO_ERROR) ;
}
开发者ID:ewong718,项目名称:freesurfer,代码行数:18,代码来源:mri_synthesize.c


示例19: MRIsetVoxVal

/*--------------------------------------------------------------------------*/
static void PutVertical
(
  MRI *mri_vol,      /* output image volume */
  long x,            /* x coordinate of the selected line */
  long y,            /* y coordinate of the selected line */
  double Line[]     /* output linear array */
) { /* begin PutVertical */
  long z;
  for (z = 0L; z < mri_vol->depth; z++) {
    MRIsetVoxVal(mri_vol, x, y, z, 0, (float)Line[z]);
  }
  return;
} /* end PutVertical */
开发者ID:guo2004131,项目名称:freesurfer,代码行数:14,代码来源:mri_transform_to_COR.c


示例20: MRIsynthesizeWithFAF

static MRI *
MRIsynthesizeWithFAF(MRI *mri_T1, MRI *mri_PD, MRI *mri_dst, double TR, double alpha, double TE, int nfaf,
                     float *faf_coefs[3][2]) {
  int   x, y, z, width, height, depth, n ;
  Real flash, T1, PD ;
  double xb, yb, zb, x0, y0, z0, w0x, w0y, w0z ;

  x0 = mri_T1->width/2 ;
  y0 = mri_T1->height/2 ;
  z0 = mri_PD->depth/2 ;
  w0x = 2/x0 ;
  w0y = 2/y0 ;
  w0z = 2/z0 ;

  if (!mri_dst)
    mri_dst = MRIclone(mri_T1, NULL) ;

  mri_dst->tr = TR ;
  mri_dst->flip_angle = alpha ;
  mri_dst->te = TE ;
  mri_dst->ti = 0 ;
  width = mri_T1->width ;
  height = mri_T1->height ;
  depth = mri_T1->depth ;
  for (x = 0 ; x < width ; x++) {
    for (xb = 1.0, n=1 ; n <= nfaf ; n++)
      xb += faf_coefs[0][0][n-1] * cos(w0x*n*(x-x0)) + faf_coefs[0][1][n-1] * sin(w0x*n*(x-x0)) ;
    for (y = 0 ; y < height ; y++) {
      for (yb = 1.0, n=1 ; n <= nfaf ; n++)
        yb += faf_coefs[1][0][n-1] * cos(w0y*n*(y-y0)) + faf_coefs[1][1][n-1] * sin(w0y*n*(y-y0)) ;
      for (z = 0 ; z < depth ; z++) {
        for (zb = 1.0, n=1 ; n <= nfaf ; n++)
          zb += faf_coefs[2][0][n-1] * cos(w0z*n*(z-z0)) + faf_coefs[2][1][n-1] * sin(w0z*n*(z-z0)) ;
        if (x == Gx && y == Gy && z == Gz)
          DiagBreak() ;
        MRIsampleVolume(mri_T1, x, y, z, &T1) ;
        if (T1 <= 0)
          T1 = 1 ;
        if (T1 < 900 && T1 > 600)
          DiagBreak() ;
        MRIsampleVolume(mri_PD, x, y, z, &PD) ;
        flash = FLASHforwardModel(T1, PD, TR, xb*yb*zb*alpha, TE) ;
        MRIsetVoxVal(mri_dst, x, y, z, 0, flash) ;
      }
    }
  }

  return(mri_dst) ;
}
开发者ID:ewong718,项目名称:freesurfer,代码行数:49,代码来源:mri_synthesize.c



注:本文中的MRIsetVoxVal函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MRP_UNUSED函数代码示例发布时间:2022-05-30
下一篇:
C++ MRIgetVoxVal函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap