seed_based_crop
Author: Suraj Pai Email: bspai@bwh.harvard.edu This script contains two classes: 1. SeedBasedPatchCropd 2. SeedBasedPatchCrop
            SeedBasedPatchCrop
    
              Bases: Transform
A class representing a seed-based patch crop transformation.
Attributes:
| Name | Type | Description | 
|---|---|---|
roi_size | 
            
               Tuple indicating the size of the region of interest (ROI).  | 
          
Methods:
| Name | Description | 
|---|---|
__call__ | 
              
                 Crop a patch from the input image centered around the seed coordinate.  | 
            
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                roi_size
             | 
            
               Tuple indicating the size of the region of interest (ROI).  | 
            required | 
Returns:
| Name | Type | Description | 
|---|---|---|
NdarrayOrTensor |             
               Cropped patch of shape (C, Ph, Pw, Pd), where (Ph, Pw, Pd) is the patch size.  | 
          
Raises:
| Type | Description | 
|---|---|
                  AssertionError
             | 
            
               If the input image has dimensions other than (C, H, W, D)  | 
          
                  AssertionError
             | 
            
               If the coordinates are invalid (e.g., min_h >= max_h)  | 
          
Source code in fmcib/preprocessing/seed_based_crop.py
                
            __call__(img, center, global_coordinates=False)
    Crop a patch from the input image centered around the seed coordinate.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                img
             | 
            
                  NdarrayOrTensor
             | 
            
               Image to crop, with dimensions (C, H, W, D). C is the number of channels.  | 
            required | 
                center
             | 
            
                  tuple
             | 
            
               Seed coordinate around which to crop the patch (X, Y, Z).  | 
            required | 
                global_coordinates
             | 
            
                  bool
             | 
            
               If True, seed coordinate is in global space; otherwise, local space.  | 
            
                  False
             | 
          
Returns:
| Name | Type | Description | 
|---|---|---|
NdarrayOrTensor |             
                  NdarrayOrTensor
             | 
            
               Cropped patch of shape (C, Ph, Pw, Pd), where (Ph, Pw, Pd) is the patch size.  | 
          
Source code in fmcib/preprocessing/seed_based_crop.py
              
            __init__(roi_size)
    Initialize SeedBasedPatchCrop class.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                roi_size
             | 
            
                  tuple
             | 
            
               Tuple indicating the size of the region of interest (ROI).  | 
            required | 
            SeedBasedPatchCropd
    
              Bases: MapTransform
A class representing a seed-based patch crop transformation.
Inherits from MapTransform.
Attributes:
| Name | Type | Description | 
|---|---|---|
keys | 
            
                  list
             | 
            
               List of keys for images in the input data dictionary.  | 
          
roi_size | 
            
                  tuple
             | 
            
               Tuple indicating the size of the region of interest (ROI).  | 
          
allow_missing_keys | 
            
                  bool
             | 
            
               If True, do not raise an error if some keys in the input data dictionary are missing.  | 
          
coord_orientation | 
            
                  str
             | 
            
               Coordinate system (RAS or LPS) of input coordinates.  | 
          
global_coordinates | 
            
                  bool
             | 
            
               If True, coordinates are in global coordinates; otherwise, local coordinates.  | 
          
Source code in fmcib/preprocessing/seed_based_crop.py
                
            __call__(data)
    Apply transformation to given data.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                data
             | 
            
                  dict
             | 
            
               Dictionary with image keys and required center coordinates.  | 
            required | 
Returns:
| Name | Type | Description | 
|---|---|---|
dict |             
                  Dict[Hashable, NdarrayOrTensor]
             | 
            
               Dictionary with cropped patches for each key in the input data dictionary.  | 
          
Source code in fmcib/preprocessing/seed_based_crop.py
              
            __init__(keys, roi_size, allow_missing_keys=False, coord_orientation='RAS', global_coordinates=True)
    Initialize SeedBasedPatchCropd class.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                keys
             | 
            
                  List
             | 
            
               List of keys for images in the input data dictionary.  | 
            required | 
                roi_size
             | 
            
                  Tuple
             | 
            
               Tuple indicating the size of the region of interest (ROI).  | 
            required | 
                allow_missing_keys
             | 
            
                  bool
             | 
            
               If True, do not raise an error if some keys in the input data dictionary are missing.  | 
            
                  False
             | 
          
                coord_orientation
             | 
            
                  str
             | 
            
               Coordinate system (RAS or LPS) of input coordinates.  | 
            
                  'RAS'
             | 
          
                global_coordinates
             | 
            
                  bool
             | 
            
               If True, coordinates are in global coordinates; otherwise, local coordinates.  | 
            
                  True
             |