Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major modifications to simplify usage and fix various issues with shape analysis #2200

Merged
merged 73 commits into from
Apr 2, 2019

Conversation

jcohenadad
Copy link
Member

@jcohenadad jcohenadad commented Mar 18, 2019

These major modifications of sct_process_segmentation include:

Notable changes in API

  • No more flag -p to select csa from shape, because shape analysis is now run by default for the function (and includes csa measure).
  • Changed flag: -no-angle --> -angle-corr, which is more intuitive

Results of batch_processing

jca/1395-process-seg-shape db78f71

t2/CSA:          80.1044369966
mt/MTR(WM):      54.2327894021
t2s/CSA_GM:      12.5620440099
t2s/CSA_WM:      65.3564860255

master 0b3d3c5

t2/CSA:          78.8508685963
mt/MTR(WM):      54.2375940831
t2s/CSA_GM:      12.4991429555
t2s/CSA_WM:      65.0954014463

@jcohenadad jcohenadad added enhancement category: improves performance/results of an existing feature sct_process_segmentation context: labels Mar 18, 2019
@jcohenadad jcohenadad added this to the v4.0.0 milestone Mar 18, 2019
@jcohenadad jcohenadad self-assigned this Mar 18, 2019
shape is now computing slicewise, by stretching the image using the angle between the centerline and the normal to the 2D patch plane. Partly fixes #1395
Making msct_shape.py obsolete
for consistency with angle_AP. Same with RL.
Copy link
Member

@charleygros charleygros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on one data, works well!

  • Believe that's relevant to remove the flag -p --> will make the utilisation of this function more intuitive.
  • Really like the idea of creating the file 'create_test_data.py', makes complete sense to me.

Thank you!!

@jcohenadad jcohenadad merged commit 08bc024 into master Apr 2, 2019
@gmotzespina gmotzespina deleted the jca/1395-process-seg-shape branch July 26, 2019 16:48
jcohenadad added a commit that referenced this pull request Dec 18, 2019
…pe analysis (#2200)

* test_process_seg: Re-activated shape analysis with angled seg

* msct_shape: First step of major refactoring for computing shape

shape is now computing slicewise, by stretching the image using the angle between the centerline and the normal to the 2D patch plane. Partly fixes #1395

* process_seg: Moved msct_shape --> process_seg

Making msct_shape.py obsolete

* process_seg: new implementation of shape analysis now working

A few fixes needed

* process_seg: Added angle_RL and angle_AP as output

* process_seg: Renamed dict field AP_diameter --> diameter_AP

for consistency with angle_AP. Same with RL.

* process_seg: Cleanup

* process_seg: Upsample image to increase precision in shape analysis

* process_seg: Added progress bar

* unit_testing/create_test_data: New file to create testing data

* test_centerline: Refactored to use create_test_data.py

* test_centerline.py: Cleanup

* test_centerline: Cleanup

* test_process_seg: Refactoring with parametrized dummy seg (WIP)

* process_seg.py: Added angle_correction

* process_seg.py: Fixed index bug

* create_test_data.py: Added size_arr flag and updated test_process_seg

Tests now pass

* create_test_data.py: Added proper file name for saving in debug

* centerline/core.py: Cleanup

* centerline/core.py: Fixed indexation bug

* test_centerline.py: Now testing for case with minmax=True

* process_seg.py: Few fixes and test added regarding angle correction

* test_process_seg.py: Compressed code

* create_test_data.py: Added comments

* create_test_data.py: Now possible to specify pixdim

* create_test_data.py: Added IS angle for test data generation

* test_process_seg.py: Merged with/without angle test functions

* test_process_seg.py: Cleanup

* create_test_data.py: Now using resampling to fit desired pixdim

Because creating nii object after rotation created problems of scaling

* test_process_seg.py: Finalized testing

* create_test_data,test_process_seg: Renamed variable for clarity

* create_test_data,test_process_seg: Added flag to empty specific slice

* process_seg: Fixed bug in case empty slice

* test_process_seg: Now testing if empty slice

* process_seg.py: Removed compute_csa (replaced by compute_shape)

* process_seg.py: Renamed functions with suffix _

* process_seg: Crop 2d patch before upsampling for faster execution

* create_test_data: Removed saving (used for debug)

* test_process_seg: Increased precision of test with ground truth

* sct_process_segmentation: Updated to reflect changes in process_seg

* msct_shape.py: Removed useless file, replaced by process_seg

* test_deepseg_sc.py: Fixed regression with new create_test_data

* batch_processing.sh: Updated to reflect changes in process_seg

* sct_process_segmentation.py: Output name shape.csv --> csa.csv

* sct_process_segmentation.py: Cleanup doc

* batch_processing.sh: Fixed index issue on csv reading

* process_seg.py: Fixed logging output

* process_seg.py: Normalize image before binarizing in case it is float

* resampling/resample_nipy(): Enabled to specify dtype of output

* create_test_data,test_process_seg: Now testing for np.uint8 input

* process_seg.py: Cleanup imports

* create_test_data.py: Removed debug mode (saving)

* aggregate_slicewise.py: Fixed issue for when input mask is empty

Fixed abnormal "Weights sum to zero, can't be normalized" in aggregate_slicewise(). Fixes #2203

* process_seg.py: Check if slice is empty before doing normalization

* process_seg.py: Updated docstring

* aggregate_slicewise.py: Fixed bug when summing array with dim>1

* aggregate_slicewise.py: Updated dict field for process_seg

* process_seg.py: Cleanup

* process_seg.py: Fixed mixup between X and Y for applying affine T

Was causing wrong estimation of CSA. Test should be made more sensitive

* process_seg.py: Forgot to update variable name

* test_process_seg: Added test for fixing orientation

* process_seg: Fixed bug when finding orientation

* process_seg.py: Fixed bug related to orientation, improve test

* test_process_seg: Added test for negative angled cord

* process_seg: Reduced oversampling factor for faster execution

* create_test_data: Added debug mode and possibility to change orientation

* process_seg: Fixed bug related to array format

with int16 input, transform.warp() stretch instead of compress the image. Now converting to float64 to make sure this does not happen. Added tests to cover these cases.

* test_process_seg: Added tests for array format

* sct_utils: Added function to display platform-compatible open syntax

* sct_process_segmentation: Added platform-compatible syntax to open csv

* sct_extract_metric: Added platform-compatible syntax to open csv


Former-commit-id: 08bc024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement category: improves performance/results of an existing feature sct_process_segmentation context:
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants