Skip to content

Commit

Permalink
Merge pull request #12 from jh-mipc/flexible_surface_qa
Browse files Browse the repository at this point in the history
Flexible surface qa features
  • Loading branch information
blakedewey authored May 23, 2024
2 parents b850a3a + 907a36c commit eef76be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 10 additions & 2 deletions radifox/qa/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,19 @@ def create_surface_qa_image(
surf_file,
img_file,
output_file,
color="red",
axial_slices=(0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7),
coronal_slices=(0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7),
sagittal_slices=(0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7),
color="red",
):
linewidth = 0.5
if color == "binary":
linecolor = "red"
if isinstance(color, (list, tuple)):
linecolor = color[0]
linewidth = color[1]
else:
linecolor = color
img_obj = nib.Nifti1Image.load(img_file)
img_data = img_obj.get_fdata()
# noinspection PyUnresolvedReferences
Expand Down Expand Up @@ -381,7 +389,7 @@ def create_surface_qa_image(
points[:, 0] = img_data.shape[0] - points[:, 0]
else:
points[:, 1] = img_data.shape[1] - points[:, 1]
ax.plot(*points.T, color=color, linewidth=0.5)
ax.plot(*points.T, color=linecolor, linewidth=linewidth)
buf = io.BytesIO()
fig.savefig(buf, format="png")
buf.seek(0)
Expand Down
3 changes: 2 additions & 1 deletion radifox/records/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ def create_qa(
create_surface_qa_image(
overlay,
bg_image,
out_dir / out_name
out_dir / out_name,
color=lut,
)
else:
create_qa_image(
Expand Down

0 comments on commit eef76be

Please sign in to comment.