changeset 6:5bf056c0354e draft

"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit 15e24b1f0143679647906bc427654f66b417a45c"
author galaxyp
date Wed, 25 Mar 2020 08:13:17 -0400
parents ed9ed1e6cca2
children 44a4b31fcbf3
files macros.xml preprocessing.xml test-data/Analyze75.hdr test-data/Analyze75.img test-data/Analyze75.t2m test-data/Example_Continuous.ibd test-data/Example_Continuous.imzML test-data/analyze75_filtered2.pdf test-data/imzml_filtered3.pdf test-data/imzml_filtered4.pdf test-data/imzml_filtered5.pdf test-data/imzml_filtered8.pdf test-data/out3.ibd test-data/out3.imzml test-data/out3.imzml.txt test-data/out4.ibd test-data/out4.imzml test-data/out4.imzml.txt test-data/out5.ibd test-data/out5.imzml test-data/out5.imzml.txt test-data/out6.ibd test-data/out6.imzml test-data/out6.imzml.txt test-data/out7.ibd test-data/out7.imzml test-data/out7.imzml.txt test-data/out8.ibd test-data/out8.imzml test-data/out8.imzml.txt test-data/preprocessing_results1.ibd test-data/preprocessing_results1.imzml test-data/preprocessing_results1.imzml.txt test-data/preprocessing_results1.pdf test-data/preprocessing_results2.ibd test-data/preprocessing_results2.imzml test-data/preprocessing_results2.imzml.txt test-data/preprocessing_results2.pdf test-data/preprocessing_results3.ibd test-data/preprocessing_results3.imzml test-data/preprocessing_results3.imzml.txt test-data/preprocessing_results3.pdf test-data/preprocessing_results4.ibd test-data/preprocessing_results4.imzml test-data/preprocessing_results4.imzml.txt test-data/preprocessing_results4.pdf test-data/preprocessing_results5.RData test-data/preprocessing_results5.ibd test-data/preprocessing_results5.imzml test-data/preprocessing_results5.imzml.txt test-data/preprocessing_results5.pdf test-data/rdata_notfiltered.pdf
diffstat 47 files changed, 1546 insertions(+), 745 deletions(-) [+]
line wrap: on
line diff
--- a/macros.xml	Fri Dec 13 13:57:13 2019 -0500
+++ b/macros.xml	Wed Mar 25 08:13:17 2020 -0400
@@ -1,316 +1,322 @@
-<macros>
-    <token name="@VERSION@">1.12.1</token>
-
-    <xml name="requirements">
-        <requirements>
-            <requirement type="package" version="@VERSION@">bioconductor-cardinal</requirement>
-            <requirement type="package" version="3.5.1">r-base</requirement>
-            <yield/>
-        </requirements>
-    </xml>
-
-    <xml name="print_version">
-        <version_command><![CDATA[
-echo $(R --version | grep version | grep -v GNU)", Cardinal version" $(R --vanilla --slave -e "library(Cardinal); cat(sessionInfo()\$otherPkgs\$Cardinal\$Version)" 2> /dev/null | grep -v -i "WARNING: ")
-        ]]></version_command>
-    </xml>
-
-    <token name="@INPUT_LINKING@"><![CDATA[
-        #if $infile.ext == 'imzml'
-            ln -s '${infile.extra_files_path}/imzml' infile.imzML &&
-            ln -s '${infile.extra_files_path}/ibd' infile.ibd &&
-        #elif $infile.ext == 'analyze75'
-            ln -s '${infile.extra_files_path}/hdr' infile.hdr &&
-            ln -s '${infile.extra_files_path}/img' infile.img &&
-            ln -s '${infile.extra_files_path}/t2m' infile.t2m &&
-        #else
-            ln -s $infile infile.RData &&
-        #end if
-    ]]></token>
-
-
-    <token name="@READING_MSIDATA@"><![CDATA[
-        ## importing MSI data files
-
-        ## function to read RData files independent of filename
-        loadRData <- function(fileName){
-        load(fileName)
-        get(ls()[ls() != "fileName"])
-        }
-
-        #if $infile.ext == 'imzml'
-            #if str($processed_cond.processed_file) == "processed":
-                msidata <- readImzML('infile', mass.accuracy=$processed_cond.accuracy, units.accuracy = "$processed_cond.units", attach.only=TRUE)
-                centroided(msidata) = $centroids
-            #else
-                msidata <- readImzML('infile', attach.only=TRUE)
-                centroided(msidata) = $centroids
-            #end if
-        #elif $infile.ext == 'analyze75'
-            msidata = readAnalyze('infile', attach.only=TRUE)
-            centroided(msidata) = $centroids
-        #else
-            msidata = loadRData('infile.RData')
-        #end if
-
-    ]]></token>
-
-    <token name="@DATA_PROPERTIES@"><![CDATA[
-        ## Number of features (mz)
-        maxfeatures = length(features(msidata))
-        ## Range mz
-        minmz = round(min(mz(msidata)), digits=2)
-        maxmz = round(max(mz(msidata)), digits=2)
-        ## Number of spectra (pixels)
-        pixelcount = length(pixels(msidata))
-        ## Range x coordinates
-        minimumx = min(coord(msidata)[,1])
-        maximumx = max(coord(msidata)[,1])
-        ## Range y coordinates
-        minimumy = min(coord(msidata)[,2])
-        maximumy = max(coord(msidata)[,2])
-
-
-        properties = c("Number of m/z features",
-                       "Range of m/z values",
-                       "Number of pixels", 
-                       "Range of x coordinates", 
-                       "Range of y coordinates")
-
-        values = c(paste0(maxfeatures), 
-                   paste0(minmz, " - ", maxmz), 
-                   paste0(pixelcount), 
-                   paste0(minimumx, " - ", maximumx),
-                   paste0(minimumy, " - ", maximumy))
-
-        property_df = data.frame(properties, values)
-    ]]></token>
-
-    <token name="@READING_MSIDATA_INRAM@"><![CDATA[
-        ## importing MSI data files
-
-        ## function to read RData files independent of filename
-        loadRData <- function(fileName){
-        load(fileName)
-        get(ls()[ls() != "fileName"])
-        }
-
-        #if $infile.ext == 'imzml'
-            #if str($processed_cond.processed_file) == "processed":
-                msidata <- readImzML('infile', mass.accuracy=$processed_cond.accuracy, units.accuracy = "$processed_cond.units")
-                centroided(msidata) = $centroids
-                iData(msidata) = iData(msidata)[]
-            #else
-                msidata <- readImzML('infile')
-                centroided(msidata) = $centroids
-            #end if
-        #elif $infile.ext == 'analyze75'
-            msidata = readAnalyze('infile')
-            centroided(msidata) = $centroids
-        #else
-            msidata = loadRData('infile.RData')
-        #end if
-
-    ]]></token>
-
-    <token name="@DATA_PROPERTIES_INRAM@"><![CDATA[
-########################### QC numbers ########################
-## including intensity calculations which need data in RAM
-        ## Number of features (mz)
-        maxfeatures = length(features(msidata))
-        ## Range mz
-        minmz = round(min(mz(msidata)), digits=2)
-        maxmz = round(max(mz(msidata)), digits=2)
-        ## Number of spectra (pixels)
-        pixelcount = length(pixels(msidata))
-        ## Range x coordinates
-        minimumx = min(coord(msidata)[,1])
-        maximumx = max(coord(msidata)[,1])
-        ## Range y coordinates
-        minimumy = min(coord(msidata)[,2])
-        maximumy = max(coord(msidata)[,2])
-        ## Range of intensities
-        minint = round(min(spectra(msidata), na.rm=TRUE), digits=2)
-        maxint = round(max(spectra(msidata), na.rm=TRUE), digits=2)
-        ## Number of intensities > 0, for if conditions
-        npeaks= sum(spectra(msidata)>0, na.rm=TRUE)
-        ## Number of NA in spectra matrix
-        NAcount = sum(is.na(spectra(msidata)))
-        ## Number of NA in spectra matrix
-        infcount = sum(is.infinite(spectra(msidata)))
-        ## Number of duplicated coordinates
-        dupl_coord = sum(duplicated(coord(msidata)))
-
-        properties = c("Number of m/z features",
-                       "Range of m/z values",
-                       "Number of pixels", 
-                       "Range of x coordinates", 
-                       "Range of y coordinates",
-                       "Range of intensities", 
-                       "Number of NA intensities",
-                       "Number of Inf intensities", 
-                       "Number of duplicated coordinates")
-
-        values = c(paste0(maxfeatures), 
-                   paste0(minmz, " - ", maxmz), 
-                   paste0(pixelcount), 
-                   paste0(minimumx, " - ", maximumx),  
-                   paste0(minimumy, " - ", maximumy), 
-                   paste0(minint, " - ", maxint), 
-                   paste0(NAcount), 
-                   paste0(infcount), 
-                   paste0(dupl_coord))
-
-        property_df = data.frame(properties, values)
-    ]]></token>
-
-    <token name="@CARDINAL_DESCRIPTION@"><![CDATA[
-        Cardinal is an R package that implements statistical & computational tools for analyzing mass spectrometry imaging datasets.
-        `More information on Cardinal <http://cardinalmsi.org/>`_
-    ]]></token>
-    <token name="@MSIDATA_INPUT_DESCRIPTION@"><![CDATA[
-        **Input data**
-
-        - MSI data: 3 types of input data can be used:
-
-            - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <https://ms-imaging.org/wp/imzml/>`_
-            - Analyze7.5 (upload hdr, img and t2m file via the "composite" function)
-            - Cardinal "MSImageSet" data saved as .RData
-    ]]></token>
-    <token name="@MZ_TABULAR_INPUT_DESCRIPTION@"><![CDATA[
-        - Optional tabular file with m/z values: 
-
-            - One column with numeric m/z values (without empty fields or letters)
-            - The file is allowed to have any column names as header (in this case set "Tabular file contains a header line" to yes)
-            - m/z features outside the m/z range of the input file are ignored 
-
-
-                ::
-            
-                            m/z    
-                          100.0    
-                          100.01   
-                          100.02   
-                           ...
-                           ...    
-
-    ]]></token>
-    <token name="@MZ_2COLS_TABULAR_INPUT_DESCRIPTION@"><![CDATA[
-        - Tabular file with m/z values: 
-
-            - One column with numeric m/z values (without empty fields or letters), another column with names for the m/z (m/z column can also be used as name)
-            - The file is allowed to have any column names as header (in this case set "Tabular file contains a header line" to yes)
-            - m/z features outside the m/z range of the input file are ignored 
-
-
-                ::
-             
-                            m/z        name
-                          100.0      analyte1
-                          100.01     analyte2
-                          100.02     analyte3
-                           ...
-                           ...    
-
-    ]]></token>
-    <token name="@SPECTRA_TABULAR_INPUT_DESCRIPTION@"><![CDATA[
-        - Optional file with pixel coordinates and annotation: 
-
-            - Tabular file: One column with x values, one column with y values and one column with annotations
-            - The file is allowed to have any column names as header (in this case set "Tabular file contains a header line" to yes)
-            - Pixel with coordinates outside the coordinates of the input file are ignored
-
-                ::
-
-                      x_coord     y_coord    annotation
-                        1            1        healthy
-                        2            1        healthy
-                        3            1        disease
-                        ...
-                        ...
-
-    ]]></token>
-
-    <xml name="reading_msidata">
-        <param name="infile" type="data" format="imzml,rdata,analyze75"
-               label="MSI data"
-                help="Input file as imzML (composite upload), Analyze7.5 (composite upload) or Cardinal MSImageSet saved as RData (regular upload)"/>
-        <param name="centroids" type="boolean" label="Centroided input" help="Choose Yes if peak detection has already been done." truevalue="TRUE" falsevalue="FALSE"/>
-        <conditional name="processed_cond">
-            <param name="processed_file" type="select" label="Processed imzML file" help="Choose no if your input is an Analyze7.5 or continuous imzML file">
-                <option value="no_processed" selected="True">no</option>
-                <option value="processed">yes</option>
-            </param>
-            <when value="no_processed"/>
-            <when value="processed">
-                <param name="accuracy" type="float" value="50" label="Mass accuracy to which the m/z values will be binned" help="This should be set to the native accuracy of the mass spectrometer, if known"/>
-                <param name="units" display="radio" type="select" label="Unit of the mass accuracy" help="either m/z or ppm">
-                    <option value="mz" >mz</option>
-                    <option value="ppm" selected="True" >ppm</option>
-                </param>
-            </when>
-        </conditional>
-    </xml>
-
-    <xml name="pdf_filename">
-        <param name="filename" type="text" value="" label="Title" help="Will appear in the pdf output, if nothing given it will take the dataset name">
-            <sanitizer invalid_char="">
-                <valid initial="string.ascii_letters,string.digits">
-                    <add value="_"/>
-                    <add value=" "/>
-                </valid>
-            </sanitizer>
-        </param>
-    </xml>
-
-    <xml name="sanitizer_multiple_digits">
-        <sanitizer invalid_char="">
-            <valid initial="string.digits">
-                <add value=":" />
-                <add value="," />
-            </valid>
-        </sanitizer>
-    </xml>
-
-    <xml name="reading_1_column_mz_tabular" token_label="Tabular file with m/z features">
-        <param name="mz_tabular" type="data" format="tabular" label="@LABEL@" help="Only numeric m/z values are allowed"/>
-        <param name="feature_column" data_ref="mz_tabular" label="Column with features" type="data_column"/>
-        <param name="feature_header" type="boolean" label="Tabular file contains a header line" truevalue="TRUE" falsevalue="FALSE"/>
-    </xml>
-
-    <xml name="reading_2_column_mz_tabular" token_optional="false">
-        <param name="calibrant_file" type="data" optional="@OPTIONAL@" format="tabular"
-            label="m/z of interest (e.g. internal Calibrants)" help="one column with m/z values, optional second column with names (m/z values can also be selected as name)"/>
-        <param name="mz_column" data_ref="calibrant_file" optional="@OPTIONAL@" label="Column with m/z values" type="data_column"/>
-        <param name="name_column" data_ref="calibrant_file" optional="@OPTIONAL@" label="Column with name of m/z values" type="data_column"/>
-        <param name="calibrant_header" type="boolean" optional="@OPTIONAL@" label="Tabular file contains a header line" truevalue="TRUE" falsevalue="FALSE"/>
-    </xml>
-
-    <xml name="reading_pixel_annotations">
-                <param name="annotation_file" type="data" format="tabular" label="Tabular file with pixel coordinates and annotation"
-                help="Tabular file with three columns: x values, y values and pixel annotations"/>
-                <param name="column_x" data_ref="annotation_file" label="Column with x values" type="data_column"/>
-                <param name="column_y" data_ref="annotation_file" label="Column with y values" type="data_column"/>
-                <param name="column_names" data_ref="annotation_file" label="Column with pixel annotations" type="data_column"/>
-                <param name="tabular_header" type="boolean" label="Tabular file contains a header line" truevalue="TRUE" falsevalue="FALSE"/>
-    </xml>
-
-    <xml name="citations">
-        <citations>
-            <citation type="doi">10.1093/bioinformatics/btv146</citation>
-        </citations>
-    </xml>
-    <xml name="infile_analyze75">
-        <param name="infile" value="" ftype="analyze75">
-            <composite_data value="Analyze75.hdr"/>
-            <composite_data value="Analyze75.img"/>
-            <composite_data value="Analyze75.t2m"/>
-        </param>
-    </xml>
-    <xml name="infile_imzml">
-        <param name="infile" value="" ftype="imzml">
-            <composite_data value="Example_Continuous.imzML"/>
-            <composite_data value="Example_Continuous.ibd"/>
-        </param>
-    </xml>
-</macros>
+<macros>
+    <token name="@VERSION@">1.12.1</token>
+
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="@VERSION@">bioconductor-cardinal</requirement>
+            <requirement type="package" version="3.5.1">r-base</requirement>
+            <yield/>
+        </requirements>
+    </xml>
+
+    <xml name="print_version">
+        <version_command><![CDATA[
+echo $(R --version | grep version | grep -v GNU)", Cardinal version" $(R --vanilla --slave -e "library(Cardinal); cat(sessionInfo()\$otherPkgs\$Cardinal\$Version)" 2> /dev/null | grep -v -i "WARNING: ")
+        ]]></version_command>
+    </xml>
+
+    <token name="@INPUT_LINKING@"><![CDATA[
+        #if $infile.ext == 'imzml'
+            ln -s '${infile.extra_files_path}/imzml' infile.imzML &&
+            ln -s '${infile.extra_files_path}/ibd' infile.ibd &&
+        #elif $infile.ext == 'analyze75'
+            ln -s '${infile.extra_files_path}/hdr' infile.hdr &&
+            ln -s '${infile.extra_files_path}/img' infile.img &&
+            ln -s '${infile.extra_files_path}/t2m' infile.t2m &&
+        #else
+            ln -s $infile infile.RData &&
+        #end if
+    ]]></token>
+
+
+    <token name="@READING_MSIDATA@"><![CDATA[
+        ## importing MSI data files
+
+        ## function to read RData files independent of filename
+        loadRData <- function(fileName){
+        load(fileName)
+        get(ls()[ls() != "fileName"])
+        }
+
+        #if $infile.ext == 'imzml'
+            #if str($processed_cond.processed_file) == "processed":
+                msidata <- readImzML('infile', mass.accuracy=$processed_cond.accuracy, units.accuracy = "$processed_cond.units", attach.only=TRUE)
+                centroided(msidata) = $centroids
+            #else
+                msidata <- readImzML('infile', attach.only=TRUE)
+                centroided(msidata) = $centroids
+            #end if
+        #elif $infile.ext == 'analyze75'
+            msidata = readAnalyze('infile', attach.only=TRUE)
+            centroided(msidata) = $centroids
+        #else
+            msidata = loadRData('infile.RData')
+        #end if
+
+    ]]></token>
+
+    <token name="@DATA_PROPERTIES@"><![CDATA[
+        ## Number of features (mz)
+        maxfeatures = length(features(msidata))
+        ## Range mz
+        minmz = round(min(mz(msidata)), digits=2)
+        maxmz = round(max(mz(msidata)), digits=2)
+        ## Number of spectra (pixels)
+        pixelcount = length(pixels(msidata))
+        ## Range x coordinates
+        minimumx = min(coord(msidata)[,1])
+        maximumx = max(coord(msidata)[,1])
+        ## Range y coordinates
+        minimumy = min(coord(msidata)[,2])
+        maximumy = max(coord(msidata)[,2])
+
+
+        properties = c("Number of m/z features",
+                       "Range of m/z values",
+                       "Number of pixels", 
+                       "Range of x coordinates", 
+                       "Range of y coordinates")
+
+        values = c(paste0(maxfeatures), 
+                   paste0(minmz, " - ", maxmz), 
+                   paste0(pixelcount), 
+                   paste0(minimumx, " - ", maximumx),
+                   paste0(minimumy, " - ", maximumy))
+
+        property_df = data.frame(properties, values)
+    ]]></token>
+
+    <token name="@READING_MSIDATA_INRAM@"><![CDATA[
+        ## importing MSI data files
+
+        ## function to read RData files independent of filename
+        loadRData <- function(fileName){
+        load(fileName)
+        get(ls()[ls() != "fileName"])
+        }
+
+        #if $infile.ext == 'imzml'
+            #if str($processed_cond.processed_file) == "processed":
+                msidata <- readImzML('infile', mass.accuracy=$processed_cond.accuracy, units.accuracy = "$processed_cond.units")
+                centroided(msidata) = $centroids
+                iData(msidata) = iData(msidata)[]
+            #else
+                msidata <- readImzML('infile')
+                centroided(msidata) = $centroids
+            #end if
+        #elif $infile.ext == 'analyze75'
+            msidata = readAnalyze('infile')
+            centroided(msidata) = $centroids
+        #else
+            msidata = loadRData('infile.RData')
+        #end if
+
+    ]]></token>
+
+    <token name="@DATA_PROPERTIES_INRAM@"><![CDATA[
+########################### QC numbers ########################
+## including intensity calculations which need data in RAM
+        ## Number of features (mz)
+        maxfeatures = length(features(msidata))
+        ## Range mz
+        minmz = round(min(mz(msidata)), digits=2)
+        maxmz = round(max(mz(msidata)), digits=2)
+        ## Number of spectra (pixels)
+        pixelcount = length(pixels(msidata))
+        ## Range x coordinates
+        minimumx = min(coord(msidata)[,1])
+        maximumx = max(coord(msidata)[,1])
+        ## Range y coordinates
+        minimumy = min(coord(msidata)[,2])
+        maximumy = max(coord(msidata)[,2])
+        ## Range of intensities
+        minint = round(min(spectra(msidata), na.rm=TRUE), digits=2)
+        maxint = round(max(spectra(msidata), na.rm=TRUE), digits=2)
+        ## Number of intensities > 0, for if conditions
+        npeaks= sum(spectra(msidata)>0, na.rm=TRUE)
+        ## Number of NA in spectra matrix
+        NAcount = sum(is.na(spectra(msidata)))
+        ## Number of NA in spectra matrix
+        infcount = sum(is.infinite(spectra(msidata)))
+        ## Number of duplicated coordinates
+        dupl_coord = sum(duplicated(coord(msidata)))
+
+        properties = c("Number of m/z features",
+                       "Range of m/z values",
+                       "Number of pixels", 
+                       "Range of x coordinates", 
+                       "Range of y coordinates",
+                       "Range of intensities", 
+                       "Number of NA intensities",
+                       "Number of Inf intensities", 
+                       "Number of duplicated coordinates")
+
+        values = c(paste0(maxfeatures), 
+                   paste0(minmz, " - ", maxmz), 
+                   paste0(pixelcount), 
+                   paste0(minimumx, " - ", maximumx),  
+                   paste0(minimumy, " - ", maximumy), 
+                   paste0(minint, " - ", maxint), 
+                   paste0(NAcount), 
+                   paste0(infcount), 
+                   paste0(dupl_coord))
+
+        property_df = data.frame(properties, values)
+    ]]></token>
+
+    <token name="@CARDINAL_DESCRIPTION@"><![CDATA[
+        Cardinal is an R package that implements statistical & computational tools for analyzing mass spectrometry imaging datasets.
+        `More information on Cardinal <http://cardinalmsi.org/>`_
+    ]]></token>
+    <token name="@MSIDATA_INPUT_DESCRIPTION@"><![CDATA[
+        **Input data**
+
+        - MSI data: 3 types of input data can be used:
+
+            - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <https://ms-imaging.org/wp/imzml/>`_
+            - Analyze7.5 (upload hdr, img and t2m file via the "composite" function)
+            - Cardinal "MSImageSet" data saved as .RData
+    ]]></token>
+    <token name="@MZ_TABULAR_INPUT_DESCRIPTION@"><![CDATA[
+        - Optional tabular file with m/z values: 
+
+            - One column with numeric m/z values (without empty fields or letters)
+            - The file is allowed to have any column names as header (in this case set "Tabular file contains a header line" to yes)
+            - m/z features outside the m/z range of the input file are ignored 
+
+
+                ::
+            
+                            m/z    
+                          100.0    
+                          100.01   
+                          100.02   
+                           ...
+                           ...    
+
+    ]]></token>
+    <token name="@MZ_2COLS_TABULAR_INPUT_DESCRIPTION@"><![CDATA[
+        - Tabular file with m/z values: 
+
+            - One column with numeric m/z values (without empty fields or letters), another column with names for the m/z (m/z column can also be used as name)
+            - The file is allowed to have any column names as header (in this case set "Tabular file contains a header line" to yes)
+            - m/z features outside the m/z range of the input file are ignored 
+
+
+                ::
+             
+                            m/z        name
+                          100.0      analyte1
+                          100.01     analyte2
+                          100.02     analyte3
+                           ...
+                           ...    
+
+    ]]></token>
+    <token name="@SPECTRA_TABULAR_INPUT_DESCRIPTION@"><![CDATA[
+        - Optional file with pixel coordinates and annotation: 
+
+            - Tabular file: One column with x values, one column with y values and one column with annotations
+            - The file is allowed to have any column names as header (in this case set "Tabular file contains a header line" to yes)
+            - Pixel with coordinates outside the coordinates of the input file are ignored
+
+                ::
+
+                      x_coord     y_coord    annotation
+                        1            1        healthy
+                        2            1        healthy
+                        3            1        disease
+                        ...
+                        ...
+
+    ]]></token>
+
+    <xml name="reading_msidata">
+        <param name="infile" type="data" format="imzml,rdata,analyze75"
+               label="MSI data"
+                help="Input file as imzML (composite upload), Analyze7.5 (composite upload) or Cardinal MSImageSet saved as RData (regular upload)"/>
+        <param name="centroids" type="boolean" label="Centroided input" help="Choose Yes if peak detection has already been done." truevalue="TRUE" falsevalue="FALSE"/>
+        <conditional name="processed_cond">
+            <param name="processed_file" type="select" label="Processed imzML file" help="Choose no if your input is an Analyze7.5 or continuous imzML file">
+                <option value="no_processed" selected="True">no</option>
+                <option value="processed">yes</option>
+            </param>
+            <when value="no_processed"/>
+            <when value="processed">
+                <param name="accuracy" type="float" value="50" label="Mass accuracy to which the m/z values will be binned" help="This should be set to the native accuracy of the mass spectrometer, if known"/>
+                <param name="units" display="radio" type="select" label="Unit of the mass accuracy" help="either m/z or ppm">
+                    <option value="mz" >mz</option>
+                    <option value="ppm" selected="True" >ppm</option>
+                </param>
+            </when>
+        </conditional>
+    </xml>
+
+    <xml name="pdf_filename">
+        <param name="filename" type="text" value="" label="Title" help="Will appear in the pdf output, if nothing given it will take the dataset name">
+            <sanitizer invalid_char="">
+                <valid initial="string.ascii_letters,string.digits">
+                    <add value="_"/>
+                    <add value=" "/>
+                </valid>
+            </sanitizer>
+        </param>
+    </xml>
+
+    <xml name="sanitizer_multiple_digits">
+        <sanitizer invalid_char="">
+            <valid initial="string.digits">
+                <add value=":" />
+                <add value="," />
+            </valid>
+        </sanitizer>
+    </xml>
+
+    <xml name="reading_1_column_mz_tabular" token_label="Tabular file with m/z features">
+        <param name="mz_tabular" type="data" format="tabular" label="@LABEL@" help="Only numeric m/z values are allowed"/>
+        <param name="feature_column" data_ref="mz_tabular" label="Column with features" type="data_column"/>
+        <param name="feature_header" type="boolean" label="Tabular file contains a header line" truevalue="TRUE" falsevalue="FALSE"/>
+    </xml>
+
+    <xml name="reading_2_column_mz_tabular" token_optional="false">
+        <param name="calibrant_file" type="data" optional="@OPTIONAL@" format="tabular"
+            label="m/z of interest (e.g. internal Calibrants)" help="one column with m/z values, optional second column with names (m/z values can also be selected as name)"/>
+        <param name="mz_column" data_ref="calibrant_file" optional="@OPTIONAL@" label="Column with m/z values" type="data_column"/>
+        <param name="name_column" data_ref="calibrant_file" optional="@OPTIONAL@" label="Column with name of m/z values" type="data_column"/>
+        <param name="calibrant_header" type="boolean" optional="@OPTIONAL@" label="Tabular file contains a header line" truevalue="TRUE" falsevalue="FALSE"/>
+    </xml>
+
+    <xml name="reading_pixel_annotations">
+                <param name="annotation_file" type="data" format="tabular" label="Tabular file with pixel coordinates and annotation"
+                help="Tabular file with three columns: x values, y values and pixel annotations"/>
+                <param name="column_x" data_ref="annotation_file" label="Column with x values" type="data_column"/>
+                <param name="column_y" data_ref="annotation_file" label="Column with y values" type="data_column"/>
+                <param name="column_names" data_ref="annotation_file" label="Column with pixel annotations" type="data_column"/>
+                <param name="tabular_header" type="boolean" label="Tabular file contains a header line" truevalue="TRUE" falsevalue="FALSE"/>
+    </xml>
+
+    <xml name="citations">
+        <citations>
+            <citation type="doi">10.1093/bioinformatics/btv146</citation>
+        </citations>
+    </xml>
+    <xml name="infile_analyze75">
+        <param name="infile" value="" ftype="analyze75">
+            <composite_data value="Analyze75.hdr"/>
+            <composite_data value="Analyze75.img"/>
+            <composite_data value="Analyze75.t2m"/>
+        </param>
+    </xml>
+    <xml name="infile_imzml">
+        <param name="infile" value="" ftype="imzml">
+            <composite_data value="Example_Continuous.imzML"/>
+            <composite_data value="Example_Continuous.ibd"/>
+        </param>
+    </xml>
+    <xml name="processed_infile_imzml">
+        <param name="infile" value="" ftype="imzml">
+            <composite_data value="Example_Processed.imzML"/>
+            <composite_data value="Example_Processed.ibd"/>
+        </param>
+    </xml>
+</macros>
--- a/preprocessing.xml	Fri Dec 13 13:57:13 2019 -0500
+++ b/preprocessing.xml	Wed Mar 25 08:13:17 2020 -0400
@@ -1,15 +1,17 @@
-<tool id="cardinal_preprocessing" name="MSI preprocessing" version="@VERSION@.3">
+<tool id="cardinal_preprocessing" name="MSI preprocessing" version="2.4.0.0">
     <description>
         mass spectrometry imaging preprocessing
     </description>
     <macros>
         <import>macros.xml</import>
     </macros>
-    <expand macro="requirements">
+    <requirements>
+        <requirement type="package" version="2.4.0">bioconductor-cardinal</requirement>
+        <requirement type="package" version="3.6.1">r-base</requirement>
         <requirement type="package" version="2.3">r-gridextra</requirement>
-        <requirement type="package" version="3.0">r-ggplot2</requirement>
-        <requirement type="package" version="0.20_35">r-lattice</requirement>
-    </expand>
+        <requirement type="package" version="3.2.1">r-ggplot2</requirement>
+        <requirement type="package" version="0.20_38">r-lattice</requirement>
+    </requirements>
     <command detect_errors="exit_code">
     <![CDATA[
 
@@ -17,11 +19,9 @@
         cat '${cardinal_preprocessing}' &&
         Rscript '${cardinal_preprocessing}' &&
 
-        #if str($imzml_output) == "imzml_format":
         mkdir $outfile_imzml.files_path &&
             mv ./out.imzML "${os.path.join($outfile_imzml.files_path, 'imzml')}" | true &&
             mv ./out.ibd "${os.path.join($outfile_imzml.files_path, 'ibd')}" | true &&
-        #end if
         echo "imzML file:" > $outfile_imzml &&
         ls -l "$outfile_imzml.files_path" >> $outfile_imzml
 
@@ -37,12 +37,37 @@
 library(lattice)
 library(ggplot2)
 
-@READING_MSIDATA@
+
+        ## function to read RData files independent of filename
+        loadRData <- function(fileName){
+        load(fileName)
+        get(ls()[ls() != "fileName"])
+        }
 
-@READING_MSIDATA_INRAM@  ###change out
+        #if $infile.ext == 'imzml'
+            #if str($processed_cond.processed_file) == "processed":
+                msidata <- readImzML('infile', resolution=$processed_cond.accuracy, units = "$processed_cond.units")
+                centroided(msidata) = $centroids
+            #else
+                msidata <- readImzML('infile')
+                centroided(msidata) = $centroids
+            #end if
+        #elif $infile.ext == 'analyze75'
+            msidata = readAnalyze('infile')
+            centroided(msidata) = $centroids
+        #else
+            msidata = loadRData('infile.RData')
+            msidata = as(msidata, "MSImagingExperiment")
+        #end if
+
 
 ## remove duplicated coordinates, otherwise peak picking and log2 transformation will fail
-msidata <- msidata[,!duplicated(coord(msidata)[,1:2])]
+msidata <- msidata[,!duplicated(coord(msidata)[,1:2])] 
+
+## set variable to False
+#set $used_peak_picking = False
+#set $used_peak_alignment = False
+#set $continuous_format = False
 
 
 if (ncol(msidata)>0 & nrow(msidata) >0){                                         
@@ -63,12 +88,10 @@
     vectorofactions = "inputdata"
     ## Choose random spectra for QC plots
     random_spectra = sample(pixels(msidata), 4, replace=FALSE)
-    par(mfrow = c(2, 2), oma=c(0,0,2,0))
-    for (random_sample in 1:length(random_spectra)){
-        plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))}
+    par(oma=c(0,0,2,0))
+    print(plot(msidata, pixel=random_spectra))
     title("Input spectra", outer=TRUE, line=0)
 
-
     ############################### Preprocessing steps ###########################
     ###############################################################################
 
@@ -80,7 +103,13 @@
             print('Normalization')
             ##normalization
 
+            if (class(msidata) == "MSProcessedImagingExperiment"){
+                msidata = as(msidata, "MSContinuousImagingExperiment")
+            }
+
             msidata = normalize(msidata, method="tic")
+            msidata <- process(msidata, BPPARAM=MulticoreParam())
+
 
             ############################### QC ###########################
 
@@ -91,9 +120,7 @@
             normalized = c(minmz, maxmz,maxfeatures, pixelcount)
             QC_numbers= cbind(QC_numbers, normalized)
             vectorofactions = append(vectorofactions, "normalized")
-            par(mfrow = c(2, 2), oma=c(0,0,2,0))
-            for (random_sample in 1:length(random_spectra)){
-                plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))}
+            print(plot(msidata, pixel=random_spectra))
             title("Spectra after normalization", outer=TRUE, line=0)
 
     ############################### Baseline reduction ###########################
@@ -102,7 +129,12 @@
             print('Baseline_reduction')
             ##baseline reduction
 
+            if (class(msidata) == "MSProcessedImagingExperiment"){
+                msidata = as(msidata, "MSContinuousImagingExperiment")
+            }
+
             msidata = reduceBaseline(msidata, method="median", blocks=$method.methods_conditional.blocks_baseline, spar=$method.methods_conditional.spar_baseline)
+            msidata <- process(msidata, BPPARAM=MulticoreParam())
 
             ############################### QC ###########################
 
@@ -113,8 +145,7 @@
             baseline = c(minmz, maxmz,maxfeatures, pixelcount)
             QC_numbers= cbind(QC_numbers, baseline)
             vectorofactions = append(vectorofactions, "baseline red.")
-            for (random_sample in 1:length(random_spectra)){
-                plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))}
+            print(plot(msidata, pixel=random_spectra))
             title("Spectra after baseline reduction", outer=TRUE, line=0)
 
     ############################### Smoothing ###########################
@@ -123,6 +154,11 @@
             print('Smoothing')
             ## Smoothing
 
+            if (class(msidata) == "MSProcessedImagingExperiment"){
+                msidata = as(msidata, "MSContinuousImagingExperiment")
+            }
+
+
             #if str( $method.methods_conditional.methods_for_smoothing.smoothing_method) == 'gaussian':
                 print('gaussian smoothing')
 
@@ -144,6 +180,7 @@
                 msidata = smoothSignal(msidata, method="$method.methods_conditional.methods_for_smoothing.smoothing_method", window=$method.methods_conditional.window_smoothing, coef = $method.methods_conditional.methods_for_smoothing.coefficients_ma_filter)
 
             #end if
+            msidata <- process(msidata, BPPARAM=MulticoreParam())
 
             ############################### QC ###########################
 
@@ -154,13 +191,13 @@
             smoothed = c(minmz, maxmz,maxfeatures, pixelcount)
             QC_numbers= cbind(QC_numbers, smoothed)
             vectorofactions = append(vectorofactions, "smoothed")
-            for (random_sample in 1:length(random_spectra)){
-                plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))}
+            print(plot(msidata, pixel=random_spectra))
             title("Spectra after smoothing", outer=TRUE, line=0)
 
     ############################### Peak picking ###########################
 
         #elif str( $method.methods_conditional.preprocessing_method) == 'Peak_picking':
+            #set $used_peak_picking = True
             print('Peak_picking')
             ## Peakpicking
 
@@ -169,10 +206,10 @@
 
                 msidata = peakPick(msidata, window = $method.methods_conditional.window_picking, blocks = $method.methods_conditional.blocks_picking, method='$method.methods_conditional.methods_for_picking.picking_method', SNR=$method.methods_conditional.SNR_picking_method, spar=$method.methods_conditional.methods_for_picking.spar_picking)
 
-            #elif str( $method.methods_conditional.methods_for_picking.picking_method) == 'limpic':
-                print('limpic peakpicking')
+            #elif str( $method.methods_conditional.methods_for_picking.picking_method) == 'mad':
+                print('mad peakpicking')
 
-                msidata = peakPick(msidata, window = $method.methods_conditional.window_picking, blocks = $method.methods_conditional.blocks_picking, method='$method.methods_conditional.methods_for_picking.picking_method', SNR=$method.methods_conditional.SNR_picking_method, thresh=$method.methods_conditional.methods_for_picking.tresh_picking)
+                msidata = peakPick(msidata, window = $method.methods_conditional.window_picking, blocks = $method.methods_conditional.blocks_picking, method='$method.methods_conditional.methods_for_picking.picking_method', SNR=$method.methods_conditional.SNR_picking_method)
 
             #elif str( $method.methods_conditional.methods_for_picking.picking_method) == 'simple':
                 print('simple peakpicking')
@@ -180,6 +217,12 @@
                 msidata = peakPick(msidata, window = $method.methods_conditional.window_picking, blocks = $method.methods_conditional.blocks_picking, method='$method.methods_conditional.methods_for_picking.picking_method', SNR=$method.methods_conditional.SNR_picking_method)
 
             #end if
+            msidata <- process(msidata, BPPARAM=MulticoreParam())
+
+            #if str($method.methods_conditional.imzml_output) == "cont_format":
+                #set $continuous_format = True
+            #end if
+
 
             ############################### QC ###########################
 
@@ -190,45 +233,40 @@
             picked = c(minmz, maxmz,maxfeatures, pixelcount)
             QC_numbers= cbind(QC_numbers, picked)
             vectorofactions = append(vectorofactions, "picked")
-            for (random_sample in 1:length(random_spectra)){
-                plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))}
+            print(plot(msidata, pixel=random_spectra))
             title("Spectra after peak picking", outer=TRUE, line=0)
 
     ############################### Peak alignment ###########################
 
         #elif str( $method.methods_conditional.preprocessing_method ) == 'Peak_alignment':
+            #set $used_peak_alignment = True
             print('Peak_alignment')
             ## Peakalignment
 
-            #if str( $method.methods_conditional.align_ref_type.align_reference_datatype) == 'align_noref':
-
-                align_peak_reference = msidata
-
-            #elif str( $method.methods_conditional.align_ref_type.align_reference_datatype) == 'align_table':
+            #if str( $method.methods_conditional.align_ref_type.align_reference_datatype) == 'align_table':
 
                 align_reference_table = read.delim("$method.methods_conditional.align_ref_type.mz_tabular", header = $method.methods_conditional.align_ref_type.feature_header, stringsAsFactors = FALSE)
+
                 align_reference_column = align_reference_table[,$method.methods_conditional.align_ref_type.feature_column]
-                align_peak_reference = align_reference_column[align_reference_column>=min(mz(msidata)) & align_reference_column<=max(mz(msidata))]
+
+                align_peak_reference = as.numeric(align_reference_column[align_reference_column>=min(mz(msidata)) & align_reference_column<=max(mz(msidata))])
                 if (length(align_peak_reference) == 0)
                     {align_peak_reference = 0}
-           
-            #elif str( $method.methods_conditional.align_ref_type.align_reference_datatype) == 'align_msidata_ref':
+
+                msidata = peakAlign(msidata,tolerance =$method.methods_conditional.value_diffalignment, units = "$method.methods_conditional.units_diffalignment", ref=align_peak_reference)
+
 
-                    align_peak_reference = loadRData('$method.methods_conditional.align_ref_type.align_peaks_msidata')
+            #elif str( $method.methods_conditional.align_ref_type.align_reference_datatype) == 'align_noref':
+
+                msidata = peakAlign(msidata,tolerance =$method.methods_conditional.value_diffalignment, units = "$method.methods_conditional.units_diffalignment")
 
             #end if
 
-            #if str( $method.methods_conditional.methods_for_alignment.alignment_method) == 'diff':
-                print('diff peakalignment')
-
-                msidata = peakAlign(msidata, method='$method.methods_conditional.methods_for_alignment.alignment_method',diff.max =$method.methods_conditional.methods_for_alignment.value_diffalignment, units = "$method.methods_conditional.methods_for_alignment.units_diffalignment", ref=align_peak_reference)
+            msidata <- process(msidata, BPPARAM=MulticoreParam())
 
-           #elif str( $method.methods_conditional.methods_for_alignment.alignment_method) == 'DP':
-                print('DPpeakalignment')
-
-            msidata = peakAlign(msidata, method='$method.methods_conditional.methods_for_alignment.alignment_method',gap = $method.methods_conditional.methods_for_alignment.gap_DPalignment, ref=align_peak_reference)
-
-           #end if
+            #if str($method.methods_conditional.imzml_output) == "cont_format":
+                #set $continuous_format = True
+            #end if
 
             ############################### QC ###########################
 
@@ -239,8 +277,7 @@
             aligned = c(minmz, maxmz,maxfeatures, pixelcount)
             QC_numbers= cbind(QC_numbers, aligned)
             vectorofactions = append(vectorofactions, "aligned")
-            for (random_sample in 1:length(random_spectra)){
-                plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))}
+            print(plot(msidata, pixel=random_spectra))
             title("Spectra after alignment", outer=TRUE, line=0)
 
     ############################### Peak filtering ###########################
@@ -248,7 +285,8 @@
         #elif str( $method.methods_conditional.preprocessing_method) == 'Peak_filtering':
             print('Peak_filtering')
 
-            msidata = peakFilter(msidata, method='freq', freq.min = $method.methods_conditional.frequ_filtering)
+            msidata = peakFilter(msidata, freq.min = $method.methods_conditional.frequ_filtering)
+            msidata <- process(msidata, BPPARAM=MulticoreParam())
 
             ############################### QC ###########################
 
@@ -259,8 +297,7 @@
             filtered = c(minmz, maxmz,maxfeatures, pixelcount)
             QC_numbers= cbind(QC_numbers, filtered)
             vectorofactions = append(vectorofactions, "filtered")
-            for (random_sample in 1:length(random_spectra)){
-                plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))}
+            print(plot(msidata, pixel=random_spectra))
             title("Spectra after filtering", outer=TRUE, line=0)
 
     ############################### Data reduction ###########################
@@ -268,6 +305,9 @@
         #elif str( $method.methods_conditional.preprocessing_method) == 'Data_reduction':
             print('Data_reduction')
 
+            ## these functions only work on MSImageSet
+            msidata = as(msidata, "MSImageSet")
+
             #if str( $method.methods_conditional.methods_for_reduction.reduction_method) == 'bin':
                 print('bin reduction')
 
@@ -302,6 +342,10 @@
 
                 msidata = reduceDimension(msidata, method="peaks", ref=peak_reference, type="$method.methods_conditional.methods_for_reduction.peaks_type")
             #end if
+
+            ## coercition into new format
+            msidata = as(msidata, "MSImagingExperiment")
+
             ############################### QC ###########################
 
             maxfeatures =nrow(msidata)
@@ -311,8 +355,7 @@
             reduced = c(minmz, maxmz,maxfeatures, pixelcount)
             QC_numbers= cbind(QC_numbers, reduced)
             vectorofactions = append(vectorofactions, "reduced")
-            for (random_sample in 1:length(random_spectra)){
-                plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))}
+            print(plot(msidata, pixel=random_spectra))
             title("Spectra after data reduction", outer=TRUE, line=0)
 
         ############################### Transformation ###########################
@@ -320,14 +363,15 @@
         #elif str( $method.methods_conditional.preprocessing_method) == 'Transformation':
             print('Transformation')
 
-            ## convert data into R matrix what brings it automatically into memory and can take some take but next steps need R matrix
-            ##iData(msidata) <- iData(msidata)[]
+            if (class(msidata) == "MSProcessedImagingExperiment"){
+                msidata = as(msidata, "MSContinuousImagingExperiment")
+            }
 
             #if str( $method.methods_conditional.transf_conditional.trans_type) == 'log2':
                 print('log2 transformation')
 
                 ## replace 0 with NA to prevent Inf
-                spectra_df = spectra(msidata)[] ## convert into R matrix
+                spectra_df = spectra(msidata) ## convert into R matrix
                 spectra_df[spectra_df ==0] = NA
                 print(paste0("Number of 0 which were converted into NA:",sum(is.na(spectra_df))))
                 spectra(msidata) = spectra_df
@@ -341,7 +385,7 @@
             #elif str( $method.methods_conditional.transf_conditional.trans_type) == 'sqrt':
                 print('squareroot transformation')
 
-                spectra(msidata) = sqrt(spectra(msidata)[])
+                spectra(msidata) = sqrt(spectra(msidata))
 
            #end if
 
@@ -354,8 +398,7 @@
             transformed = c(minmz, maxmz,maxfeatures, pixelcount)
             QC_numbers= cbind(QC_numbers, transformed)
             vectorofactions = append(vectorofactions, "transformed")
-            for (random_sample in 1:length(random_spectra)){
-                plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))}
+            print(plot(msidata, pixel=random_spectra))
             title("Spectra after transformation", outer=TRUE, line=0)
 
             #end if
@@ -366,22 +409,25 @@
 
     ## save msidata as imzML file, will only work if there is at least 1 m/z left
 
-    #if str($imzml_output) == "imzml_format":
         if (nrow(msidata) > 0){
             ## make sure that coordinates are integers
             coord(msidata)\$y = as.integer(coord(msidata)\$y)
             coord(msidata)\$x = as.integer(coord(msidata)\$x)
-            writeImzML(msidata, "out")}
-    #elif str($imzml_output) == "rdata_format":
-        ## save as (.RData)
-        iData(msidata) = iData(msidata)[]
-        save(msidata, file="$outfile_rdata")
-    #end if
+        #if $used_peak_picking:
+            #if $continuous_format:
+                msidata = as(msidata, "MSContinuousImagingExperiment")
+            #end if
+        #elif $used_peak_alignment
+            #if $continuous_format:
+                msidata = as(msidata, "MSContinuousImagingExperiment")
+            #end if
+        #end if
+        writeImzML(msidata, "out")
+        }
 
     plot(0,type='n',axes=FALSE,ann=FALSE)
     rownames(QC_numbers) = c("min m/z", "max mz", "# features", "# spectra")
     grid.table(t(QC_numbers))
-
     dev.off()
 
 }else{
@@ -395,7 +441,7 @@
         <repeat name="methods" title="Preprocessing" min="1" max="50">
             <conditional name="methods_conditional">
                 <param name="preprocessing_method" type="select" label="Preprocessing methods">
-                    <option value="Normalization" selected="True">Intensity Normalization (TIC)</option>
+                    <option value="Normalization" selected="True">Intensity Normalization</option>
                     <option value="Baseline_reduction">Baseline Reduction</option>
                     <option value="Smoothing">Peak smoothing</option>
                     <option value="Peak_picking">Peak picking</option>
@@ -404,7 +450,16 @@
                     <option value="Data_reduction">Data reduction</option>
                     <option value="Transformation">Transformation</option>
                 </param>
-                <when value="Normalization"/>
+                <when value="Normalization">
+                    <conditional name="methods_for_normalization">
+                        <param name="normalization_method" type="select" label="Normalization method">
+                            <option value="tic" selected="True">TIC</option>
+                            <option value="rms">RMS</option>
+                        </param>
+                        <when value="tic"/>
+                        <when value="rms"/>
+                    </conditional>
+                </when>
                 <when value="Baseline_reduction">
                     <param name="blocks_baseline" type="integer" value="500"
                         label="Blocks"/>
@@ -438,16 +493,16 @@
                                 label="Window size"/>
                 </when>
                 <when value="Peak_picking">
-                    <param name="SNR_picking_method" type="integer" value="6"
+                    <param name="SNR_picking_method" type="float" value="6"
                         label="Signal to noise ratio"
                         help="The minimal signal to noise ratio for peaks to be considered as a valid peak."/>
                     <param name="blocks_picking" type="integer" value="100" label = "Number of blocks"
                         help="Number of blocks in which to divide mass spectrum to calculate noise"/>
                     <param name="window_picking" type="float" value="5" label= "Window size" help="Window width for seeking local maxima"/>
                     <conditional name="methods_for_picking">
-                        <param name="picking_method" type="select" label="Peak picking method" help="only simple works for processed imzML files">
+                        <param name="picking_method" type="select" label="Peak picking method">
                             <option value="adaptive" selected="True">adaptive</option>
-                            <option value="limpic">limpic</option>
+                            <option value="mad">mad</option>
                             <option value="simple">simple</option>
                         </param>
                         <when value="adaptive">
@@ -457,50 +512,32 @@
                                   applied to the spectrum in order to decide the cutoffs 
                                   for throwing away false noise spikes that might occur inside peaks"/>
                         </when>
-                        <when value="limpic">
-                            <param name="tresh_picking" type="float" value="0.75"
-                                label="thresh value" help="The thresholding quantile to use when comparing slopes in order to throw away peaks that are too flat"/>
-                        </when> 
+                        <when value="mad"/>
                         <when value="simple"/>
                     </conditional>
+                <param name="imzml_output" type="boolean" label="imzML output in processed format" truevalue="proc_format" falsevalue="cont_format" help= "Processed imzML works only in MALDIquant tools, not yet in MSI tools (Cardinal)"/>
                 </when>
                 <when value="Peak_alignment">
-                    <conditional name="methods_for_alignment">
-                        <param name="alignment_method" type="select" label="Alignment method">
-                            <option value="diff" selected="True">diff</option>
-                            <option value="DP">DP</option>
-                        </param>
-                        <when value="diff">
-                            <param name="value_diffalignment" type="float" value="200"
-                                   label="diff.max" help="Peaks that differ less than this value will be aligned together"/>
-                            <param name="units_diffalignment" type="select" display="radio" optional="False" label="units">
-                                    <option value="ppm" selected="True">ppm</option>
-                                    <option value="mz">m/z</option>
-                            </param>
-                        </when>
-                        <when value="DP">
-                            <param name="gap_DPalignment" type="float" value="0"
-                                   label="Gap" help="The gap penalty for the dynamic programming sequence alignment"/>
-                        </when>
-                    </conditional>
+                    <param name="value_diffalignment" type="float" value="200"
+                           label="tolerance" help="Peaks that differ less than this value will be aligned together"/>
+                    <param name="units_diffalignment" type="select" display="radio" optional="False" label="units">
+                            <option value="ppm" selected="True">ppm</option>
+                            <option value="mz">m/z</option>
+                    </param>
                     <conditional name="align_ref_type">
                         <param name="align_reference_datatype" type="select" label="Choose reference">
                             <option value="align_noref" selected="True">no reference</option>
                             <option value="align_table" >tabular file as reference</option>
-                            <option value="align_msidata_ref">msidata file as reference</option>
                         </param>
                         <when value="align_noref"/>
                         <when value="align_table">
                             <expand macro="reading_1_column_mz_tabular" label="Tabular file with m/z features to use for alignment. Only the m/z values from the tabular file will be kept."/>
                         </when>
-                        <when value="align_msidata_ref">
-                            <param name="align_peaks_msidata" type="data" format="rdata" label="Picked and aligned Cardinal MSImageSet saved as RData"/>
-                        </when>
                     </conditional>
+                <param name="imzml_output" type="boolean" label="imzML output in processed format" truevalue="proc_format" falsevalue="cont_format" help= "Processed imzML works only in MALDIquant tools, not yet in MSI tools (Cardinal)"/>
                 </when>
                 <when value="Peak_filtering">
-                    <param name="frequ_filtering" type="integer" value="1000"
-                        label="Freq.min" help="Peaks that occur in the dataset fewer times than this will be removed. Number should be between 1 (no filtering) and number of spectra (pixel)"/>
+                    <param name="frequ_filtering" type="float" value="0.01" max="1" min="0" label="Minimum frequency" help="Peaks that occur in the dataset in lesser proportion than this will be dropped (0.01 --> filtering for 1% of spectra)"/>
                 </when>
                 <when value="Data_reduction">
                     <conditional name="methods_for_reduction">
@@ -563,19 +600,9 @@
                 </when>
             </conditional>
         </repeat>
-        <param name="imzml_output" type="select" display = "radio" optional = "False"
-               label="Output format" help= "Choose the output format">
-                <option value="imzml_format" >imzML</option>
-                <option value="rdata_format" selected="True" >RData</option>
-        </param>
     </inputs>
     <outputs>
-        <data format="imzml" name="outfile_imzml" label="${tool.name} on ${on_string}: imzML">
-            <filter>imzml_output=='imzml_format'</filter>
-        </data>
-        <data format="rdata" name="outfile_rdata" label="${tool.name} on ${on_string}: RData">
-            <filter>imzml_output == 'rdata_format'</filter>
-        </data>
+        <data format="imzml" name="outfile_imzml" label="${tool.name} on ${on_string}: imzML"/>
         <data format="pdf" name="QC_overview" from_work_dir="Preprocessing.pdf" label = "${tool.name} on ${on_string}: QC"/>
     </outputs>
     <tests>
@@ -585,7 +612,7 @@
                 <conditional name="methods_conditional">
                     <param name="preprocessing_method" value="Normalization"/>
                     <conditional name="methods_for_normalization">
-                        <param name="normalization_method" value="median"/>
+                        <param name="normalization_method" value="tic"/>
                     </conditional>
                 </conditional>
             </repeat>
@@ -613,15 +640,12 @@
             <repeat name="methods">
                 <conditional name="methods_conditional">
                     <param name="preprocessing_method" value="Peak_alignment"/>
-                    <conditional name="methods_for_alignment">
-                        <param name="alignment_method" value="diff"/>
-                    </conditional>
                 </conditional>
             </repeat>
             <repeat name="methods">
                 <conditional name="methods_conditional">
                     <param name="preprocessing_method" value="Peak_filtering"/>
-                    <param name="frequ_filtering" value="2"/>
+                    <param name="frequ_filtering" value="0.3"/>
                 </conditional>
             </repeat>
             <repeat name="methods">
@@ -632,10 +656,9 @@
                         </conditional>
                 </conditional>
             </repeat>
-            <param name="imzml_output" value="imzml_format"/>
             <output name="QC_overview" file="preprocessing_results1.pdf" compare="sim_size"/>
             <output name="outfile_imzml" ftype="imzml" file="preprocessing_results1.imzml.txt" compare="sim_size">
-                <extra_files type="file" file="preprocessing_results1.imzml" name="imzml" lines_diff="4"/>
+                <extra_files type="file" file="preprocessing_results1.imzml" name="imzml" lines_diff="6"/>
                 <extra_files type="file" file="preprocessing_results1.ibd" name="ibd" compare="sim_size"/>
             </output>
         </test>
@@ -655,15 +678,11 @@
             <repeat name="methods">
                 <conditional name="methods_conditional">
                     <param name="preprocessing_method" value="Peak_alignment"/>
-                    <conditional name="methods_for_alignment">
-                        <param name="alignment_method" value="DP"/>
-                    </conditional>
                 </conditional>
             </repeat>
-            <param name="imzml_output" value="imzml_format"/>
             <output name="QC_overview" file="preprocessing_results2.pdf" compare="sim_size"/>
             <output name="outfile_imzml" ftype="imzml" file="preprocessing_results2.imzml.txt" compare="sim_size">
-                <extra_files type="file" file="preprocessing_results2.imzml" name="imzml" lines_diff="4"/>
+                <extra_files type="file" file="preprocessing_results2.imzml" name="imzml" lines_diff="6"/>
                 <extra_files type="file" file="preprocessing_results2.ibd" name="ibd" compare="sim_size"/>
             </output>
         </test>
@@ -673,7 +692,7 @@
                 <conditional name="methods_conditional">
                     <param name="preprocessing_method" value="Normalization"/>
                     <conditional name="methods_for_normalization">
-                        <param name="normalization_method" value="median"/>
+                        <param name="normalization_method" value="rms"/>
                     </conditional>
                 </conditional>
             </repeat>
@@ -683,21 +702,29 @@
                     <param name="blocks_picking" value="100"/>
                     <param name="window_picking" value="5"/>
                     <param name="SNR_picking_method" value="3"/>
-                        <param name="picking_method" value="limpic"/>
+                    <conditional name="methods_for_picking">
+                        <param name="picking_method" value="mad"/>
+                    </conditional>
                 </conditional>
+                <param name="imzml_output" value="proc_format"/>
             </repeat>
             <repeat name="methods">
                 <conditional name="methods_conditional">
                     <param name="preprocessing_method" value="Peak_alignment"/>
-                    <conditional name="methods_for_alignment">
-                        <param name="alignment_method" value="diff"/>
-                    </conditional>
+                </conditional>
+            <param name="imzml_output" value="proc_format"/>
+            </repeat>
+            <repeat name="methods">
+                <conditional name="methods_conditional">
+                    <param name="preprocessing_method" value="Transformation"/>
+                        <conditional name="transf_conditional">
+                            <param name="trans_type" value="log2"/>
+                        </conditional>
                 </conditional>
             </repeat>
-            <param name="imzml_output" value="imzml_format"/>
             <output name="QC_overview" file="preprocessing_results3.pdf" compare="sim_size"/>
             <output name="outfile_imzml" ftype="imzml" file="preprocessing_results3.imzml.txt" compare="sim_size">
-                <extra_files type="file" file="preprocessing_results3.imzml" name="imzml" lines_diff="4"/>
+                <extra_files type="file" file="preprocessing_results3.imzml" name="imzml" lines_diff="6"/>
                 <extra_files type="file" file="preprocessing_results3.ibd" name="ibd" compare="sim_size"/>
             </output>
         </test>
@@ -706,35 +733,49 @@
             <repeat name="methods">
                 <conditional name="methods_conditional">
                     <param name="preprocessing_method" value="Normalization"/>
+                    <param name="normalization_method" value="tic"/>
                 </conditional>
             </repeat>
             <repeat name="methods">
                 <conditional name="methods_conditional">
                     <param name="preprocessing_method" value="Data_reduction"/>
-                    <param name="bin_width" value="0.1"/>
+                    <conditional name="methods_for_reduction">
+                        <param name="reduction_method" value="bin"/>
+                        <param name="bin_width" value="0.1"/>
+                    </conditional>
                 </conditional>
             </repeat>
-            <param name="imzml_output" value="imzml_format"/>
             <output name="QC_overview" file="preprocessing_results4.pdf" compare="sim_size"/>
             <output name="outfile_imzml" ftype="imzml" file="preprocessing_results4.imzml.txt" compare="sim_size">
-                <extra_files type="file" file="preprocessing_results4.imzml" name="imzml" lines_diff="4"/>
+                <extra_files type="file" file="preprocessing_results4.imzml" name="imzml" lines_diff="6"/>
                 <extra_files type="file" file="preprocessing_results4.ibd" name="ibd" compare="sim_size"/>
             </output>
         </test>
         <test>
-            <expand macro="infile_imzml"/>
+            <expand macro="processed_infile_imzml"/>
+            <conditional name="processed_cond">
+                <param name="processed_file" value="processed"/>
+                <param name="accuracy" value="100"/>
+                <param name="units" value="ppm"/>
+            </conditional>
             <repeat name="methods">
                 <conditional name="methods_conditional">
-                    <param name="preprocessing_method" value="Data_reduction"/>
-                        <conditional name="methods_for_reduction">
-                            <param name="reduction_method" value="resample"/>
-                            <param name="step_width" value="0.1"/>
+                    <param name="preprocessing_method" value="Transformation"/>
+                        <conditional name="transf_conditional">
+                            <param name="trans_type" value="sqrt"/>
                         </conditional>
                 </conditional>
             </repeat>
-            <param name="imzml_output" value="rdata_format"/>
-            <output name="outfile_rdata" file="preprocessing_results5.RData" compare="sim_size"/>
+            <repeat name="methods">
+                <conditional name="methods_conditional">
+                    <param name="preprocessing_method" value="Baseline_reduction"/>
+                </conditional>
+            </repeat>
             <output name="QC_overview" file="preprocessing_results5.pdf" compare="sim_size"/>
+            <output name="outfile_imzml" ftype="imzml" file="preprocessing_results5.imzml.txt" compare="sim_size">
+                <extra_files type="file" file="preprocessing_results5.imzml" name="imzml" lines_diff="6"/>
+                <extra_files type="file" file="preprocessing_results5.ibd" name="ibd" compare="sim_size"/>
+            </output>
         </test>
     </tests>
     <help>
@@ -752,7 +793,7 @@
 
 **Options**
 
-- Normalization: Normalization of intensities to total ion current (TIC)
+- Normalization: Normalization of intensities to total ion current (TIC) or to root-mean-square (RMS)
 - Baseline reduction: Baseline  reduction removes background intensity generated by chemical noise (common in MALDI datasets)
 - Smoothing: Smoothing of the peaks reduces noise and improves peak detection
 - Peak picking: relevant peaks are picked while noise-peaks are removed (needs peak alignment afterwards)
@@ -761,14 +802,9 @@
 - Data reduction: binning, resampling or peak filtering to reduce data
 - Transformation: log2 or squareroot transformation of all intensities; when using log2 transformation zero intensities will become NA, this can lead to compatibility problems. 
 
-**Tips** 
-
-- Peak alignment works only after peak picking
-- Peak filtering works only on centroided data (peak picking and alignment or Data reduction peaks
-
 **Output**
 
-- MSI data as imzML file or .RData (can be read with the Cardinal package in R)
+- MSI data as continuous imzML file (option to output processed imzML file only after peak picking/peak alignment; but is not yet compatible with other MSI tools) 
 - pdf with key values and four random mass spectra after each processing step
 
         ]]>
Binary file test-data/analyze75_filtered2.pdf has changed
Binary file test-data/imzml_filtered3.pdf has changed
Binary file test-data/imzml_filtered4.pdf has changed
Binary file test-data/imzml_filtered5.pdf has changed
Binary file test-data/imzml_filtered8.pdf has changed
Binary file test-data/out3.ibd has changed
--- a/test-data/out3.imzml	Fri Dec 13 13:57:13 2019 -0500
+++ b/test-data/out3.imzml	Wed Mar 25 08:13:17 2020 -0400
@@ -9,8 +9,8 @@
 		<fileContent>
 			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
 			<cvParam cvRef="MS" accession="MS:1000128" name="profile spectrum" value="" />
-			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="{AEDF2DEE-A321-4DAF-B971-943AE2AF79A6}" />
-			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="8311A159EC925605745E409F14BB6C570FF59ACA" />
+			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="7cde7a72-9a6b-4ed9-a809-79ca20bf45b4" />
+			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="4a26497a6ddfc9a61e9c0e463e4c246c5d734f80" />
 			<cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" />
 		</fileContent>
 	</fileDescription>
@@ -22,19 +22,18 @@
 		</referenceableParamGroup>
 		<referenceableParamGroup id="scan1">
 			<cvParam cvRef="MS" accession="MS:1000093" name="increasing m/z scan" value="" />
-			<cvParam cvRef="MS" accession="MS:1000095" name="linear" value="" />
 		</referenceableParamGroup>
 		<referenceableParamGroup id="mzArray">
 			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
 			<cvParam cvRef="MS" accession="MS:1000514" name="m/z array" value="" unitCvRef="MS" unitAccession="MS:1000040" unitName="m/z" />
 			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
-			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="32-bit float" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
 		</referenceableParamGroup>
 		<referenceableParamGroup id="intensityArray">
 			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
 			<cvParam cvRef="MS" accession="MS:1000515" name="intensity array" value="" unitCvRef="MS" unitAccession="MS:1000131" unitName="number of counts" />
 			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
-			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="32-bit float" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
 		</referenceableParamGroup>
 	</referenceableParamGroupList>
 	<sampleList count="1">
@@ -43,18 +42,24 @@
 		</sample>
 	</sampleList>
 	<softwareList count="1">
-		<software id="Cardinal" version="1.12.1">
+		<software id="Cardinal" version="2.4.0">
 			<cvParam cvRef="MS" accession="MS:1000799" name="custom unreleased software tool" value="" />
 		</software>
 	</softwareList>
 	<scanSettingsList count="1">
 		<scanSettings id="scansettings1">
 			<cvParam cvRef="IMS" accession="IMS:1000042" name="max count of pixel x" value="3" />
-			<cvParam cvRef="IMS" accession="IMS:1000043" name="max count of pixel y" value="2" />
+			<cvParam cvRef="IMS" accession="IMS:1000043" name="max count of pixel y" value="1" />
+			<cvParam cvRef="IMS" accession="IMS:1000044" name="max dimension x" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000045" name="max dimension y" value="2" />
+			<cvParam cvRef="IMS" accession="IMS:1000046" name="pixel size x" value="1.000000" />
+			<cvParam cvRef="IMS" accession="IMS:1000047" name="pixel size y" value="Inf" />
 		</scanSettings>
 	</scanSettingsList>
 	<instrumentConfigurationList count="1">
-		<instrumentConfiguration id="IC1" />
+		<instrumentConfiguration id="IC1">
+			<cvParam cvRef="MS" accession="MS:1000031" name="instrument model" />
+		</instrumentConfiguration>
 	</instrumentConfigurationList>
 	<dataProcessingList count="1">
 		<dataProcessing id="CardinalWriteImzML">
@@ -73,6 +78,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -100,6 +107,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -127,6 +136,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
--- a/test-data/out3.imzml.txt	Fri Dec 13 13:57:13 2019 -0500
+++ b/test-data/out3.imzml.txt	Wed Mar 25 08:13:17 2020 -0400
@@ -1,4 +1,4 @@
 imzML file:
 total 24
--rw-r--r-- 1 meli meli 9616 Feb 12 19:18 ibd
--rw-r--r-- 1 meli meli 8282 Feb 12 19:18 imzml
+-rw-r--r-- 1 meli meli 9616 Mär 24 20:25 ibd
+-rw-r--r-- 1 meli meli 8958 Mär 24 20:25 imzml
Binary file test-data/out4.ibd has changed
--- a/test-data/out4.imzml	Fri Dec 13 13:57:13 2019 -0500
+++ b/test-data/out4.imzml	Wed Mar 25 08:13:17 2020 -0400
@@ -9,8 +9,8 @@
 		<fileContent>
 			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
 			<cvParam cvRef="MS" accession="MS:1000128" name="profile spectrum" value="" />
-			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="{2567A8C4-D2AF-4C81-874C-82E9134A080C}" />
-			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="EA722C9CF5A229ACF6AEAD177908D73A1C8CB44E" />
+			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="b0dec95e-b66f-4c3f-86df-166d942f42c3" />
+			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="d9b557cf2c0e15a0cdd863e50897b07a55a26f31" />
 			<cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" />
 		</fileContent>
 	</fileDescription>
@@ -22,19 +22,18 @@
 		</referenceableParamGroup>
 		<referenceableParamGroup id="scan1">
 			<cvParam cvRef="MS" accession="MS:1000093" name="increasing m/z scan" value="" />
-			<cvParam cvRef="MS" accession="MS:1000095" name="linear" value="" />
 		</referenceableParamGroup>
 		<referenceableParamGroup id="mzArray">
 			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
 			<cvParam cvRef="MS" accession="MS:1000514" name="m/z array" value="" unitCvRef="MS" unitAccession="MS:1000040" unitName="m/z" />
 			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
-			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="32-bit float" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
 		</referenceableParamGroup>
 		<referenceableParamGroup id="intensityArray">
 			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
 			<cvParam cvRef="MS" accession="MS:1000515" name="intensity array" value="" unitCvRef="MS" unitAccession="MS:1000131" unitName="number of counts" />
 			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
-			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="32-bit float" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
 		</referenceableParamGroup>
 	</referenceableParamGroupList>
 	<sampleList count="1">
@@ -43,18 +42,24 @@
 		</sample>
 	</sampleList>
 	<softwareList count="1">
-		<software id="Cardinal" version="1.12.1">
+		<software id="Cardinal" version="2.4.0">
 			<cvParam cvRef="MS" accession="MS:1000799" name="custom unreleased software tool" value="" />
 		</software>
 	</softwareList>
 	<scanSettingsList count="1">
 		<scanSettings id="scansettings1">
-			<cvParam cvRef="IMS" accession="IMS:1000042" name="max count of pixel x" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000042" name="max count of pixel x" value="2" />
 			<cvParam cvRef="IMS" accession="IMS:1000043" name="max count of pixel y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000044" name="max dimension x" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000045" name="max dimension y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000046" name="pixel size x" value="2.000000" />
+			<cvParam cvRef="IMS" accession="IMS:1000047" name="pixel size y" value="1.000000" />
 		</scanSettings>
 	</scanSettingsList>
 	<instrumentConfigurationList count="1">
-		<instrumentConfiguration id="IC1" />
+		<instrumentConfiguration id="IC1">
+			<cvParam cvRef="MS" accession="MS:1000031" name="instrument model" />
+		</instrumentConfiguration>
 	</instrumentConfigurationList>
 	<dataProcessingList count="1">
 		<dataProcessing id="CardinalWriteImzML">
@@ -73,6 +78,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -100,6 +107,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -127,6 +136,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -154,6 +165,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -181,6 +194,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
--- a/test-data/out4.imzml.txt	Fri Dec 13 13:57:13 2019 -0500
+++ b/test-data/out4.imzml.txt	Wed Mar 25 08:13:17 2020 -0400
@@ -1,4 +1,4 @@
 imzML file:
 total 44
--rw-r--r-- 1 meli meli 28792 Feb 12 00:49 ibd
--rw-r--r-- 1 meli meli 11141 Feb 12 00:49 imzml
+-rw-r--r-- 1 meli meli 28792 Mär 24 19:23 ibd
+-rw-r--r-- 1 meli meli 12046 Mär 24 19:23 imzml
Binary file test-data/out5.ibd has changed
--- a/test-data/out5.imzml	Fri Dec 13 13:57:13 2019 -0500
+++ b/test-data/out5.imzml	Wed Mar 25 08:13:17 2020 -0400
@@ -9,8 +9,8 @@
 		<fileContent>
 			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
 			<cvParam cvRef="MS" accession="MS:1000128" name="profile spectrum" value="" />
-			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="{CC0B2B92-FB40-42C8-822F-834AA528954C}" />
-			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="0B644915E88274BE83FBB110D4CC6D0CDFABAAAC" />
+			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="87b0ab73-abe6-4eb6-91ba-b6d493a343bc" />
+			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="9de3a02d0943ecda0717845511a8f7b8f58d1db7" />
 			<cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" />
 		</fileContent>
 	</fileDescription>
@@ -22,19 +22,18 @@
 		</referenceableParamGroup>
 		<referenceableParamGroup id="scan1">
 			<cvParam cvRef="MS" accession="MS:1000093" name="increasing m/z scan" value="" />
-			<cvParam cvRef="MS" accession="MS:1000095" name="linear" value="" />
 		</referenceableParamGroup>
 		<referenceableParamGroup id="mzArray">
 			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
 			<cvParam cvRef="MS" accession="MS:1000514" name="m/z array" value="" unitCvRef="MS" unitAccession="MS:1000040" unitName="m/z" />
 			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
-			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="32-bit float" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
 		</referenceableParamGroup>
 		<referenceableParamGroup id="intensityArray">
 			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
 			<cvParam cvRef="MS" accession="MS:1000515" name="intensity array" value="" unitCvRef="MS" unitAccession="MS:1000131" unitName="number of counts" />
 			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
-			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="32-bit float" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
 		</referenceableParamGroup>
 	</referenceableParamGroupList>
 	<sampleList count="1">
@@ -43,18 +42,24 @@
 		</sample>
 	</sampleList>
 	<softwareList count="1">
-		<software id="Cardinal" version="1.12.1">
+		<software id="Cardinal" version="2.4.0">
 			<cvParam cvRef="MS" accession="MS:1000799" name="custom unreleased software tool" value="" />
 		</software>
 	</softwareList>
 	<scanSettingsList count="1">
 		<scanSettings id="scansettings1">
 			<cvParam cvRef="IMS" accession="IMS:1000042" name="max count of pixel x" value="3" />
-			<cvParam cvRef="IMS" accession="IMS:1000043" name="max count of pixel y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000043" name="max count of pixel y" value="2" />
+			<cvParam cvRef="IMS" accession="IMS:1000044" name="max dimension x" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000045" name="max dimension y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000046" name="pixel size x" value="1.000000" />
+			<cvParam cvRef="IMS" accession="IMS:1000047" name="pixel size y" value="1.000000" />
 		</scanSettings>
 	</scanSettingsList>
 	<instrumentConfigurationList count="1">
-		<instrumentConfiguration id="IC1" />
+		<instrumentConfiguration id="IC1">
+			<cvParam cvRef="MS" accession="MS:1000031" name="instrument model" />
+		</instrumentConfiguration>
 	</instrumentConfigurationList>
 	<dataProcessingList count="1">
 		<dataProcessing id="CardinalWriteImzML">
@@ -73,6 +78,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -100,6 +107,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -127,6 +136,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -154,6 +165,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -181,6 +194,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -208,6 +223,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
--- a/test-data/out5.imzml.txt	Fri Dec 13 13:57:13 2019 -0500
+++ b/test-data/out5.imzml.txt	Wed Mar 25 08:13:17 2020 -0400
@@ -1,4 +1,4 @@
 imzML file:
 total 20
--rw-r--r-- 1 meli meli   380 Feb 12 00:50 ibd
--rw-r--r-- 1 meli meli 12508 Feb 12 00:50 imzml
+-rw-r--r-- 1 meli meli   380 Mär 24 19:24 ibd
+-rw-r--r-- 1 meli meli 13525 Mär 24 19:24 imzml
Binary file test-data/out6.ibd has changed
--- a/test-data/out6.imzml	Fri Dec 13 13:57:13 2019 -0500
+++ b/test-data/out6.imzml	Wed Mar 25 08:13:17 2020 -0400
@@ -9,8 +9,8 @@
 		<fileContent>
 			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
 			<cvParam cvRef="MS" accession="MS:1000128" name="profile spectrum" value="" />
-			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="{24BF18EC-E1DE-4B67-BC12-C3EB475CFC0A}" />
-			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="DA0417F6AA4EDD71F808B6EA0D7A0706737464EB" />
+			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="8b625a26-987e-4e32-b7d4-729efe840814" />
+			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="78e6eb56507d789575ee0495e60f9d44a192c0dd" />
 			<cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" />
 		</fileContent>
 	</fileDescription>
@@ -22,19 +22,18 @@
 		</referenceableParamGroup>
 		<referenceableParamGroup id="scan1">
 			<cvParam cvRef="MS" accession="MS:1000093" name="increasing m/z scan" value="" />
-			<cvParam cvRef="MS" accession="MS:1000095" name="linear" value="" />
 		</referenceableParamGroup>
 		<referenceableParamGroup id="mzArray">
 			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
 			<cvParam cvRef="MS" accession="MS:1000514" name="m/z array" value="" unitCvRef="MS" unitAccession="MS:1000040" unitName="m/z" />
 			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
-			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="32-bit float" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
 		</referenceableParamGroup>
 		<referenceableParamGroup id="intensityArray">
 			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
 			<cvParam cvRef="MS" accession="MS:1000515" name="intensity array" value="" unitCvRef="MS" unitAccession="MS:1000131" unitName="number of counts" />
 			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
-			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="32-bit float" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
 		</referenceableParamGroup>
 	</referenceableParamGroupList>
 	<sampleList count="1">
@@ -43,7 +42,7 @@
 		</sample>
 	</sampleList>
 	<softwareList count="1">
-		<software id="Cardinal" version="1.12.1">
+		<software id="Cardinal" version="2.4.0">
 			<cvParam cvRef="MS" accession="MS:1000799" name="custom unreleased software tool" value="" />
 		</software>
 	</softwareList>
@@ -51,10 +50,16 @@
 		<scanSettings id="scansettings1">
 			<cvParam cvRef="IMS" accession="IMS:1000042" name="max count of pixel x" value="3" />
 			<cvParam cvRef="IMS" accession="IMS:1000043" name="max count of pixel y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000044" name="max dimension x" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000045" name="max dimension y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000046" name="pixel size x" value="1.000000" />
+			<cvParam cvRef="IMS" accession="IMS:1000047" name="pixel size y" value="1.000000" />
 		</scanSettings>
 	</scanSettingsList>
 	<instrumentConfigurationList count="1">
-		<instrumentConfiguration id="IC1" />
+		<instrumentConfiguration id="IC1">
+			<cvParam cvRef="MS" accession="MS:1000031" name="instrument model" />
+		</instrumentConfiguration>
 	</instrumentConfigurationList>
 	<dataProcessingList count="1">
 		<dataProcessing id="CardinalWriteImzML">
@@ -73,6 +78,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -100,6 +107,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -127,6 +136,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -154,6 +165,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -181,6 +194,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -208,6 +223,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -235,6 +252,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -262,6 +281,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -289,6 +310,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
--- a/test-data/out6.imzml.txt	Fri Dec 13 13:57:13 2019 -0500
+++ b/test-data/out6.imzml.txt	Wed Mar 25 08:13:17 2020 -0400
@@ -1,4 +1,4 @@
 imzML file:
 total 164
--rw-r--r-- 1 meli meli 146896 Feb 12 00:51 ibd
--rw-r--r-- 1 meli meli  16868 Feb 12 00:51 imzml
+-rw-r--r-- 1 meli meli 146896 Mär 24 19:25 ibd
+-rw-r--r-- 1 meli meli  18221 Mär 24 19:25 imzml
Binary file test-data/out7.ibd has changed
--- a/test-data/out7.imzml	Fri Dec 13 13:57:13 2019 -0500
+++ b/test-data/out7.imzml	Wed Mar 25 08:13:17 2020 -0400
@@ -9,8 +9,8 @@
 		<fileContent>
 			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
 			<cvParam cvRef="MS" accession="MS:1000128" name="profile spectrum" value="" />
-			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="{B095BB77-684D-4BFF-82D3-B76D0EB1C0CD}" />
-			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="628A551B81DCF301B65E3A5AB1182F0BF319533C" />
+			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="bf61653e-aa1a-4f9a-a84d-3ff3435ee7fe" />
+			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="352c33defde6728b7dfb83e18ed1c433fa4b8697" />
 			<cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" />
 		</fileContent>
 	</fileDescription>
@@ -22,19 +22,18 @@
 		</referenceableParamGroup>
 		<referenceableParamGroup id="scan1">
 			<cvParam cvRef="MS" accession="MS:1000093" name="increasing m/z scan" value="" />
-			<cvParam cvRef="MS" accession="MS:1000095" name="linear" value="" />
 		</referenceableParamGroup>
 		<referenceableParamGroup id="mzArray">
 			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
 			<cvParam cvRef="MS" accession="MS:1000514" name="m/z array" value="" unitCvRef="MS" unitAccession="MS:1000040" unitName="m/z" />
 			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
-			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="32-bit float" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
 		</referenceableParamGroup>
 		<referenceableParamGroup id="intensityArray">
 			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
 			<cvParam cvRef="MS" accession="MS:1000515" name="intensity array" value="" unitCvRef="MS" unitAccession="MS:1000131" unitName="number of counts" />
 			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
-			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="32-bit float" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
 		</referenceableParamGroup>
 	</referenceableParamGroupList>
 	<sampleList count="1">
@@ -43,7 +42,7 @@
 		</sample>
 	</sampleList>
 	<softwareList count="1">
-		<software id="Cardinal" version="1.12.1">
+		<software id="Cardinal" version="2.4.0">
 			<cvParam cvRef="MS" accession="MS:1000799" name="custom unreleased software tool" value="" />
 		</software>
 	</softwareList>
@@ -51,10 +50,16 @@
 		<scanSettings id="scansettings1">
 			<cvParam cvRef="IMS" accession="IMS:1000042" name="max count of pixel x" value="3" />
 			<cvParam cvRef="IMS" accession="IMS:1000043" name="max count of pixel y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000044" name="max dimension x" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000045" name="max dimension y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000046" name="pixel size x" value="1.000000" />
+			<cvParam cvRef="IMS" accession="IMS:1000047" name="pixel size y" value="1.000000" />
 		</scanSettings>
 	</scanSettingsList>
 	<instrumentConfigurationList count="1">
-		<instrumentConfiguration id="IC1" />
+		<instrumentConfiguration id="IC1">
+			<cvParam cvRef="MS" accession="MS:1000031" name="instrument model" />
+		</instrumentConfiguration>
 	</instrumentConfigurationList>
 	<dataProcessingList count="1">
 		<dataProcessing id="CardinalWriteImzML">
@@ -73,6 +78,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -100,6 +107,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -127,6 +136,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -154,6 +165,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -181,6 +194,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -208,6 +223,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -235,6 +252,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -262,6 +281,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
@@ -289,6 +310,8 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
--- a/test-data/out7.imzml.txt	Fri Dec 13 13:57:13 2019 -0500
+++ b/test-data/out7.imzml.txt	Wed Mar 25 08:13:17 2020 -0400
@@ -1,4 +1,4 @@
 imzML file:
 total 116
--rw-r--r-- 1 meli meli 95976 Feb 12 00:51 ibd
--rw-r--r-- 1 meli meli 16846 Feb 12 00:51 imzml
+-rw-r--r-- 1 meli meli 95976 Mär 24 19:26 ibd
+-rw-r--r-- 1 meli meli 18199 Mär 24 19:26 imzml
Binary file test-data/out8.ibd has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/out8.imzml	Wed Mar 25 08:13:17 2020 -0400
@@ -0,0 +1,224 @@
+<?xml version="1.0"?>
+<mzML version="1.1" xmlns="http://psi.hupo.org/ms/mzml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://psi.hupo.org/ms/mzml http://psidev.info/files/ms/mzML/xsd/mzML1.1.0_idx.xsd">
+	<cvList count="3">
+		<cv id="MS" fullName="Proteomics Standards Initiative Mass Spectrometry Ontology" version="1.3.1" URI="http://psidev.info/ms/mzML/psi-ms.obo" />
+		<cv id="UO" fullName="Unit Ontology" version="1.15" URI="http://obo.cvs.sourceforge.net/obo/obo/ontology/phenotype/unit.obo" />
+		<cv id="IMS" fullName="Imaging MS Ontology" version="0.9.1" URI="http://www.maldi-msi.org/download/imzml/imagingMS.obo" />
+	</cvList>
+	<fileDescription>
+		<fileContent>
+			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
+			<cvParam cvRef="MS" accession="MS:1000128" name="profile spectrum" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="ace74b18-25e2-4722-89f4-6eedc2b62ed8" />
+			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="41d580d8acf3e67df8b63f001fe941da7334861b" />
+			<cvParam cvRef="IMS" accession="IMS:1000031" name="processed" value="" />
+		</fileContent>
+	</fileDescription>
+	<referenceableParamGroupList count="4">
+		<referenceableParamGroup id="spectrum1">
+			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
+			<cvParam cvRef="MS" accession="MS:1000511" name="ms level" value="0" />
+			<cvParam cvRef="MS" accession="MS:1000128" name="profile spectrum" value="" />
+		</referenceableParamGroup>
+		<referenceableParamGroup id="scan1">
+			<cvParam cvRef="MS" accession="MS:1000093" name="increasing m/z scan" value="" />
+		</referenceableParamGroup>
+		<referenceableParamGroup id="mzArray">
+			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
+			<cvParam cvRef="MS" accession="MS:1000514" name="m/z array" value="" unitCvRef="MS" unitAccession="MS:1000040" unitName="m/z" />
+			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
+		</referenceableParamGroup>
+		<referenceableParamGroup id="intensityArray">
+			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
+			<cvParam cvRef="MS" accession="MS:1000515" name="intensity array" value="" unitCvRef="MS" unitAccession="MS:1000131" unitName="number of counts" />
+			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
+		</referenceableParamGroup>
+	</referenceableParamGroupList>
+	<sampleList count="1">
+		<sample id="sample1" name="Sample1">
+			<cvParam cvRef="MS" accession="MS:1000001" name="sample number" value="1" />
+		</sample>
+	</sampleList>
+	<softwareList count="1">
+		<software id="Cardinal" version="2.4.0">
+			<cvParam cvRef="MS" accession="MS:1000799" name="custom unreleased software tool" value="" />
+		</software>
+	</softwareList>
+	<scanSettingsList count="1">
+		<scanSettings id="scansettings1">
+			<cvParam cvRef="IMS" accession="IMS:1000401" name="top down" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000413" name="flyback" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000480" name="horizontal line scan" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000491" name="linescan left right" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000042" name="max count of pixel x" value="2" />
+			<cvParam cvRef="IMS" accession="IMS:1000043" name="max count of pixel y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000044" name="max dimension x" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000045" name="max dimension y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000046" name="pixel size x" value="2.000000" />
+			<cvParam cvRef="IMS" accession="IMS:1000047" name="pixel size y" value="1.000000" />
+		</scanSettings>
+	</scanSettingsList>
+	<instrumentConfigurationList count="1">
+		<instrumentConfiguration id="IC1">
+			<cvParam cvRef="MS" accession="MS:1000031" name="instrument model" />
+		</instrumentConfiguration>
+	</instrumentConfigurationList>
+	<dataProcessingList count="1">
+		<dataProcessing id="CardinalWriteImzML">
+			<processingMethod order="1" softwareRef="Cardinal">
+				<cvParam cvRef="MS" accession="MS:1000544" name="Conversion to mzML" value="" />
+			</processingMethod>
+		</dataProcessing>
+	</dataProcessingList>
+	<run defaultInstrumentConfigurationRef="IC1" id="Experiment01" sampleRef="sample1">
+		<spectrumList count="5" defaultDataProcessingRef="CardinalWriteImzML">
+			<spectrum id="Spectrum=1" defaultArrayLength="0" index="1">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="33612" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=2" defaultArrayLength="0" index="2">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="67208" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="100804" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=3" defaultArrayLength="0" index="3">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="134400" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="167996" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=4" defaultArrayLength="0" index="4">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="201592" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="235188" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=5" defaultArrayLength="0" index="5">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="268784" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="302380" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+		</spectrumList>
+	</run>
+</mzML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/out8.imzml.txt	Wed Mar 25 08:13:17 2020 -0400
@@ -0,0 +1,4 @@
+imzML file:
+total 348
+-rw-r--r-- 1 meli meli 335976 Mär 24 19:27 ibd
+-rw-r--r-- 1 meli meli  12402 Mär 24 19:27 imzml
Binary file test-data/preprocessing_results1.ibd has changed
--- a/test-data/preprocessing_results1.imzml	Fri Dec 13 13:57:13 2019 -0500
+++ b/test-data/preprocessing_results1.imzml	Wed Mar 25 08:13:17 2020 -0400
@@ -9,8 +9,8 @@
 		<fileContent>
 			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
 			<cvParam cvRef="MS" accession="MS:1000127" name="centroid spectrum" value="" />
-			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="{728FBFFE-E6FC-4283-8068-393A66F6BD5C}" />
-			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="375094460F3B80674CB2F541DCD9928B3D61B2FF" />
+			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="722d404b-4188-40b4-a3b2-3764ebbdecad" />
+			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="c5aded0bab57fd7317901ff7709f2395fc91152e" />
 			<cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" />
 		</fileContent>
 	</fileDescription>
@@ -22,19 +22,18 @@
 		</referenceableParamGroup>
 		<referenceableParamGroup id="scan1">
 			<cvParam cvRef="MS" accession="MS:1000093" name="increasing m/z scan" value="" />
-			<cvParam cvRef="MS" accession="MS:1000095" name="linear" value="" />
 		</referenceableParamGroup>
 		<referenceableParamGroup id="mzArray">
 			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
 			<cvParam cvRef="MS" accession="MS:1000514" name="m/z array" value="" unitCvRef="MS" unitAccession="MS:1000040" unitName="m/z" />
 			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
-			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="32-bit float" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
 		</referenceableParamGroup>
 		<referenceableParamGroup id="intensityArray">
 			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
 			<cvParam cvRef="MS" accession="MS:1000515" name="intensity array" value="" unitCvRef="MS" unitAccession="MS:1000131" unitName="number of counts" />
 			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
-			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="32-bit float" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
 		</referenceableParamGroup>
 	</referenceableParamGroupList>
 	<sampleList count="1">
@@ -43,7 +42,7 @@
 		</sample>
 	</sampleList>
 	<softwareList count="1">
-		<software id="Cardinal" version="1.12.1">
+		<software id="Cardinal" version="2.4.0">
 			<cvParam cvRef="MS" accession="MS:1000799" name="custom unreleased software tool" value="" />
 		</software>
 	</softwareList>
@@ -51,10 +50,16 @@
 		<scanSettings id="scansettings1">
 			<cvParam cvRef="IMS" accession="IMS:1000042" name="max count of pixel x" value="3" />
 			<cvParam cvRef="IMS" accession="IMS:1000043" name="max count of pixel y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000044" name="max dimension x" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000045" name="max dimension y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000046" name="pixel size x" value="1.000000" />
+			<cvParam cvRef="IMS" accession="IMS:1000047" name="pixel size y" value="1.000000" />
 		</scanSettings>
 	</scanSettingsList>
 	<instrumentConfigurationList count="1">
-		<instrumentConfiguration id="IC1" />
+		<instrumentConfiguration id="IC1">
+			<cvParam cvRef="MS" accession="MS:1000031" name="instrument model" />
+		</instrumentConfiguration>
 	</instrumentConfigurationList>
 	<dataProcessingList count="1">
 		<dataProcessing id="CardinalWriteImzML">
@@ -73,21 +78,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="2" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="24" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="2" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="36" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -100,21 +107,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="2" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="32" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="2" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="56" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -127,21 +136,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="2" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="40" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="2" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="76" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -154,21 +165,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="2" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="48" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="2" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="96" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -181,21 +194,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="2" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="56" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="2" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="116" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -208,21 +223,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="2" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="64" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="2" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="136" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -235,21 +252,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="2" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="72" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="2" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="156" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -262,21 +281,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="2" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="80" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="2" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="176" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -289,21 +310,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="2" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="88" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="2" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="196" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
--- a/test-data/preprocessing_results1.imzml.txt	Fri Dec 13 13:57:13 2019 -0500
+++ b/test-data/preprocessing_results1.imzml.txt	Wed Mar 25 08:13:17 2020 -0400
@@ -1,4 +1,4 @@
 imzML file:
 total 24
--rw-r--r-- 1 meli meli    96 Feb 24 14:11 ibd
--rw-r--r-- 1 meli meli 16714 Feb 24 14:11 imzml
+-rw-r--r-- 1 meli meli   216 Mär 24 10:39 ibd
+-rw-r--r-- 1 meli meli 18090 Mär 24 10:39 imzml
Binary file test-data/preprocessing_results1.pdf has changed
Binary file test-data/preprocessing_results2.ibd has changed
--- a/test-data/preprocessing_results2.imzml	Fri Dec 13 13:57:13 2019 -0500
+++ b/test-data/preprocessing_results2.imzml	Wed Mar 25 08:13:17 2020 -0400
@@ -9,8 +9,8 @@
 		<fileContent>
 			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
 			<cvParam cvRef="MS" accession="MS:1000127" name="centroid spectrum" value="" />
-			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="{40F230A1-1893-4A8C-BAE2-A8BBEF24DB20}" />
-			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="417ADF38FBC4D0304A9B75B4C85799137846DD2F" />
+			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="e536d1e2-427b-4c5b-9743-8210ae52a564" />
+			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="7cea783e9d345946b874fc1f25d40ce90bffd2f9" />
 			<cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" />
 		</fileContent>
 	</fileDescription>
@@ -22,19 +22,18 @@
 		</referenceableParamGroup>
 		<referenceableParamGroup id="scan1">
 			<cvParam cvRef="MS" accession="MS:1000093" name="increasing m/z scan" value="" />
-			<cvParam cvRef="MS" accession="MS:1000095" name="linear" value="" />
 		</referenceableParamGroup>
 		<referenceableParamGroup id="mzArray">
 			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
 			<cvParam cvRef="MS" accession="MS:1000514" name="m/z array" value="" unitCvRef="MS" unitAccession="MS:1000040" unitName="m/z" />
 			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
-			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="32-bit float" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
 		</referenceableParamGroup>
 		<referenceableParamGroup id="intensityArray">
 			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
 			<cvParam cvRef="MS" accession="MS:1000515" name="intensity array" value="" unitCvRef="MS" unitAccession="MS:1000131" unitName="number of counts" />
 			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
-			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="32-bit float" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
 		</referenceableParamGroup>
 	</referenceableParamGroupList>
 	<sampleList count="1">
@@ -43,18 +42,24 @@
 		</sample>
 	</sampleList>
 	<softwareList count="1">
-		<software id="Cardinal" version="1.12.1">
+		<software id="Cardinal" version="2.4.0">
 			<cvParam cvRef="MS" accession="MS:1000799" name="custom unreleased software tool" value="" />
 		</software>
 	</softwareList>
 	<scanSettingsList count="1">
 		<scanSettings id="scansettings1">
-			<cvParam cvRef="IMS" accession="IMS:1000042" name="max count of pixel x" value="9" />
+			<cvParam cvRef="IMS" accession="IMS:1000042" name="max count of pixel x" value="4" />
 			<cvParam cvRef="IMS" accession="IMS:1000043" name="max count of pixel y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000044" name="max dimension x" value="9" />
+			<cvParam cvRef="IMS" accession="IMS:1000045" name="max dimension y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000046" name="pixel size x" value="1.000000" />
+			<cvParam cvRef="IMS" accession="IMS:1000047" name="pixel size y" value="1.000000" />
 		</scanSettings>
 	</scanSettingsList>
 	<instrumentConfigurationList count="1">
-		<instrumentConfiguration id="IC1" />
+		<instrumentConfiguration id="IC1">
+			<cvParam cvRef="MS" accession="MS:1000031" name="instrument model" />
+		</instrumentConfiguration>
 	</instrumentConfigurationList>
 	<dataProcessingList count="1">
 		<dataProcessing id="CardinalWriteImzML">
@@ -73,21 +78,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="4224" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="2892" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -100,21 +107,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="8432" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="5768" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -127,21 +136,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="12640" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="8644" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -154,21 +165,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16848" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="11520" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -181,21 +194,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="4" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="4.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="21056" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="14396" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -208,21 +223,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="25264" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="17272" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -235,21 +252,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="4" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="4.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="29472" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="20148" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -262,21 +281,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="33680" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="23024" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -289,21 +310,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="4" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="4.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="37888" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="25900" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -316,21 +339,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="9" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="9.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="42096" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="28776" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -343,21 +368,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="9" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="9.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="46304" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="31652" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -370,21 +397,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="9" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="9.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="50512" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1052" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="4208" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="34528" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="719" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="2876" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
--- a/test-data/preprocessing_results2.imzml.txt	Fri Dec 13 13:57:13 2019 -0500
+++ b/test-data/preprocessing_results2.imzml.txt	Wed Mar 25 08:13:17 2020 -0400
@@ -1,4 +1,4 @@
 imzML file:
-total 80
--rw-r--r-- 1 meli meli 54720 Feb 24 14:12 ibd
--rw-r--r-- 1 meli meli 21132 Feb 24 14:12 imzml
+total 64
+-rw-r--r-- 1 meli meli 37404 Mär 24 10:40 ibd
+-rw-r--r-- 1 meli meli 22796 Mär 24 10:40 imzml
Binary file test-data/preprocessing_results2.pdf has changed
Binary file test-data/preprocessing_results3.ibd has changed
--- a/test-data/preprocessing_results3.imzml	Fri Dec 13 13:57:13 2019 -0500
+++ b/test-data/preprocessing_results3.imzml	Wed Mar 25 08:13:17 2020 -0400
@@ -9,8 +9,8 @@
 		<fileContent>
 			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
 			<cvParam cvRef="MS" accession="MS:1000127" name="centroid spectrum" value="" />
-			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="{D767424F-5E74-45AB-AF1B-0D25244B435B}" />
-			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="445E32981D0B3D08ED2BA74E11500A3A08CDB9B7" />
+			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="f367e393-ca54-4bcc-bc17-10f87a3e41d0" />
+			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="b9439af71c5fb6703e3fe571d12a1f9b6f90d82c" />
 			<cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" />
 		</fileContent>
 	</fileDescription>
@@ -22,19 +22,18 @@
 		</referenceableParamGroup>
 		<referenceableParamGroup id="scan1">
 			<cvParam cvRef="MS" accession="MS:1000093" name="increasing m/z scan" value="" />
-			<cvParam cvRef="MS" accession="MS:1000095" name="linear" value="" />
 		</referenceableParamGroup>
 		<referenceableParamGroup id="mzArray">
 			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
 			<cvParam cvRef="MS" accession="MS:1000514" name="m/z array" value="" unitCvRef="MS" unitAccession="MS:1000040" unitName="m/z" />
 			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
-			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="32-bit float" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
 		</referenceableParamGroup>
 		<referenceableParamGroup id="intensityArray">
 			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
 			<cvParam cvRef="MS" accession="MS:1000515" name="intensity array" value="" unitCvRef="MS" unitAccession="MS:1000131" unitName="number of counts" />
 			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
-			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="32-bit float" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
 		</referenceableParamGroup>
 	</referenceableParamGroupList>
 	<sampleList count="1">
@@ -43,7 +42,7 @@
 		</sample>
 	</sampleList>
 	<softwareList count="1">
-		<software id="Cardinal" version="1.12.1">
+		<software id="Cardinal" version="2.4.0">
 			<cvParam cvRef="MS" accession="MS:1000799" name="custom unreleased software tool" value="" />
 		</software>
 	</softwareList>
@@ -51,10 +50,16 @@
 		<scanSettings id="scansettings1">
 			<cvParam cvRef="IMS" accession="IMS:1000042" name="max count of pixel x" value="3" />
 			<cvParam cvRef="IMS" accession="IMS:1000043" name="max count of pixel y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000044" name="max dimension x" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000045" name="max dimension y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000046" name="pixel size x" value="1.000000" />
+			<cvParam cvRef="IMS" accession="IMS:1000047" name="pixel size y" value="1.000000" />
 		</scanSettings>
 	</scanSettingsList>
 	<instrumentConfigurationList count="1">
-		<instrumentConfiguration id="IC1" />
+		<instrumentConfiguration id="IC1">
+			<cvParam cvRef="MS" accession="MS:1000031" name="instrument model" />
+		</instrumentConfiguration>
 	</instrumentConfigurationList>
 	<dataProcessingList count="1">
 		<dataProcessing id="CardinalWriteImzML">
@@ -73,21 +78,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="355" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="1420" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="12" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="1436" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="355" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="1420" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="28" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="12" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -100,21 +107,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="355" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="1420" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="12" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="2856" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="355" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="1420" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="40" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="12" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -127,21 +136,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="355" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="1420" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="12" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="4276" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="355" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="1420" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="52" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="12" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -154,21 +165,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="355" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="1420" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="12" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="5696" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="355" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="1420" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="64" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="12" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -181,21 +194,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="355" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="1420" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="12" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="7116" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="355" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="1420" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="76" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="12" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -208,21 +223,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="355" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="1420" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="12" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="8536" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="355" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="1420" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="88" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="12" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -235,21 +252,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="355" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="1420" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="12" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="9956" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="355" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="1420" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="100" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="12" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -262,21 +281,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="355" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="1420" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="12" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="11376" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="355" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="1420" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="112" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="12" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -289,21 +310,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="355" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="1420" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="12" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="12796" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="355" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="1420" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="124" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="12" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
--- a/test-data/preprocessing_results3.imzml.txt	Fri Dec 13 13:57:13 2019 -0500
+++ b/test-data/preprocessing_results3.imzml.txt	Wed Mar 25 08:13:17 2020 -0400
@@ -1,4 +1,4 @@
 imzML file:
-total 36
--rw-r--r-- 1 meli meli 14216 Feb 24 14:12 ibd
--rw-r--r-- 1 meli meli 16824 Feb 24 14:12 imzml
+total 24
+-rw-r--r-- 1 meli meli   136 Mär 24 11:10 ibd
+-rw-r--r-- 1 meli meli 18088 Mär 24 11:10 imzml
Binary file test-data/preprocessing_results3.pdf has changed
Binary file test-data/preprocessing_results4.ibd has changed
--- a/test-data/preprocessing_results4.imzml	Fri Dec 13 13:57:13 2019 -0500
+++ b/test-data/preprocessing_results4.imzml	Wed Mar 25 08:13:17 2020 -0400
@@ -9,8 +9,8 @@
 		<fileContent>
 			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
 			<cvParam cvRef="MS" accession="MS:1000128" name="profile spectrum" value="" />
-			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="{FE932E04-42E4-4D89-B721-2A6CE83250B6}" />
-			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="36C7C916C176DD85CBBF4B7FA969C92B9403768D" />
+			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="db79298c-8368-42d7-84fc-18cad6ef1924" />
+			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="18bae3cc87b4c9aab2577cffe2fbc7425a93270b" />
 			<cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" />
 		</fileContent>
 	</fileDescription>
@@ -22,19 +22,18 @@
 		</referenceableParamGroup>
 		<referenceableParamGroup id="scan1">
 			<cvParam cvRef="MS" accession="MS:1000093" name="increasing m/z scan" value="" />
-			<cvParam cvRef="MS" accession="MS:1000095" name="linear" value="" />
 		</referenceableParamGroup>
 		<referenceableParamGroup id="mzArray">
 			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
 			<cvParam cvRef="MS" accession="MS:1000514" name="m/z array" value="" unitCvRef="MS" unitAccession="MS:1000040" unitName="m/z" />
 			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
-			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="32-bit float" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
 		</referenceableParamGroup>
 		<referenceableParamGroup id="intensityArray">
 			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
 			<cvParam cvRef="MS" accession="MS:1000515" name="intensity array" value="" unitCvRef="MS" unitAccession="MS:1000131" unitName="number of counts" />
 			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
-			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="32-bit float" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
 		</referenceableParamGroup>
 	</referenceableParamGroupList>
 	<sampleList count="1">
@@ -43,7 +42,7 @@
 		</sample>
 	</sampleList>
 	<softwareList count="1">
-		<software id="Cardinal" version="1.12.1">
+		<software id="Cardinal" version="2.4.0">
 			<cvParam cvRef="MS" accession="MS:1000799" name="custom unreleased software tool" value="" />
 		</software>
 	</softwareList>
@@ -51,10 +50,16 @@
 		<scanSettings id="scansettings1">
 			<cvParam cvRef="IMS" accession="IMS:1000042" name="max count of pixel x" value="3" />
 			<cvParam cvRef="IMS" accession="IMS:1000043" name="max count of pixel y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000044" name="max dimension x" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000045" name="max dimension y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000046" name="pixel size x" value="1.000000" />
+			<cvParam cvRef="IMS" accession="IMS:1000047" name="pixel size y" value="1.000000" />
 		</scanSettings>
 	</scanSettingsList>
 	<instrumentConfigurationList count="1">
-		<instrumentConfiguration id="IC1" />
+		<instrumentConfiguration id="IC1">
+			<cvParam cvRef="MS" accession="MS:1000031" name="instrument model" />
+		</instrumentConfiguration>
 	</instrumentConfigurationList>
 	<dataProcessingList count="1">
 		<dataProcessing id="CardinalWriteImzML">
@@ -73,21 +78,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="159" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="636" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1581" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="6324" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="652" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="159" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="636" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="6340" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1581" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="6324" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -100,21 +107,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="159" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="636" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1581" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="6324" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="1288" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="159" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="636" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="12664" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1581" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="6324" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -127,21 +136,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="159" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="636" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1581" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="6324" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="1924" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="159" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="636" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="18988" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1581" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="6324" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -154,21 +165,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="159" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="636" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1581" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="6324" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="2560" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="159" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="636" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="25312" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1581" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="6324" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -181,21 +194,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="159" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="636" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1581" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="6324" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="3196" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="159" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="636" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="31636" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1581" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="6324" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -208,21 +223,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="159" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="636" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1581" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="6324" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="3832" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="159" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="636" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="37960" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1581" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="6324" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -235,21 +252,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="159" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="636" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1581" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="6324" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="4468" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="159" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="636" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="44284" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1581" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="6324" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -262,21 +281,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="159" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="636" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1581" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="6324" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="5104" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="159" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="636" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="50608" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1581" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="6324" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -289,21 +310,23 @@
 						<referenceableParamGroupRef ref="scan1" />
 						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
 						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
 					</scan>
 				</scanList>
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="159" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="636" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1581" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="6324" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="5740" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="159" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="636" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="56932" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="1581" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="6324" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
--- a/test-data/preprocessing_results4.imzml.txt	Fri Dec 13 13:57:13 2019 -0500
+++ b/test-data/preprocessing_results4.imzml.txt	Wed Mar 25 08:13:17 2020 -0400
@@ -1,4 +1,4 @@
 imzML file:
-total 28
--rw-r--r-- 1 meli meli  6376 Feb 24 14:13 ibd
--rw-r--r-- 1 meli meli 16801 Feb 24 14:13 imzml
+total 84
+-rw-r--r-- 1 meli meli 63256 Mär 24 11:35 ibd
+-rw-r--r-- 1 meli meli 18199 Mär 24 11:35 imzml
Binary file test-data/preprocessing_results4.pdf has changed
Binary file test-data/preprocessing_results5.RData has changed
Binary file test-data/preprocessing_results5.ibd has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/preprocessing_results5.imzml	Wed Mar 25 08:13:17 2020 -0400
@@ -0,0 +1,340 @@
+<?xml version="1.0"?>
+<mzML version="1.1" xmlns="http://psi.hupo.org/ms/mzml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://psi.hupo.org/ms/mzml http://psidev.info/files/ms/mzML/xsd/mzML1.1.0_idx.xsd">
+	<cvList count="3">
+		<cv id="MS" fullName="Proteomics Standards Initiative Mass Spectrometry Ontology" version="1.3.1" URI="http://psidev.info/ms/mzML/psi-ms.obo" />
+		<cv id="UO" fullName="Unit Ontology" version="1.15" URI="http://obo.cvs.sourceforge.net/obo/obo/ontology/phenotype/unit.obo" />
+		<cv id="IMS" fullName="Imaging MS Ontology" version="0.9.1" URI="http://www.maldi-msi.org/download/imzml/imagingMS.obo" />
+	</cvList>
+	<fileDescription>
+		<fileContent>
+			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
+			<cvParam cvRef="MS" accession="MS:1000128" name="profile spectrum" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="c88c7d70-c027-4fa3-b274-0af5e7f4d117" />
+			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="16a0f87989392c55b1c02770f15095dcf0d9408e" />
+			<cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" />
+		</fileContent>
+	</fileDescription>
+	<referenceableParamGroupList count="4">
+		<referenceableParamGroup id="spectrum1">
+			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
+			<cvParam cvRef="MS" accession="MS:1000511" name="ms level" value="0" />
+			<cvParam cvRef="MS" accession="MS:1000128" name="profile spectrum" value="" />
+		</referenceableParamGroup>
+		<referenceableParamGroup id="scan1">
+			<cvParam cvRef="MS" accession="MS:1000093" name="increasing m/z scan" value="" />
+		</referenceableParamGroup>
+		<referenceableParamGroup id="mzArray">
+			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
+			<cvParam cvRef="MS" accession="MS:1000514" name="m/z array" value="" unitCvRef="MS" unitAccession="MS:1000040" unitName="m/z" />
+			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
+		</referenceableParamGroup>
+		<referenceableParamGroup id="intensityArray">
+			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
+			<cvParam cvRef="MS" accession="MS:1000515" name="intensity array" value="" unitCvRef="MS" unitAccession="MS:1000131" unitName="number of counts" />
+			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
+		</referenceableParamGroup>
+	</referenceableParamGroupList>
+	<sampleList count="1">
+		<sample id="sample1" name="Sample1">
+			<cvParam cvRef="MS" accession="MS:1000001" name="sample number" value="1" />
+		</sample>
+	</sampleList>
+	<softwareList count="1">
+		<software id="Cardinal" version="2.4.0">
+			<cvParam cvRef="MS" accession="MS:1000799" name="custom unreleased software tool" value="" />
+		</software>
+	</softwareList>
+	<scanSettingsList count="1">
+		<scanSettings id="scansettings1">
+			<cvParam cvRef="IMS" accession="IMS:1000401" name="top down" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000413" name="flyback" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000480" name="horizontal line scan" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000491" name="linescan left right" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000042" name="max count of pixel x" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000043" name="max count of pixel y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000044" name="max dimension x" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000045" name="max dimension y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000046" name="pixel size x" value="1.000000" />
+			<cvParam cvRef="IMS" accession="IMS:1000047" name="pixel size y" value="1.000000" />
+		</scanSettings>
+	</scanSettingsList>
+	<instrumentConfigurationList count="1">
+		<instrumentConfiguration id="IC1">
+			<cvParam cvRef="MS" accession="MS:1000031" name="instrument model" />
+		</instrumentConfiguration>
+	</instrumentConfigurationList>
+	<dataProcessingList count="1">
+		<dataProcessing id="CardinalWriteImzML">
+			<processingMethod order="1" softwareRef="Cardinal">
+				<cvParam cvRef="MS" accession="MS:1000544" name="Conversion to mzML" value="" />
+			</processingMethod>
+		</dataProcessing>
+	</dataProcessingList>
+	<run defaultInstrumentConfigurationRef="IC1" id="Experiment01" sampleRef="sample1">
+		<spectrumList count="9" defaultDataProcessingRef="CardinalWriteImzML">
+			<spectrum id="Spectrum=1" defaultArrayLength="0" index="1">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="41608" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=2" defaultArrayLength="0" index="2">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="83200" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=3" defaultArrayLength="0" index="3">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="124792" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=4" defaultArrayLength="0" index="4">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="166384" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=5" defaultArrayLength="0" index="5">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="207976" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=6" defaultArrayLength="0" index="6">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="249568" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=7" defaultArrayLength="0" index="7">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="291160" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=8" defaultArrayLength="0" index="8">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="332752" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=9" defaultArrayLength="0" index="9">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="374344" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+		</spectrumList>
+	</run>
+</mzML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/preprocessing_results5.imzml.txt	Wed Mar 25 08:13:17 2020 -0400
@@ -0,0 +1,4 @@
+imzML file:
+total 428
+-rw-r--r-- 1 meli meli 415936 Mär 24 10:57 ibd
+-rw-r--r-- 1 meli meli  18569 Mär 24 10:57 imzml
Binary file test-data/preprocessing_results5.pdf has changed
Binary file test-data/rdata_notfiltered.pdf has changed