changeset 6:bb1ac6b47a6c draft

"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit 15e24b1f0143679647906bc427654f66b417a45c"
author galaxyp
date Wed, 25 Mar 2020 07:02:41 -0400
parents b41107d8fe89
children 392b2dfd261d
files combine.xml macros.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, 1375 insertions(+), 615 deletions(-) [+]
line wrap: on
line diff
--- a/combine.xml	Fri Dec 13 13:54:23 2019 -0500
+++ b/combine.xml	Wed Mar 25 07:02:41 2020 -0400
@@ -1,4 +1,4 @@
-<tool id="cardinal_combine" name="MSI combine" version="2.2.6.0">
+<tool id="cardinal_combine" name="MSI combine" version="2.2.6.1">
     <description>
         combine several mass spectrometry imaging datasets into one
     </description>
@@ -44,6 +44,7 @@
     </command>
     <configfiles>
         <configfile name="msi_combine"><![CDATA[
+
 #import re
 
 ################ 1) load libraries and do preparations #################
@@ -86,7 +87,7 @@
 
     #if $infile.ext == 'imzml'
         #if str($processed_cond.processed_file) == "processed":
-            msidata_$i <- readImzML('infile_${i}', mass.accuracy=$processed_cond.accuracy, units.accuracy = "$processed_cond.units", attach.only=TRUE, as = c("MSImageSet"))
+            msidata_$i <- readImzML('infile_${i}', resolution=$processed_cond.accuracy, units = "$processed_cond.units", attach.only=TRUE, as = c("MSImageSet"))
             centroided(msidata_$i) = $centroids
         #else
             msidata_$i <- readImzML('infile_${i}', attach.only=TRUE, as = c("MSImageSet"))
@@ -235,7 +236,7 @@
 #end for
 
 
-######################### 6a) combination same mz axis ###################
+######################### 6b) combination same mz axis ###################
 
 #if str( $combine_conditional.combine_method ) == 'automatic_combine':
     print("automatic combine")
@@ -294,12 +295,7 @@
         ## save msidata as imzML file MALDIquant
         MALDIquantForeign::exportImzMl(filtered_dataset, file="out.imzML", processed=TRUE, coordinates=coordinates_matrix)
 
-        ## create x,y,sample_name dataframe for QC pdf
-       ## position_df = unique_coordinates ### ! anders
-       ## colnames(position_df)[3] = "sample_name"
-        ##coordinates_combined = coordinates_combined[pixelsofinterest,] ###! anders
         coordinates_combined = unique_coordinates
-##TODO: hier aufräumen kann alles weg?!
 
     #end if
 
@@ -323,7 +319,6 @@
        guides(fill=guide_legend(ncol=4,byrow=TRUE))
 coord_labels = aggregate(cbind(x,y)~sample_name, data=coordinates_combined[,1:3], mean)
 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$sample_name)
-
 print(combine_plot)
 
     #if str($annotation_cond.annotation_tabular) == 'annotation'
@@ -431,7 +426,7 @@
             <output name="pixel_annotations" file="123_annotation_output.tabular"/>
             <output name="QC_overview" file="123_combined_QC.pdf" compare="sim_size"/>
             <output name="outfile_imzml" ftype="imzml" file="123_combined.imzml.txt" compare="sim_size">
-                <extra_files type="file" file="123_combined.imzml" name="imzml" lines_diff="4"/>
+                <extra_files type="file" file="123_combined.imzml" name="imzml" lines_diff="12"/>
                 <extra_files type="file" file="123_combined.ibd" name="ibd" compare="sim_size"/>
             </output>
         </test>
@@ -447,7 +442,7 @@
             <output name="pixel_annotations" file="picked.tabular"/>
             <output name="QC_overview" file="picked_QC.pdf" compare="sim_size"/>
             <output name="outfile_imzml" ftype="imzml" file="picked.imzml.txt" compare="sim_size">
-                <extra_files type="file" file="picked.imzml" name="imzml" lines_diff="6"/>
+                <extra_files type="file" file="picked.imzml" name="imzml" lines_diff="12"/>
                 <extra_files type="file" file="picked.ibd" name="ibd" compare="sim_size"/>
             </output>
         </test>
@@ -461,7 +456,7 @@
             <output name="QC_overview" file="123_combined_auto.pdf" compare="sim_size"/>
             <output name="pixel_annotations" file="123_combined_auto.tabular"/>
             <output name="outfile_imzml" ftype="imzml" file="123_combined_auto.imzml.txt" compare="sim_size">
-                <extra_files type="file" file="123_combined_auto.imzml" name="imzml" lines_diff="4"/>
+                <extra_files type="file" file="123_combined_auto.imzml" name="imzml" lines_diff="12"/>
                 <extra_files type="file" file="123_combined_auto.ibd" name="ibd" compare="sim_size"/>
             </output>
         </test>
@@ -477,7 +472,7 @@
             <output name="pixel_annotations" file="12_annotation_output.tabular"/>
             <output name="QC_overview" file="12_combined_QC.pdf" compare="sim_size"/>
             <output name="outfile_imzml" ftype="imzml" file="12_combined.imzml.txt" compare="sim_size">
-                <extra_files type="file" file="12_combined.imzml" name="imzml" lines_diff="4"/>
+                <extra_files type="file" file="12_combined.imzml" name="imzml" lines_diff="12"/>
                 <extra_files type="file" file="12_combined.ibd" name="ibd" compare="sim_size"/>
             </output>
         </test>
@@ -493,7 +488,7 @@
             <output name="pixel_annotations" file="112_annotation_output.tabular"/>
             <output name="QC_overview" file="112_auto_combined_QC.pdf" compare="sim_size"/>
             <output name="outfile_imzml" ftype="imzml" file="112_auto_combined.imzml.txt" compare="sim_size">
-                <extra_files type="file" file="112_auto_combined.imzml" name="imzml" lines_diff="4"/>
+                <extra_files type="file" file="112_auto_combined.imzml" name="imzml" lines_diff="12"/>
                 <extra_files type="file" file="112_auto_combined.ibd" name="ibd" compare="sim_size"/>
             </output>
         </test>
@@ -507,7 +502,7 @@
             <output name="pixel_annotations" file="2123_annotation_output.tabular"/>
             <output name="QC_overview" file="2123_auto_combined_QC.pdf" compare="sim_size"/>
             <output name="outfile_imzml" ftype="imzml" file="2123_auto_combined.imzml.txt" compare="sim_size">
-                <extra_files type="file" file="2123_auto_combined.imzml" name="imzml" lines_diff="4"/>
+                <extra_files type="file" file="2123_auto_combined.imzml" name="imzml" lines_diff="12"/>
                 <extra_files type="file" file="2123_auto_combined.ibd" name="ibd" compare="sim_size"/>
             </output>
         </test>
@@ -558,7 +553,7 @@
 
 **Output**
 
-- MSI data as imzML file (in continous format when m/z axis were the same; in processed format when m/z axis were different)
+- MSI data as imzML file (in continuous format when m/z axis were the same; in processed format when m/z axis were different)
 - Pdf with pixel positions and annotations of the combined files
 - Tabular file with pixel annotations (x,y,column with input file names and annotation columns)
 
--- a/macros.xml	Fri Dec 13 13:54:23 2019 -0500
+++ b/macros.xml	Wed Mar 25 07:02:41 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>
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:54:23 2019 -0500
+++ b/test-data/out3.imzml	Wed Mar 25 07:02:41 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:54:23 2019 -0500
+++ b/test-data/out3.imzml.txt	Wed Mar 25 07:02:41 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:54:23 2019 -0500
+++ b/test-data/out4.imzml	Wed Mar 25 07:02:41 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:54:23 2019 -0500
+++ b/test-data/out4.imzml.txt	Wed Mar 25 07:02:41 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:54:23 2019 -0500
+++ b/test-data/out5.imzml	Wed Mar 25 07:02:41 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:54:23 2019 -0500
+++ b/test-data/out5.imzml.txt	Wed Mar 25 07:02:41 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:54:23 2019 -0500
+++ b/test-data/out6.imzml	Wed Mar 25 07:02:41 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:54:23 2019 -0500
+++ b/test-data/out6.imzml.txt	Wed Mar 25 07:02:41 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:54:23 2019 -0500
+++ b/test-data/out7.imzml	Wed Mar 25 07:02:41 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:54:23 2019 -0500
+++ b/test-data/out7.imzml.txt	Wed Mar 25 07:02:41 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 07:02:41 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 07:02:41 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:54:23 2019 -0500
+++ b/test-data/preprocessing_results1.imzml	Wed Mar 25 07:02:41 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:54:23 2019 -0500
+++ b/test-data/preprocessing_results1.imzml.txt	Wed Mar 25 07:02:41 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:54:23 2019 -0500
+++ b/test-data/preprocessing_results2.imzml	Wed Mar 25 07:02:41 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:54:23 2019 -0500
+++ b/test-data/preprocessing_results2.imzml.txt	Wed Mar 25 07:02:41 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:54:23 2019 -0500
+++ b/test-data/preprocessing_results3.imzml	Wed Mar 25 07:02:41 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:54:23 2019 -0500
+++ b/test-data/preprocessing_results3.imzml.txt	Wed Mar 25 07:02:41 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:54:23 2019 -0500
+++ b/test-data/preprocessing_results4.imzml	Wed Mar 25 07:02:41 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:54:23 2019 -0500
+++ b/test-data/preprocessing_results4.imzml.txt	Wed Mar 25 07:02:41 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 07:02:41 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 07:02:41 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