我有以下问题,只是在前一篇文章中部分解决了:我有一个特定类型的文本文件,这个文件包含一系列患者的放射治疗的Roi信息,我想确定包含一系列数字(在上一篇文章中实现的目标)的一部分文本,编辑这些数字的一部分并将其保存在原始文件中。 我附上了Roi文件的副本:
code starts here
// Region of Interest file
// Data set:
// File created: Mon Sep 4 17:17:19 2017
//
// Pinnacle Treatment Planning System Version 9.10
// 9.10
//
file_stamp={
write_date: Mon Sep 4 17:17:19 2017
write_program: Pinnacle Treatment Planning System
write_version: 9.10
}; // End of file_stamp
//-----------------------------------------------------
// Beginning of ROI: Couch
//-----------------------------------------------------
roi={
name: Couch
volume_name:
stats_volume_name:
author:
organ_name:
flags = 16;
roiinterpretedtype: ORGAN
color: skyblue
box_size = 5;
line_2d_width = 2;
line_3d_width = 1;
paint_brush_radius = 0.4;
paint_allow_curve_closing = 1;
curve_min_area = 0.1;
curve_overlap_min = 88;
lower = 800;
upper = 4096;
radius = 0;
density = 1;
density_units: g/cm^3
override_data = 0;
override_order = 0;
override_material = 0;
material: None
invert_density_loading = 0;
volume = 0;
pixel_min = 0;
pixel_max = 0;
pixel_mean = 0;
pixel_std = 0;
bBEVDRROutline = 0;
display_on_other_vols = 1;
is_linked = 0;
auto_update_contours = 0;
UID: 2.16.840.1.113669.2.931128.555336727.20170904171440.8062
stoppingpower = 0;
ctnumber = 0;
is_created_by_atlasseg = 0;
is_created_by_autoplanengine = 0;
num_curve = 2;
//----------------------------------------------------
// ROI: Couch
// Curve 1 of 2
//----------------------------------------------------
curve={
flags = 20;
block_size = 32;
num_points = 6;
points={
-23.5328 6.25885 40
23.7286 6.25885 40
23.8268 2.14121 40
-23.5328 2.04318 40
-23.5328 6.25885 40
-23.5328 6.25885 40
}; // End of points for curve 1
}; // End of curve 1
//----------------------------------------------------
// ROI: Couch
// Curve 2 of 2
//----------------------------------------------------
curve={
flags = 20;
block_size = 32;
num_points = 6;
points={
-23.5328 5.52735 65
23.7286 5.52735 65
23.8268 2.14121 65
-23.5328 2.04318 65
-23.5328 5.52735 65
-23.5328 5.52735 65
}; // End of points for curve 2
}; // End of curve 2
surface_mesh={
allow_adaptation = 1;
replace_mean_mesh = 0;
auto_clean_contours = 1;
auto_smooth_mesh = 1;
internal_weight = -3.000000;
surface_weight = 1.000000;
distance_weight = 2.000000;
profile_length = 10;
limit_feature_search_string: Full
pixel_size = 1.000000;
feature_weight = 0.010000;
lower_CT_bound = 0.000000;
upper_CT_bound = 4095.000000;
gradient_clipping: Soft
gradient_direction: Unsigned
maximum_gradient = 100.000000;
avoid_CT_range: None
avoid_CT_threshold = 4095.000000;
number_of_modes = 0;
number_of_vertices = 0;
number_of_triangles = 0;
max_iterations = 10;
smooth_between_iterations = 0;
repair_between_iterations = 1;
translation_increment_cm = 0.500000;
rotation_increment = 20.000000;
magnify_increment = 0.200000;
sphere_tool_radius = 1.500000;
gaussian_tool_radius = 3.000000;
vertex_drag_curvature = 0.700000;
vertex_drag_neighbor_layers = 3;
vertices={
}; // End of vertices for surface mesh
triangles={
}; // End of triangles for surface mesh
}; // End of surface_mesh
mean_mesh={
samples = 0;
number_of_vertices = 0;
number_of_triangles = 0;
vertices={
}; // End of vertices for mean mesh
triangles={
}; // End of triangles for mean mesh
}; // End of mean_mesh
}; // End of ROI Couch
code ends here
我感兴趣的是只提取Roi:Couch为其所有曲线定义的段落部分中的数值(x,y,z)。使用正则表达式,我能够提取这些值,但也提取不需要的值,例如:
// Curve 1 of 2
//----------------------------------------------------
curve={
flags = 20;
block_size = 32;
num_points = 6;
points={
将这些值添加到所需的值:1 2 20 32 6(不需要的)-23.5328 6.25885 40等等(所需)。 将这些值加到所需的值:1 2 20 32 6(不需要的)-23.5328 6.25885 40等等(所需)。 最后一步是改变已知值的x和y - > -123.5328 106.25885并输入这些新值而不是原始文件中的原始值。 通过这种方式,我在笛卡尔平面上的Roi的x,y位移。 感谢您提供给我的所有帮助。