4Quant / LungStageAnnotator

The documentation and support for the LungStageAnnotator tool
http://4quant.com/LungStageAnnotator
2 stars 0 forks source link

Add 'diameter' measurements #36

Closed kmader closed 7 years ago

kmader commented 7 years ago

Extents in the greatest dimension (in any plane), Ax, Cor and Sag, possibly add Oblique planes

kmader commented 7 years ago

we implemented this in the report using a bounding box, we thus keep the extents in x,y, and z as well as a roughly estimated diameter: image The idea is to modify the PETCTLabelStatisticsLogic class to support this type of analysis

kmader commented 7 years ago

Using the same logic, the code has been added to show the dimension in cm as the column Longest Extent and Extents

image

Relevant code for the change

r_seg = full_seg.GetSegment(seg_name)

                            seg_bounds = [0, 0, 0, 0, 0, 0]
                            if r_seg is not None:
                                r_seg.GetBounds(seg_bounds) # populate the segment bounds
                            else:
                                logging.warning('The segment {} could not be found, not immediately a problem but possible corrupt data'.format(seg_name))
                            # calculate the difference in each direction
                            seg_dims = np.diff(np.array(seg_bounds).reshape(-1, 2))/10 # in cm
                            self.labelStats[i, "Longest Extent (cm)"] = np.max(seg_dims)
                            self.labelStats[i, "Extents (cm)"] = ' '.join(['%s: %2.2f' % (ax, dst) for dst,ax in zip(seg_dims, 'xyz')])