class_docstr: PAR/REC header
class_docstr_tok: ["PAR\/REC","header"]
docstr: Return indices to sort (and maybe discard) slices in REC file.
  
  If the recording is truncated, the returned indices take care of
  discarding any slice indices from incomplete volumes.
  
  If `self.strict_sort` is True, a more complicated sorting based on
  multiple fields from the .PAR file is used.  This may produce a
  different sort order than `strict_sort=False`, where volumes are sorted
  by the order in which the slices appear in the .PAR file.
  
  Returns
  -------
  slice_indices : list
      List for indexing into the last (third) dimension of the REC data
      array, and (equivalently) the only dimension of
      ``self.image_defs``.
docstr_tok: ["Return","indices","to","sort","(","and","maybe","discard",")","slices","in","REC","file",".","If","the","recording","is","truncated",",","the","returned","indices","take","care","of","discarding","any","slice","indices","from","incomplete","volumes",".","If","`","self.strict_sort","`","is","True",",","a","more","complicated","sorting","based","on","multiple","fields","from","the",".PAR","file","is","used",".","This","may","produce","a","different","sort","order","than","`","strict_sort=False","`",",","where","volumes","are","sorted","by","the","order","in","which","the","slices","appear","in","the",".PAR","file",".","Returns","--","--","--","-","slice_indices",":","list","List","for","indexing","into","the","last","(","third",")","dimension","of","the","REC","data","array",",","and","(","equivalently",")","the","only","dimension","of","``","self.image_defs","``","."]
code: def get_sorted_slice_indices(self):
      """Return indices to sort (and maybe discard) slices in REC file.
  
      If the recording is truncated, the returned indices take care of
      discarding any slice indices from incomplete volumes.
  
      If `self.strict_sort` is True, a more complicated sorting based on
      multiple fields from the .PAR file is used.  This may produce a
      different sort order than `strict_sort=False`, where volumes are sorted
      by the order in which the slices appear in the .PAR file.
  
      Returns
      -------
      slice_indices : list
          List for indexing into the last (third) dimension of the REC data
          array, and (equivalently) the only dimension of
          ``self.image_defs``.
      """
      if not self.strict_sort:
          sort_order = self._lax_sort_order()
      else:
          sort_order = self._strict_sort_order()
  
      # Figure out how many we need to remove from the end, and trim them.
      # Based on our sorting, they should always be last.
      n_used = np.prod(self.get_data_shape()[2:])
      return sort_order[:n_used]
  
imports: import re
  import warnings
  from collections import OrderedDict
  from copy import deepcopy
  from io import StringIO
  from locale import getpreferredencoding
  import numpy
  from .affines import apply_affine, dot_reduce, from_matvec
  from .eulerangles import euler2mat
  from .fileslice import fileslice, strided_scalar
  from .nifti1 import unit_codes
  from .openers import ImageOpener
  from .spatialimages import SpatialHeader, SpatialImage
  from .volumeutils import Recoder, array_from_file
label_desc: Use image node_id 24 for calling the PARRECHeader obj's underlying member method code with example usage: obj.get_sorted_slice_indices() and returns: sort_order