Module Import alias Import alias Import alias Import alias identifier Import alias TryExcept body Import alias handlers ExceptHandler type NameLoad body Print Str Expr Call AttributeLoad NameLoad attr Num TryExcept body Import alias identifier handlers ExceptHandler type NameLoad body Print Str Expr Call AttributeLoad NameLoad attr Num FunctionDef arguments args defaults body Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore BinOpAdd Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str TryExcept body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Slice Num Str handlers ExceptHandler type AttributeLoad NameLoad attr name NameStore body Print Call NameLoad NameLoad Expr Call NameLoad For TupleStore NameStore NameStore NameLoad body If CompareEq NameLoad Str body Expr Call NameLoad orelse If CompareIn NameLoad Str body Assign NameStore NameLoad orelse If CompareIn NameLoad Str body Assign NameStore NameLoad orelse If CompareIn NameLoad Str body Assign NameStore NameLoad orelse If CompareIn NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareIn NameLoad Str body Assign NameStore Call NameLoad NameLoad orelse If CompareIn NameLoad Str body Assign NameStore NameLoad If BoolOpOr CompareEq NameLoad Str CompareEq NameLoad Str BoolOpAnd CompareEq NameLoad Str CompareEq NameLoad Str body Print Str Expr Call NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr NameLoad Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr If CompareEq NameLoad Str body Print Str Assign NameStore Call NameLoad NameLoad NameLoad orelse If CompareEq NameLoad Str body Print Str Assign NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad orelse If BoolOpOr CompareEq NameLoad Str Str body Print Str Assign NameStore Call NameLoad NameLoad NameLoad orelse Print Str Expr Call NameLoad Expr Call AttributeLoad NameLoad attr Str Print Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad BinOpAdd BinOpAdd Str NameLoad Str Expr Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd Str NameLoad Str Str NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Str body Expr Str If CompareEq NameLoad Str body Print Str Assign NameStore Num Assign NameStore Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign TupleStore NameStore NameStore NameStore Call AttributeLoad CompareGt NameLoad Num attr Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore BinOpAdd BinOpSub NameLoad NameLoad Num Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad SubscriptLoad NameLoad Index Num Assign NameStore Call NameLoad SubscriptLoad SubscriptLoad NameLoad Index Num Index Num Assign NameStore ListComp ListLoad comprehension NameStore Call NameLoad Num NameLoad For NameStore Call NameLoad Num NameLoad body Expr Call AttributeLoad SubscriptLoad NameLoad Index BinOpSub SubscriptLoad NameLoad Index NameLoad NameLoad attr SubscriptLoad SubscriptLoad SubscriptLoad NameLoad Index SubscriptLoad NameLoad Index NameLoad Index SubscriptLoad NameLoad Index NameLoad Index SubscriptLoad NameLoad Index NameLoad Print Str Assign NameStore ListComp Num comprehension NameStore Call NameLoad Num NameLoad For NameStore Call NameLoad Num NameLoad body Assign SubscriptStore NameLoad Index NameLoad BinOpDiv Call NameLoad SubscriptLoad NameLoad Index NameLoad Call NameLoad SubscriptLoad NameLoad Index NameLoad Print Str Assign NameStore ListComp ListComp ListComp Num comprehension NameStore Call NameLoad Num NameLoad comprehension NameStore Call NameLoad Num NameLoad comprehension NameStore Call NameLoad Num NameLoad For NameStore Call NameLoad Num NameLoad body For NameStore Call NameLoad Num NameLoad body For NameStore Call NameLoad Num NameLoad body If CompareLt NameLoad NameLoad body Assign SubscriptStore SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index NameLoad Index NameLoad SubscriptLoad NameLoad Index Num orelse If CompareLtELtE NameLoad NameLoad NameLoad body Assign SubscriptStore SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index NameLoad Index NameLoad SubscriptLoad NameLoad Index BinOpSub NameLoad NameLoad orelse If CompareGt NameLoad NameLoad body Assign SubscriptStore SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index NameLoad Index NameLoad SubscriptLoad NameLoad Index BinOpSub Call NameLoad NameLoad Num For NameStore Call NameLoad Num NameLoad body Assign SubscriptStore SubscriptLoad SubscriptLoad NameLoad Index SubscriptLoad NameLoad Index NameLoad Index SubscriptLoad NameLoad Index NameLoad Index SubscriptLoad NameLoad Index NameLoad SubscriptLoad SubscriptLoad SubscriptLoad NameLoad Index SubscriptLoad NameLoad Index NameLoad Index SubscriptLoad NameLoad Index NameLoad Index SubscriptLoad NameLoad Index NameLoad Assign NameStore Call NameLoad NameLoad For NameStore Call NameLoad Num NameLoad body Assign SubscriptStore SubscriptLoad SubscriptLoad NameLoad Index SubscriptLoad NameLoad Index NameLoad Index SubscriptLoad NameLoad Index NameLoad Index SubscriptLoad NameLoad Index NameLoad SubscriptLoad SubscriptLoad SubscriptLoad NameLoad Index SubscriptLoad NameLoad Index NameLoad Index SubscriptLoad NameLoad Index NameLoad Index SubscriptLoad NameLoad Index NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign TupleStore NameStore NameStore NameStore Call AttributeLoad CompareGt NameLoad Num attr Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad For NameStore Call NameLoad Num NameLoad body Assign SubscriptStore SubscriptLoad SubscriptLoad NameLoad Index SubscriptLoad NameLoad Index NameLoad Index SubscriptLoad NameLoad Index NameLoad Index SubscriptLoad NameLoad Index NameLoad SubscriptLoad SubscriptLoad SubscriptLoad NameLoad Index SubscriptLoad NameLoad Index NameLoad Index SubscriptLoad NameLoad Index NameLoad Index SubscriptLoad NameLoad Index NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults body Expr Str Assign TupleStore NameStore NameStore NameStore Call AttributeLoad CompareGt NameLoad Num attr Assign NameStore Call NameLoad NameLoad Print Str Expr Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd BinOpAdd Str Call NameLoad NameLoad Str Call NameLoad NameLoad Print BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd Str Str Call NameLoad NameLoad Str Call NameLoad NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd BinOpAdd Str Call NameLoad NameLoad Str Call NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr For NameStore Call NameLoad Num NameLoad body Assign SubscriptStore SubscriptLoad SubscriptLoad NameLoad Index SubscriptLoad NameLoad Index NameLoad Index SubscriptLoad NameLoad Index NameLoad Index SubscriptLoad NameLoad Index NameLoad SubscriptLoad SubscriptLoad SubscriptLoad NameLoad Index SubscriptLoad NameLoad Index NameLoad Index SubscriptLoad NameLoad Index NameLoad Index SubscriptLoad NameLoad Index NameLoad Return NameLoad decorator_list FunctionDef arguments args defaults body Print Str Expr Call AttributeLoad NameLoad attr Num decorator_list If CompareEq NameLoad Str body Expr Call NameLoad
N/A N/A os N/A getopt N/A sys N/A sct_utils sct N/A scipy.ndimage N/A N/A N/A nibabel N/A N/A N/A ImportError N/A N/A --- nibabel not installed! Exit program. --- N/A N/A N/A sys exit 2 N/A N/A N/A numpy np N/A N/A N/A ImportError N/A N/A --- numpy not installed! Exit program. --- N/A N/A N/A sys exit 2 main N/A N/A N/A N/A N/A strategy N/A fname_centerline N/A fname_input_image N/A fname_output_image N/A fname_mask N/A path_script N/A N/A N/A N/A os path dirname __file__ / N/A N/A N/A N/A opts args N/A N/A getopt getopt N/A N/A sys argv N/A 1 hi:o:m:f:s:c: N/A N/A N/A N/A getopt GetoptError N/A err N/A N/A N/A str err N/A N/A usage N/A N/A opt arg opts N/A N/A N/A opt -h N/A N/A N/A usage N/A N/A N/A opt -i N/A N/A fname_input_image arg N/A N/A N/A opt -o N/A N/A fname_output_image arg N/A N/A N/A opt -m N/A N/A fname_mask arg N/A N/A N/A opt -f N/A N/A filter_type N/A str arg N/A N/A N/A opt -s N/A N/A strategy N/A str arg N/A N/A N/A opt -c N/A N/A fname_centerline arg N/A N/A N/A fname_input_image N/A fname_mask N/A N/A strategy along_centerline N/A fname_centerline N/A N/A 
 
 
 All mandatory arguments are not provided 
 
 
 N/A N/A usage N/A N/A N/A sct check_file_exist fname_input_image N/A N/A N/A sct check_file_exist fname_mask N/A N/A strategy along_centerline N/A N/A N/A N/A sct check_file_exist fname_centerline N/A N/A path_input_image file_input_image ext_input_image N/A N/A sct extract_fname fname_input_image N/A N/A path_output_image file_output_image ext_output_image N/A N/A sct extract_fname fname_output_image N/A img N/A N/A nibabel load fname_input_image N/A data N/A N/A img get_data N/A hdr N/A N/A img get_header N/A mask N/A N/A nibabel load fname_mask N/A mask_data N/A N/A mask get_data N/A mask_hdr N/A N/A mask get_header N/A N/A strategy mean_per_slice N/A N/A 
 
The smoothing strategy is to apply the smoothing to an image of the spinal cord completed with the mean value of the spinal cord for each z-slice...
 
 N/A data N/A smooth_mean_per_slice data mask_data N/A N/A N/A strategy along_centerline N/A N/A 
 
The smoothing strategy is to apply the smoothing to the original data along the spinal cord in the direction of the centerline...
 
 N/A data N/A smooth_along_centerline data fname_input_image file_input_image ext_input_image mask_data fname_centerline N/A N/A N/A N/A strategy total_image N/A N/A 
 
The smoothing strategy is to apply the smoothing to the entire original image...
 
 N/A data N/A smooth_total data mask_data N/A N/A 
 
The smoothing strategy is not correct
 
 N/A N/A usage N/A N/A N/A hdr set_data_dtype uint8 N/A 
Write NIFTI volumes... N/A img N/A N/A nibabel Nifti1Image data None hdr N/A N/A N/A nibabel save img N/A N/A tmp. file_output_image .nii N/A N/A N/A sct generate_output_file N/A N/A tmp. file_output_image .nii ./ file_output_image ext_output_image N/A apply_filter N/A N/A data filter_type N/A gaussian N/A N/A Apply the chosen filter to the image N/A N/A filter_type gaussian N/A N/A 
Apply a Gaussian filter... N/A sigma 1 N/A data_filtered N/A N/A N/A N/A scipy ndimage filters gaussian_filter data sigma N/A data_filtered N/A smooth_mean_per_slice N/A N/A data mask_data N/A N/A N/A Apply the smoothing to an image of the spinal cord completed with the mean value of
    the spinal cord for each z-slice and return the original data with the smoothed spinal cord N/A N/A X Y Z N/A N/A N/A mask_data 0 nonzero N/A N N/A len X N/A Z_min N/A min Z N/A Z_max N/A max Z N/A Z_nb N/A N/A Z_max Z_min 1 N/A x N/A len data N/A y N/A len N/A data N/A 1 N/A z N/A len N/A N/A data N/A 1 N/A 1 N/A sc_values N/A N/A N/A Z_index N/A range 0 Z_nb N/A vox_index N/A range 0 N N/A N/A N/A N/A N/A sc_values N/A N/A N/A Z N/A vox_index Z_min append N/A N/A N/A data N/A N/A X N/A vox_index N/A N/A Y N/A vox_index N/A N/A Z N/A vox_index N/A 
Compute the mean value for each slice of the spinal cord... N/A sc_mean_per_slice N/A 0 N/A Z_index N/A range 0 Z_nb N/A Z_index N/A range 0 Z_nb N/A N/A N/A sc_mean_per_slice N/A Z_index N/A N/A sum N/A sc_values N/A Z_index N/A len N/A sc_values N/A Z_index N/A 
Create a new image to smooth keeping only the spinal cord and completing with the previously computed mean values... N/A sc_data N/A N/A N/A 0 N/A k N/A range 0 z N/A j N/A range 0 y N/A i N/A range 0 x N/A k N/A range 0 z N/A N/A j N/A range 0 y N/A N/A i N/A range 0 x N/A N/A N/A k Z_min N/A N/A N/A N/A N/A sc_data N/A i N/A j N/A k N/A sc_mean_per_slice N/A 0 N/A N/A N/A Z_min k Z_max N/A N/A N/A N/A N/A sc_data N/A i N/A j N/A k N/A sc_mean_per_slice N/A N/A k Z_min N/A N/A N/A k Z_max N/A N/A N/A N/A N/A sc_data N/A i N/A j N/A k N/A sc_mean_per_slice N/A N/A N/A len sc_mean_per_slice 1 N/A i N/A range 0 N N/A N/A N/A N/A N/A sc_data N/A N/A X N/A i N/A N/A Y N/A i N/A N/A Z N/A i N/A N/A N/A data N/A N/A X N/A i N/A N/A Y N/A i N/A N/A Z N/A i N/A smoothed_sc_data N/A apply_filter sc_data N/A i N/A range 0 N N/A N/A N/A N/A N/A data N/A N/A X N/A i N/A N/A Y N/A i N/A N/A Z N/A i N/A N/A N/A smoothed_sc_data N/A N/A X N/A i N/A N/A Y N/A i N/A N/A Z N/A i N/A data N/A smooth_total N/A N/A data mask_data N/A N/A N/A Apply the smoothing to the original data and return the original data where the original
    spinal cord was replaced by the smoothed spinal cord N/A N/A X Y Z N/A N/A N/A mask_data 0 nonzero N/A N N/A len X N/A smoothed_sc_data N/A apply_filter data N/A i N/A range 0 N N/A N/A N/A N/A N/A data N/A N/A X N/A i N/A N/A Y N/A i N/A N/A Z N/A i N/A N/A N/A smoothed_sc_data N/A N/A X N/A i N/A N/A Y N/A i N/A N/A Z N/A i N/A data N/A smooth_along_centerline N/A N/A data fname_input_image file_input_image ext_input_image mask_data fname_centerline N/A N/A N/A Apply the smoothing to the original data along the spinal cord in the direction of the centerline and return
    the original data where the original spinal cord was replaced by the smoothed spinal cord N/A N/A X Y Z N/A N/A N/A mask_data 0 nonzero N/A N N/A len X N/A 
 
 
 Apply the script "sct_smooth_spinal_cord.py" to the original image
 
  N/A N/A N/A os system N/A N/A N/A python sct_smooth_spinal_cord.py -i  N/A str fname_input_image  -c  N/A str fname_centerline N/A N/A N/A N/A N/A N/A 
 
 Loading ./ N/A str file_input_image _smoothed N/A str ext_input_image N/A smoothed_img N/A N/A nibabel load N/A N/A N/A ./ N/A str file_input_image _smoothed N/A str ext_input_image N/A smoothed_sc_data N/A N/A smoothed_img get_data N/A i N/A range 0 N N/A N/A N/A N/A N/A data N/A N/A X N/A i N/A N/A Y N/A i N/A N/A Z N/A i N/A N/A N/A smoothed_sc_data N/A N/A X N/A i N/A N/A Y N/A i N/A N/A Z N/A i N/A data N/A usage N/A N/A N/A N/A N/A USAGE: 
  sct_apply_local_filter.py -i <inputimage> -o <outputimage> -m <mask> [options]

MANDATORY ARGUMENTS
  -i           input volume.
  -o           output volume.
  -m           binary mask refering to zone where to apply the filter.

OPTIONAL ARGUMENTS
  -h           help. Show this message.
  -f           type of filter to apply (default="gaussian")
  -s          smoothing strategy: either "total_image", "mean_per_slice" or "along_centerline" (default="total image")
  -c           centerline of the input spinal cord image if "along_centerline" is given as -s argument

EXAMPLE:
  sct_apply_local_filter.py -i t2.nii.gz -o t2_filtered_WM.nii.gz -m t2_seg.nii.gz -f median
 N/A N/A N/A sys exit 2 N/A N/A N/A __name__ __main__ N/A N/A N/A main