Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@gattia
Copy link
Contributor

@gattia gattia commented Dec 6, 2022

Starting a pull request while working on this to get feedback. A few things are done differently than other models.

The main things I see myself wanting to do/add are:

  • Create function to build original model so we can skip resampling images up/down?
  • Add a model using same architecture as other stanford_qdess.py models - I think the segmentation performance on this model vs. that are pretty much the same.

@ad12
Copy link
Owner

ad12 commented Aug 14, 2023

@gattia thanks for the PR! could you lint your files and provide some same screenshots of the segmentations

@gattia
Copy link
Contributor Author

gattia commented Aug 29, 2023

Looks like it's getting hungup during CI because Python 3.6 isn't available anymore?

Performed lint on my side + added a photo of the current segs. I'd love to add the two remaining things I have listed on my PR comments, but they're not necessary for this PR and maybe I can do at a later date.

gattia and others added 30 commits August 16, 2024 18:21
- This is only available in python>3.10, therefore removing the
requirement in flake8
- Dont need docs for each specific version...
- Number was due to an error in a specifc version (that numba is now past)
- SITK was due to change in basis (don't accept non-orthonormal) - but this hasnt been an issue running tests upto now.
- np.complex is deprecated.
- Different versions of tensorflow/keras were returning `tuple` or `tf.TensorShape`.
    - Create new function to handle both
    - refactor utils to create this function and the current model loading util functions.
- Codecoverage was throwing rate limiting errors and thus failing CI.
-https://github.com/ad12/DOSMA/actions/runs/10459944994/job/28965177349#step:7:83
- Therefore, add if statement to no push codecov under these circumstances.
The current implementation worked somewhat to fix errors with specific image
acquisitions, but was somewhat specific to sagittal images. It has now been
updated to reformat and then export images to sitk as would be expected
for a specific image acquisition type (e.g., sagittal, coronal, axial).

Essentially, based on if its sag, ax, or coral, the `mv` will be reformatted.
Then, this reformatted image along with the affine/spacing information
a new sitk Image will be created. Finally, if the dicom was not collected in
this standard orientation, the user can still choose to flip the volume along
any of the three axes using boolean flags.

New tests were also written to ensure the reformatting is such that the
image is roughly what it would be like if SITK itself loaded it.
This is based on a simplification of equations 6/7 of the original Sveinsson et al. paper "A Simple Analytic Method for Estimating T2 in the Knee from DESS". This is required because the new Mensa product sequence does not store these header fields.
This is based on a simplification of equations 6/7 of the original Sveinsson et al. paper "A Simple Analytic Method for Estimating T2 in the Knee from DESS". This is required because the new Mensa product sequence does not store these header fields.
- Introduced new subclasses for coronal, axial, and sagittal bone segmentation
- Added plane-specific TARGET_ORIENTATION and DEFAULT_IMAGE_SIZE
- Updated base class to use default image size when not provided
- Simplified model initialization with more flexible configuration
- fixed bug where reformat done to volume, but
- Improved volume processing logic for bone segmentation
- Simplified tissue combination and orientation handling
- Used logical OR for tissue combination instead of addition
- Reorganized volume creation and orientation reformatting steps
- Introduced StanfordQDessBoneUNet2DSTAPLE class for combining masks from sagittal, coronal, and axial models
- Implemented mask generation using multiple plane-specific models
- Added tissue-specific mask combination logic using STAPLE approach
- Included memory management with garbage collection during model processing
- Prepared for future implementation of STAPLE algorithm for mask combination
…sk processing

- Replaced manual mask combination with SimpleITK's MultiLabelSTAPLE algorithm
- Added list of indices to exclude from STAPLE processing for each plane (model type).
- Simplified mask generation and combination logic
- Improved volume orientation handling and mask reformatting
- Removed hardcoded tissue combination dictionary
…nd performance logging

- Added configurable tissue names and combination options to StanfordQDessBoneUNet2DSTAPLE
- Implemented optional verbose mode with timing information for mask generation steps
- Updated list of excluded indices for STAPLE processing
- Added time tracking for mask generation, processing, and STAPLE algorithm
…et2DSTAPLE class

- Modified the list of indices to exclude for coronal and axial planes to improve mask processing accuracy.
- Ensured that the exclusion criteria align with the intended segmentation logic for better model performance.

- Sag: All labels
- Cor: All labels except patellar cartilage
- Axial: Only the bone labels
…zation

- Introduced optional verbose logging to track mask generation and processing times.
- Extended the constructor of StanfordQDessBoneUNet2DSTAPLE to accept tissue names and combinations for improved flexibility in mask generation.
- Updated the mask generation method to include timing information for performance monitoring.
…t2DSTAPLE class

Update so that the patellar cartilage is predicted by 2 networks (axial and sagittal).
- Cast masks to uint16 to prevent overflow during STAPLE algorithm execution.
- Set labels greater than 9 to 0 in the final mask to handle undecided labels.
- Convert final mask volume to uint8 for consistency in output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants