UCL / UCL/STIR

stir_math (and others) should check arguments with has_same_characteristics

Open
#494 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C++
Stars
160
Forks
113
Avg merge
12d 15h
Merged PRs (30d)
1

Description

I am trying to generate a set of ellipsoidal cylinders to add to an XCAT volume. The parameter file to generate one of these lesions is:

generate_image Parameters :=
output filename:=lesion_activity
X output image size (in pixels):=141
Y output image size (in pixels):=141
Z output image size (in pixels):=47
X voxel size (in mm):= 2
Y voxel size (in mm):= 2
Z voxel size (in mm) :=2.18

  Z number of samples to take per voxel := 1
  Y number of samples to take per voxel := 1
  X number of samples to take per voxel := 1

  ;Lesion1
shape type:= ellipsoidal cylinder
Ellipsoidal Cylinder Parameters:=
   radius-x (in mm):=5.0
   radius-y (in mm):=5.0
   length-z (in mm):=10.0
   origin (in mm):={50,-20,-50}
   END:=
value :=2000

My script is:

generate_image lesion_activity.par

stir_math --add test_add  uni_xcat.hv lesion_activity.hv

list_ROI_values --V roi test_add.hv lesion_ROI.par 0

where uni_xcat.hv is an image of uniform 1s and lesion_ROI is:

ROIValues Parameters :=
  ROI name := lesion1
ROI shape type:= ellipsoidal cylinder
Ellipsoidal Cylinder Parameters:=
   radius-x (in mm):=5.0
   radius-y (in mm):=5.0
   length-z (in mm):=10.0
   origin (in mm):={50,-20,-50}
END:=

This results in a output roi file that is clearly wrong.

test_add.hv
            ROI          Mean          Stddev         Volume
        lesion1              1              0          697.6
        lesion2              1              0          697.6

diff lesion_activity.hv uni_xcat.hv reveils the primary difference is:

< first pixel offset (mm) [1] := -140
< first pixel offset (mm) [2] := -140
---
> first pixel offset (mm) [1] := -165
> first pixel offset (mm) [2] := -165

Therefore, should list_ROI_values account for this kind of offset? Or should I just be smarter in defining ROI regions.


P.S. Changing the ROI origin to origin (in mm):={50,-45,-75} compensated for this issue and gave me correct ROI values.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the mismatch with stir_math --add and list_ROI_values using the parameter files and image offsets shown in the report. Inspect the argument handling for stir_math and related tools, focusing on has_same_characteristics. Done means incompatible image characteristics are detected before processing and the reported offset case is handled consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.