src/conv/vdicom/vdicom.cpp
// there's a shift, make the coordinates consistant
there's a shift, make the coordinates consistant
there ' s a shift make the coordinates consistant
void FixMosaicImgPositionError( i2o_dcm* dcm, int slice, vector<double>& v3d )
{
  int    cols                   = dcm->Cols();
  int    rows                   = dcm->Rows();
  int    totalCols              = dcm->TotalCols();
  int    totalRows              = dcm->TotalRows();
  double voxHeight              = dcm->VoxelHeight();
  double voxWidth               = dcm->VoxelWidth();
  double spacing                = dcm->SliceSpacing();
  const vector<double>& vecRow  = dcm->ImgOrientRow();
  const vector<double>& vecCol  = dcm->ImgOrientCol();
  const vector<double>& vecNorm = dcm->ImgOrientNormal();
  const vector<double>& imgPos  = dcm->ImgPosition();
  double f_c = cols * voxWidth  * ( 0.5 * totalCols / cols  - 0.5 );
  double f_r = rows * voxHeight * ( 0.5 * totalRows / rows - 0.5 );
  v3d[0] = imgPos[0] + f_c * vecRow[0] + f_r * vecCol[0] + slice * spacing * vecNorm[0];
  v3d[1] = imgPos[1] + f_c * vecRow[1] + f_r * vecCol[1] + slice * spacing * vecNorm[1];
  v3d[2] = imgPos[2] + f_c * vecRow[2] + f_r * vecCol[2] + slice * spacing * vecNorm[2];
}
void FixMosaicImgPositionError ( i2o_dcm * dcm , int slice , vector < double > & v3d ) { int cols = dcm -> Cols ( ) ; int rows = dcm -> Rows ( ) ; int totalCols = dcm -> TotalCols ( ) ; int totalRows = dcm -> TotalRows ( ) ; double voxHeight = dcm -> VoxelHeight ( ) ; double voxWidth = dcm -> VoxelWidth ( ) ; double spacing = dcm -> SliceSpacing ( ) ; const vector < double > & vecRow = dcm -> ImgOrientRow ( ) ; const vector < double > & vecCol = dcm -> ImgOrientCol ( ) ; const vector < double > & vecNorm = dcm -> ImgOrientNormal ( ) ; const vector < double > & imgPos = dcm -> ImgPosition ( ) ; double f_c = cols * voxWidth * ( 0.5 * totalCols / cols - 0.5 ) ; double f_r = rows * voxHeight * ( 0.5 * totalRows / rows - 0.5 ) ; v3d [ 0 ] = imgPos [ 0 ] + f_c * vecRow [ 0 ] + f_r * vecCol [ 0 ] + slice * spacing * vecNorm [ 0 ] ; v3d [ 1 ] = imgPos [ 1 ] + f_c * vecRow [ 1 ] + f_r * vecCol [ 1 ] + slice * spacing * vecNorm [ 1 ] ; v3d [ 2 ] = imgPos [ 2 ] + f_c * vecRow [ 2 ] + f_r * vecCol [ 2 ] + slice * spacing * vecNorm [ 2 ] ; }
there's a shift, make the coordinates consistant
there ' s a shift make the coordinates consistant