:topic: Saving & Opening Pipelines

.. index::
   pair: DREAM3D-NX; Saving & Opening Pipelines;


Saving & Opening Pipelines
##########################

A current **Pipeline** in the **Pipeline View** can be saved to the disk
by selecting the *Save* option in the *File* menu. Once saved to the
disk, the files can be **Bookmarked** for quick access. For more
information on **Bookmarks**, visit the `Bookmarks
View <040_BookmarksView.md>`__ section. A saved **Pipeline** file can be
opened by choosing the *Open…* option in the *File* menu and selecting
the desired **Pipeline** file.

DREAM3D-NX utilizes a *document* model when dealing with saving and
opening **Pipelines**. Whenever a **Pipeline** file is opened, it will
appear in a new DREAM3D-NX window. If the **Pipeline** is modified and
the user selects the *Save* option, the **Pipeline** file will be
updated with the changes.

Pipeline File Formats
=====================

DREAM3D-NX allows the user to *export* and *import* **Pipelines** to a
variety of file formats. The currently supported file formats are

-  .d3dpipeline (JSON)
-  .dream3d

The information written to a **Pipeline** file includes:

-  Boolean determining whether the pipeline is enabled/disabled
-  The name of the **Pipeline** file
-  The list of **Pinned Parameters** for the pipeline
-  The list of **Filters** in the **Pipeline**, in sequential order

   -  Includes each filter’s arguments, comments, class name, UUID, and
      whether the filter is enabled/disabled.

-  All the variables for each **Filter** and their settings
-  The list of **Workflow Parameters** for the pipeline

.. code::

   {
    "isDisabled": false,
    "name": "ExampleFilter.d3dpipeline",
    "pinnedParams": [],
    "pipeline": [
        {
        "args": {
            "data_object_path": "DataGroup"
        },
        "comments": "",
        "filter": {
            "name": "simplnx::CreateDataGroupFilter",
            "uuid": "e7d2f9b8-4131-4b28-a843-ea3c6950f101"
        },
        "isDisabled": false
        },
        {
        "args": {
            "data_object_path": "DataGroup/AttributeMatrix",
            "tuple_dimensions": [
            [
                1.0
            ]
            ]
        },
        "comments": "",
        "filter": {
            "name": "simplnx::CreateAttributeMatrixFilter",
            "uuid": "a6a28355-ee69-4874-bcac-76ed427423ed"
        },
        "isDisabled": false
        },
        {
        "args": {
            "component_count": 3,
            "initialization_value": "0.785398",
            "numeric_type": 8,
            "output_data_array": "DataGroup/AttributeMatrix/Eulers",
            "tuple_dimensions": [
            [
                1.0
            ]
            ]
        },
        "comments": "",
        "filter": {
            "name": "simplnx::CreateDataArray",
            "uuid": "67041f9b-bdc6-4122-acc6-c9fe9280e90d"
        },
        "isDisabled": false
        }
    ],
    "workflowParams": []
   }





The *.d3dpipeline* file format follows the JSON standard, an open
standard that most scripting languages, such as Python and MATLAB, can
easily understand. Therefore, it is straightforward to parse the
*.d3dpipeline* file with an external program to make modifications as
necessary. You can even set up scripting to create many versions of a
**Pipeline** file and execute them from the command line.

The *.dream3d* file format is a binary file based on
`HDF5 <https://www.hdfgroup.org/HDF5/>`__. The *.dream3d* format is also
how the data structure objects are stored to disk. Whenever a user
writes a new DREAM3D-NX file, the **Pipeline** used to create it will be
written into the *.dream3d* file alongside the data structure objects.
This means that the data structure is always accompanied by the workflow
that was used to create it, adding *provenance* to the data. If you
select a *.dream3d* file from the **Open** option of the *File* menu,
the **Pipeline** from within that .dream3d file will be extracted and
opened in a new window. This allows users to recover the workflow used
to create a particular DREAM3D-NX file. Additionally, a *.dream3d* file
can be dragged from the file system and dropped into the **Pipeline
View**. The user is then asked if they would like to extract the
**Pipeline** from the file or read the data structure objects out of the
file into the current **Pipeline**.
