class_docstr: Write data and metadata into files on disk using Nibabel.
  
  .. code-block:: python
  
      import numpy as np
      from monai.data import NibabelWriter
  
      np_data = np.arange(48).reshape(3, 4, 4)
      writer = NibabelWriter()
      writer.set_data_array(np_data, channel_dim=None)
      writer.set_metadata({"affine": np.eye(4), "original_affine": np.eye(4)})
      writer.write("test1.nii.gz", verbose=True)
class_docstr_tok: ["Write","data","and","metadata","into","files","on","disk","using","Nibabel",".","..","code-block",":",":","python","import","numpy","as","np","from","monai.data","import","NibabelWriter","np_data","=","np.arange","(","48",")",".reshape","(","3",",","4",",","4",")","writer","=","NibabelWriter","(",")","writer.set_data_array","(","np_data",",","channel_dim=None",")","writer.set_metadata","(","{","``","affine","''",":","np.eye","(","4",")",",","``","original_affine","''",":","np.eye","(","4",")","}",")","writer.write","(","``","test1.nii.gz","''",",","verbose=True",")"]
docstr: Args:
      output_dtype: output data type.
      kwargs: keyword arguments passed to ``ImageWriter``.
  
  The constructor will create ``self.output_dtype`` internally.
  ``affine`` is initialized as instance members (default ``None``),
  user-specified ``affine`` should be set in ``set_metadata``.
docstr_tok: ["Args",":","output_dtype",":","output","data","type",".","kwargs",":","keyword","arguments","passed","to","``","ImageWriter","``",".","The","constructor","will","create","``","self.output_dtype","``","internally",".","``","affine","``","is","initialized","as","instance","members","(","default","``","None","``",")",",","user-specified","``","affine","``","should","be","set","in","``","set_metadata","``","."]
code: def __init__(self, output_dtype: DtypeLike = np.float32, **kwargs):
      """
      Args:
          output_dtype: output data type.
          kwargs: keyword arguments passed to ``ImageWriter``.
  
      The constructor will create ``self.output_dtype`` internally.
      ``affine`` is initialized as instance members (default ``None``),
      user-specified ``affine`` should be set in ``set_metadata``.
      """
      super().__init__(output_dtype=output_dtype, affine=None, **kwargs)
  
imports: from __future__ import annotations
  from collections.abc import Mapping, Sequence
  from typing import TYPE_CHECKING, Any, cast
  import numpy
  from monai.apps.utils import get_logger
  from monai.config import DtypeLike, NdarrayOrTensor, PathLike
  from monai.data.meta_tensor import MetaTensor
  from monai.data.utils import affine_to_spacing, ensure_tuple, ensure_tuple_rep, orientation_ras_lps, to_affine_nd
  from monai.transforms.spatial.array import Resize, SpatialResample
  from monai.transforms.utils_pytorch_numpy_unification import ascontiguousarray, moveaxis
  from monai.utils import GridSampleMode, GridSamplePadMode, InterpolateMode, MetaKeys, OptionalImportError, SpaceKeys, convert_data_type, convert_to_tensor, get_equivalent_dtype, look_up_option, optional_import, require_pkg
label_desc: Use image node_id 1 to create a new NibabelWriter object from inherited base classes: ImageWriter with example: obj = NibabelWriter(output_dtype)