DrSAR / SARlabpy

git clone git@pfeifer.phas.ubc.ca:SARlabpy (do not push to github, please)
http://code.SARlab.ca
Other
1 stars 0 forks source link

Major bug in h_inj_point function... #294

Open firasm opened 9 years ago

firasm commented 9 years ago

Description:

h_inj_point works by using the entire image (noise, mouse, tumour, everything that's in the FoV) and figuring out the injection point by looking at where the change occurred (kind of like an averaged BAT for the whole tumour :

img_mean = data[:,:,:,:].sum(0).sum(0)

injection_point = []

    for slc in xrange(num_slices): # Loop for each slice

        diff_slice = numpy.diff(img_mean[slc,:]) # Take the difference of adjacent points
        std_slice =  numpy.std(diff_slice) # Take the std of the difference in adjacent points

        # Take the point which is 2 SD of the difference away 
        injection_point.append(next(i for i,v in enumerate(diff_slice) if v > 2*std_slice))

    # look through the list of elements (by slice) in injection point and report the most common (mode)
    injection_point_counter = Counter(injection_point)
    injection_point = injection_point_counter.most_common(1)

    return injection_point[0][0]+1

Believe it or not, this actually works quite well in most cases - however I just discovered that for single slice, long DCE acquisition where the intensity returns to the baseline eventually, this is quite problematic and the long acquisition actually causes a false positive for an injection time much earlier than it should.

For e.g., in the example below, the in point is identified as 13 when it should be 25 - in part because the sd of the difference approaches the mean with a longer acquisition, and the 2SD yields more false positives.

longdce diff

A potential fix is to only consider the first N points of the DCE curve when trying to determine the injection point automatically.

Consequence: we'll have to re-check all the data that relies on h_inj_point, namely auc60, augc60. Fortunately we don't do many long DCE scans anymore, but there are a few studies that would be affected.