class_docstr: Class to parse an XML string into a CIFTI-2 header object
class_docstr_tok: ["Class","to","parse","an","XML","string","into","a","CIFTI-2","header","object"]
docstr: Collate and process collected character data
docstr_tok: ["Collate","and","process","collected","character","data"]
code: def flush_chardata(self):
      """Collate and process collected character data"""
      if self._char_blocks is None:
          return
      # Just join the strings to get the data.  Maybe there are some memory
      # optimizations we could do by passing the list of strings to the
      # read_data_block function.
      data = "".join(self._char_blocks)
      # Reset the char collector
      self._char_blocks = None
      # Process data
      if self.write_to == "Name":
          data = data.strip()  # .decode('utf-8')
          pair = self.struct_state[-1]
          pair[0] = data
  
      elif self.write_to == "Value":
          data = data.strip()  # .decode('utf-8')
          pair = self.struct_state[-1]
          pair[1] = data
  
      elif self.write_to == "Vertices":
          # conversion to numpy array
          c = BytesIO(data.strip().encode("utf-8"))
          vertices = self.struct_state[-1]
          vertices.extend(np.loadtxt(c, dtype=int, ndmin=1))
          c.close()
  
      elif self.write_to == "VoxelIndices":
          # conversion to numpy array
          c = BytesIO(data.strip().encode("utf-8"))
          parent = self.struct_state[-1]
          parent.voxel_indices_ijk.extend(
              np.loadtxt(c, dtype=int).reshape(-1, 3)
          )
          c.close()
  
      elif self.write_to == "VertexIndices":
          # conversion to numpy array
          c = BytesIO(data.strip().encode("utf-8"))
          index = self.struct_state[-1]
          index.extend(np.loadtxt(c, dtype=int, ndmin=1))
          c.close()
  
      elif self.write_to == "TransformMatrix":
          # conversion to numpy array
          c = BytesIO(data.strip().encode("utf-8"))
          transform = self.struct_state[-1]
          matrix = np.loadtxt(c, dtype=np.float64)
          transform.matrix = matrix.reshape(4, 4)
          c.close()
  
      elif self.write_to == "Label":
          label = self.struct_state[-1]
          label.label = data.strip()
  
      elif self.write_to == "MapName":
          named_map = self.struct_state[-1]
          named_map.map_name = data.strip()
  
imports: from io import BytesIO
  import numpy
  from packaging.version import Version, parse
  from ..None import xmlutils
  from ..batteryrunners import Report
  from ..nifti1 import Nifti1Extension, extension_codes, intent_codes
  from ..nifti2 import Nifti2Header, Nifti2Image
  from ..spatialimages import HeaderDataError
  from .cifti2 import CIFTI_BRAIN_STRUCTURES, CIFTI_MODEL_TYPES, Cifti2BrainModel, Cifti2Header, Cifti2HeaderError, Cifti2Label, Cifti2LabelTable, Cifti2Matrix, Cifti2MatrixIndicesMap, Cifti2MetaData, Cifti2NamedMap, Cifti2Parcel, Cifti2Surface, Cifti2TransformationMatrixVoxelIndicesIJKtoXYZ, Cifti2VertexIndices, Cifti2Vertices, Cifti2Volume, Cifti2VoxelIndicesIJK, _underscore
label_desc: Use image node_id 5 for calling the Cifti2Parser obj's underlying member method code with example usage: obj.flush_chardata() without return types