for d in range(len(anatomy_list)): meanPolyData_d = meanPolyDataList[d] nDataList.append(meanPolyData_d.GetNumberOfPoints()) if d > 0: nDimStartlist.append(nDataList[d - 1] + nDimStartlist[d - 1]) # Manifold Dimension nManDim = CMRepDataList[0].nDim nData = len(CMRepDataList) base = manifolds.cmrep(nManDim) base.Read("CMRep_LinearizedGeodesicRegression_Complex_CTRL_base.rpt") tangent = manifolds.cmrep_tVec(nManDim) tangent.Read("CMRep_LinearizedGeodesicRegression_Complex_CTRL_tangent.tVec") t0 = 20 tN = 80 nTimePt = 30 est_time_list_i = [] est_rad_pt_list_i = [] regression_output_folder_path = '/media/shong/IntHard1/4DAnalysis/IPMI2018/GeodesicRegressionResults/CMRep_CTRL_Complex_NewCode_Linearized/' for a in range(len(anatomy_list)): anatomy = anatomy_list[a] inFileName = 'CMRep_Regression_CTRL_Comlex_' + anatomy + '_' + str( 0) + '.vtk'
R2_posArr_t_vtk.SetNumberOfValues( polyData_t.GetNumberOfPoints() ) R2_posArr_t_vtk.SetName( 'R2_pos' ) R2_radArr_t_vtk = vtk.vtkFloatArray() R2_radArr_t_vtk.SetNumberOfValues( polyData_t.GetNumberOfPoints() ) R2_radArr_t_vtk.SetName( 'R2_rad' ) RMSE_posArr_t_vtk = vtk.vtkFloatArray() RMSE_posArr_t_vtk.SetNumberOfValues( polyData_t.GetNumberOfPoints() ) RMSE_posArr_t_vtk.SetName( 'RMSE_pos' ) RMSE_radArr_t_vtk = vtk.vtkFloatArray() RMSE_radArr_t_vtk.SetNumberOfValues( polyData_t.GetNumberOfPoints() ) RMSE_radArr_t_vtk.SetName( 'RMSE_rad' ) tVec_t = manifolds.cmrep_tVec( nManDim ) for k in range( nManDim ): # Position for d in range( 3 ): tVec_t.tVector[ k ][ 0 ].tVector[ d ] = tangent.tVector[ k ][ 0 ].tVector[ d ] * time_pt # Radius tVec_t.tVector[ k ][ 1 ].tVector[ 0 ] = tangent.tVector[ k ][ 1 ].tVector[ 0 ] * time_pt est_cmrep_t = base.ExponentialMap( tVec_t ) for k in range( nManDim ): polyData_t.GetPoints().SetPoint( k, est_cmrep_t.pt[ k ][ 0 ].pt ) radiusArr_t_vtk.SetValue( k, est_cmrep_t.pt[ k ][ 1 ].pt[ 0 ] ) R2_posArr_t_vtk.SetValue( k, R2_atom[ 0 ][ k ] )
print( pos_real_tVec_r.nDim ) print( pos_real_tVec_r.Type ) pos_real_pt = manifolds.pos_real( 1 ) pos_real_pt.SetPoint( 4.0 ) pos_real_pt.Write( "pos_real.rpt" ) pos_real_pt_r = manifolds.pos_real( 1 ) pos_real_pt_r.Read( "pos_real.rpt" ) print( pos_real_pt_r.pt ) print( pos_real_pt_r.nDim ) print( pos_real_pt_r.Type ) # CMRep cmrep_tVec = manifolds.cmrep_tVec( 2 ) cmrep_tVec.SetTangentVector( [ [ eucl_tVec, pos_real_tVec ], [ eucl_tVec, pos_real_tVec ] ] ) cmrep_pt = manifolds.cmrep( 2 ) cmrep_pt.SetPoint( [ [ eucl_pt, pos_real_pt ], [ eucl_pt, pos_real_pt ] ] ) cmrep_pt.UpdateMeanRadius() cmrep_tVec.SetMeanRadius( cmrep_pt.meanRadius ) cmrep_tVec.Write( "cmrep_tVec.tvec" ) cmrep_pt.Write( "cmrep.rpt" ) cmrep_tVec_r = manifolds.cmrep_tVec( 2 ) cmrep_tVec_r.Read( "cmrep_tVec.tvec" )