print( anatomy_cmrep_surface_path ) print( "File doesn't exist" ) continue reader = vtk.vtkPolyDataReader() reader.SetFileName( anatomy_cmrep_surface_path ) reader.Update() polyData = reader.GetOutput() if cnt == 0: meanPolyData.DeepCopy( polyData ) # print( polyData ) nAtoms = polyData.GetNumberOfPoints() cmrep_ij = manifolds.cmrep( nAtoms ) for k in range( nAtoms ): pos = polyData.GetPoint( k ) rad = polyData.GetPointData().GetArray( "Radius Function" ).GetValue( k ) cmrep_ij.SetPosition( k, pos ) cmrep_ij.SetRadius( k, rad ) cmrep_ij.UpdateMeanRadius() CMRepDataList.append( cmrep_ij ) riskGroupList.append( dataInfoList[i].CAPGroupList[ j ] ) ageList.append( dataInfoList[i].AgeList[ j ] ) SubjectList.append( dataInfoList[i].ID ) CAPList.append( dataInfoList[i].CAPList[j] )
print(dataInfoList[i].ID + "has less than 2 data") continue for j in range(len(dataInfoList[i].LabelList)): if j > 0: break if not dataInfoList[i].CAPGroupList[j] == 'cont': continue subj_i_label_j_folderPath = dataFolderPath + 'PHD-AS1-' + dataInfoList[ i].ID + "/" + dataInfoList[i].LabelList[ j] + "/surfaces/decimated_aligned/" nAtoms = 0 cmrep_ij = manifolds.cmrep(0) for a in range(len(anatomy_list)): anatomy = anatomy_list[a] anatomy_cmrep_surface_path = subj_i_label_j_folderPath + "cmrep_" + anatomy + "/mesh/def3.med.vtk" if not os.path.isfile(anatomy_cmrep_surface_path): print(anatomy_cmrep_surface_path) print("File doesn't exist") break reader = vtk.vtkPolyDataReader() reader.SetFileName(anatomy_cmrep_surface_path) reader.Update() polyData = reader.GetOutput()
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" ) cmrep_pt_r = manifolds.cmrep( 2 ) cmrep_pt_r.Read( "cmrep.rpt" )
print(anatomy_cmrep_surface_path) print("File doesn't exist") continue reader = vtk.vtkPolyDataReader() reader.SetFileName(anatomy_cmrep_surface_path) reader.Update() polyData = reader.GetOutput() if cnt == 0: meanPolyData.DeepCopy(polyData) # print( polyData ) nAtoms = polyData.GetNumberOfPoints() cmrep_ij = manifolds.cmrep(nAtoms) for k in range(nAtoms): pos = polyData.GetPoint(k) rad = polyData.GetPointData().GetArray( "Radius Function").GetValue(k) cmrep_ij.SetPosition(k, pos) cmrep_ij.SetRadius(k, rad) cmrep_ij.UpdateMeanRadius() CMRepDataList.append(cmrep_ij) riskGroupList.append(dataInfoList[i].CAPGroupList[j]) ageList.append(dataInfoList[i].AgeList[j]) SubjectList.append(dataInfoList[i].ID)
# Skip if there is only one shape in the list if len( dataInfoList[i].AgeList ) < 2: print( dataInfoList[i].ID + "has less than 2 data" ) continue for j in range( len( dataInfoList[i].LabelList ) ): if j > 0: break if dataInfoList[i].CAPGroupList[ j ] == 'cont': continue subj_i_label_j_folderPath = dataFolderPath + 'PHD-AS1-' + dataInfoList[i].ID + "/" + dataInfoList[i].LabelList[j ] + "/surfaces/decimated_aligned/" nAtoms = 0 cmrep_ij = manifolds.cmrep( 0 ) IsAllAnatomy = True for a in range( len( anatomy_list ) ): anatomy = anatomy_list[ a ] anatomy_cmrep_surface_path = subj_i_label_j_folderPath + "cmrep_" + anatomy + "/mesh/def3.med.vtk" if not os.path.isfile( anatomy_cmrep_surface_path ): print( anatomy_cmrep_surface_path ) print( "File doesn't exist" ) IsAllAnatomy = False break