changeset 6:d2ccd8348018 draft

"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit 15e24b1f0143679647906bc427654f66b417a45c"
author galaxyp
date Wed, 25 Mar 2020 08:05:39 -0400
parents 528fb09022be
children 1d4a6fe69a40
files filtering.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, 1473 insertions(+), 676 deletions(-) [+]
line wrap: on
line diff
--- a/filtering.xml	Fri Dec 13 13:55:48 2019 -0500
+++ b/filtering.xml	Wed Mar 25 08:05:39 2020 -0400
@@ -1,12 +1,14 @@
-<tool id="cardinal_filtering" name="MSI filtering" version="@VERSION@.3">
+<tool id="cardinal_filtering" name="MSI filtering" version="2.4.0.0">
     <description>tool for filtering mass spectrometry imaging data</description>
     <macros>
         <import>macros.xml</import>
     </macros>
-    <expand macro="requirements">
+    <requirements>
+        <requirement type="package" version="2.4.0">bioconductor-cardinal</requirement>
+        <requirement type="package" version="3.6.1">r-base</requirement>
         <requirement type="package" version="2.3">r-gridextra</requirement>
-        <requirement type="package" version="3.0">r-ggplot2</requirement>
-    </expand>
+        <requirement type="package" version="3.2.1">r-ggplot2</requirement>
+    </requirements>
     <expand macro="print_version"/>
     <command detect_errors="exit_code">
     <![CDATA[
@@ -14,12 +16,9 @@
         @INPUT_LINKING@
         cat '${MSI_subsetting}' &&
         Rscript '${MSI_subsetting}' &&
-
-        #if str($imzml_output) == "imzml_format":
-            mkdir $outfile_imzml.files_path &&
-            mv ./out.imzML "${os.path.join($outfile_imzml.files_path, 'imzml')}" | true &&
-            mv ./out.ibd "${os.path.join($outfile_imzml.files_path, 'ibd')}" | true &&
-        #end if
+        mkdir $outfile_imzml.files_path &&
+        mv ./out.imzML "${os.path.join($outfile_imzml.files_path, 'imzml')}" | true &&
+        mv ./out.ibd "${os.path.join($outfile_imzml.files_path, 'ibd')}" | true &&
         echo "imzML file:" > $outfile_imzml &&
         ls -l "$outfile_imzml.files_path" >> $outfile_imzml
     ]]>
@@ -37,29 +36,51 @@
 library(ggplot2)
 library(gridExtra)
 
-@READING_MSIDATA@
+
+
+## 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', resolution=$processed_cond.accuracy, units = "$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')
+    msidata = as(msidata, "MSImagingExperiment")
+#end if
 
 
 ########################### QC numbers ########################
 
         ## Number of features (m/z)
-        maxfeatures = length(features(msidata))
+        maxfeatures = nrow(msidata)
         ## Range m/z
         minmz = round(min(mz(msidata)), digits=2)
         maxmz = round(max(mz(msidata)), digits=2)
         ## Number of spectra (pixels)
-        pixelcount = length(pixels(msidata))
+        pixelcount = ncol(msidata)
         ## Range x coordinates
-        minimumx = min(coord(msidata)[,1])
-        maximumx = max(coord(msidata)[,1])
+        minimumx = min(coord(msidata)\$x)
+        maximumx = max(coord(msidata)\$x)
         ## Range y coordinates
-        minimumy = min(coord(msidata)[,2])
-        maximumy = max(coord(msidata)[,2])
+        minimumy = min(coord(msidata)\$y)
+        maximumy = max(coord(msidata)\$y)
         ## Store features for QC plot
         featuresinfile = mz(msidata)
 
-        all_df = cbind(coord(msidata)[,1:2], rep("removed pixels", times=ncol(msidata)))
-        colnames(all_df)[3] = "annotation"
+        all_df = data.frame(coord(msidata)\$x, coord(msidata)\$y, rep("removed pixels", times=ncol(msidata)))
+        colnames(all_df) = c("x", "y", "annotation")
 
 ## Next steps will only run if there are more than 0 pixels/features in the file
 
@@ -92,7 +113,7 @@
                 error=function(cond) {
                 ## in case all coordinates were outside the dataset leading to zero pixels, tool is stopped to avoid continuing with wrong data
                     message("Error during pixel filtering")
-                    message("Possible problems: Forgot to set 'Tabular file contains a header line' = Yes, wrong columns selected, columns with coordinates contain empty fields or letters, all coordinates were outside the range of the dataset - this can be checked with the 'MSI qualitycontrol' tool)")
+                    message("Possible problems: Forgot to set 'Tabular file contains a header line' = Yes, wrong columns selected, columns with coordinates contain empty fields or letters, all coordinates were outside the range of the dataset - this can be checked with the 'MSI qualitycontrol' tool")
                     stop(call.=FALSE)
                 }
             )    
@@ -142,9 +163,9 @@
 
     ## dataframe for QC of pixel distribution
 
-    remaining_df = cbind(coord(msidata)[,1:2], rep("remaining pixels", times=ncol(msidata)))
-    colnames(remaining_df)[3] = "annotation"
-    position_df = rbind(all_df, remaining_df) 
+    remaining_df = data.frame(as.numeric(coord(msidata)\$x), as.numeric(coord(msidata)\$y), rep("remaining pixels", times=ncol(msidata)))
+    colnames(remaining_df) = c("x", "y", "annotation")
+    position_df = rbind(all_df, remaining_df)
     position_df[row.names(unique(position_df[,c("x", "y")])),]
     position_df\$annotation = factor(position_df\$annotation)
     gc()
@@ -205,7 +226,7 @@
                         ## in case all provided m/z values were outside the m/z range
                         ## tool is stopped to avoid continuing with wrong data
                             message("Error during m/z filtering")
-                            message("Possible problems: Forgot to set 'Tabular file contains a header line' = Yes, wrong columns selected, column with m/z features contains empty fields or letters, all m/z features s were outside the range of the dataset  - this can be checked with the 'MSI qualitycontrol' tool) or did not match any m/z feature of the dataset (see help section for more information on that)")
+                            message("Possible problems: Forgot to set 'Tabular file contains a header line' = Yes, wrong columns selected, column with m/z features contains empty fields or letters, all m/z features s were outside the range of the dataset  (this can be checked with the 'MSI qualitycontrol' tool) or did not match any m/z feature of the dataset (see help section for more information on that)")
                             stop(call.=FALSE)
                         }
                     )    
@@ -262,8 +283,11 @@
                         #end if 
                         current_mass = which(c(mz(msidata) <= masses + plusminus & mz(msidata) >= masses - plusminus))
                         mass_to_remove = append(mass_to_remove, current_mass)}
-                    msidata= msidata[-mass_to_remove, ]
-                    validmz = numberfeatures - nrow(msidata)
+                        mass_to_keep = setdiff(1:nrow(msidata),mass_to_remove)
+
+                    msidata= msidata[mass_to_keep, ]
+                    validmz = maxfeatures - nrow(msidata)
+
                     ## does not throw error when processed file has no features left, therefore create error to avoid continuing with wrong data
                     if (nrow(msidata) == 0)
                         {
@@ -278,7 +302,6 @@
 
 
 
-
         ######################## No m/z filtering ##############################
 
         #elif str($features_cond.features_filtering) == "none":
@@ -304,18 +327,18 @@
 #################### QC numbers #######################
 
 ## Number of features (m/z)
-maxfeatures2 = length(features(msidata))
+maxfeatures2 = nrow(msidata)
 ## Range m/z
 minmz2 = round(min(mz(msidata)), digits=2)
 maxmz2 = round(max(mz(msidata)), digits=2)
 ## Number of spectra (pixels)
-pixelcount2 = length(pixels(msidata))
+pixelcount2 = ncol(msidata)
 ## Range x coordinates
-minimumx2 = min(coord(msidata)[,1])
-maximumx2 = max(coord(msidata)[,1])
+minimumx2 = min(coord(msidata)\$x)
+maximumx2 = max(coord(msidata)\$x)
 ## Range y coordinates
-minimumy2 = min(coord(msidata)[,2])
-maximumy2 = max(coord(msidata)[,2])
+minimumy2 = min(coord(msidata)\$y)
+maximumy2 = max(coord(msidata)\$y)
 
 properties = c("Number of m/z features",
                "Range of m/z values",
@@ -347,7 +370,7 @@
 
 pdf("filtertool_QC.pdf", fonts = "Times", pointsize = 12)
 plot(0,type='n',axes=FALSE,ann=FALSE)
-title(main=paste0("Qualitycontrol of filtering tool for file: \n\n", "$infile.display_name"))
+title(main=paste0("Qualitycontrol of filtering tool for file: \n\n", "$infile.element_identifier"))
 grid.table(property_df, rows= NULL)
 
 ## QC report only when pixels/features are left
@@ -362,35 +385,39 @@
            ggtitle("Spatial orientation of filtered pixels")+
            theme_bw()+
            theme(plot.title = element_text(hjust = 0.5))+
-           theme(legend.position="bottom",legend.direction="vertical")
+           theme(legend.position="bottom",legend.direction="vertical")+
+           guides(fill=guide_legend(ncol=5,byrow=TRUE))
     print(pixel_image)
 
-    ### plot features which are removed
-    hist(mz(msidata), xlab="m/z", main="Kept m/z values")
-    #if str($features_cond.features_filtering) == "none":
-        print("no difference histogram as no m/z filtering took place")
-    #else:
-        if (isTRUE(all.equal(featuresinfile, mz(msidata)))){
-        print("No difference in m/z values before and after filtering, no histogram drawn")
-        }else{
-        hist(setdiff(featuresinfile, mz(msidata)), xlab="m/z", main="Removed m/z values")}
-    #end if
+
+    ### visual mz feature control
+
+    kept_df = data.frame(mz(msidata), rep("remaining m/z", nrow(msidata)))
+    colnames(kept_df) = c("mz", "legend")
+
+    mz_removed = setdiff(featuresinfile, mz(msidata))
+    removed_df = data.frame(mz_removed, rep("removed m/z", length(mz_removed)))
+    colnames(removed_df) = c("mz", "legend")
+    histogram_df = rbind(removed_df,kept_df)
+
+    histogram_mz= ggplot(histogram_df, aes(x=mz, fill=legend)) +
+        geom_histogram()+ theme_bw()+
+        theme(plot.title = element_text(hjust = 0.5))+
+        theme(legend.position="bottom",legend.direction="vertical")+
+        labs(title="Overview of filtered m/z", x="m/z", y = "count") +
+        guides(fill=guide_legend(ncol=5,byrow=TRUE))
+      print(histogram_mz)
+
 
         dev.off()
 
     ## save msidata as imzML file, will only work if there is at least 1 m/z left
 
-    #if str($imzml_output) == "imzml_format":
         if (maxfeatures2 > 0){
             ## make sure that coordinates are integers
             coord(msidata)\$y = as.integer(coord(msidata)\$y)
             coord(msidata)\$x = as.integer(coord(msidata)\$x)
         writeImzML(msidata, "out")}
-    #elif str($imzml_output) == "rdata_format":
-        ## save msidata as Rfile
-        iData(msidata) = iData(msidata)[]
-        save(msidata, file="$outfile_rdata")
-    #end if
 
 
 }else{
@@ -448,20 +475,10 @@
                 </param>
             </when>
         </conditional>
-        <param name="imzml_output" type="select" display = "radio" optional = "False"
-               label="Output format" help= "Choose the output format">
-                <option value="imzml_format" >imzML</option>
-                <option value="rdata_format" selected="True" >RData</option>
-        </param>
     </inputs>
 
     <outputs>
-        <data format="imzml" name="outfile_imzml" label="${tool.name} on ${on_string}: imzML">
-            <filter>imzml_output =='imzml_format'</filter>
-        </data>
-        <data format="rdata" name="outfile_rdata" label="${tool.name} on ${on_string}: RData">
-            <filter>imzml_output == 'rdata_format'</filter>
-        </data>
+        <data format="imzml" name="outfile_imzml" label="${tool.name} on ${on_string}: imzML"/>
         <data format="pdf" name="QC_overview" from_work_dir="filtertool_QC.pdf" label = "${tool.name} on ${on_string}: QC"/>
     </outputs>
     <tests>
@@ -475,10 +492,9 @@
             <param name="features_filtering" value="features_range"/>
             <param name="min_mz" value="350"/>
             <param name="max_mz" value="500"/>
-            <param name="imzml_output" value="imzml_format"/>
             <output name="QC_overview" file="imzml_filtered3.pdf" compare="sim_size"/>
             <output name="outfile_imzml" ftype="imzml" file="out3.imzml.txt" compare="sim_size">
-                <extra_files type="file" file="out3.imzml" name="imzml" lines_diff="4"/>
+                <extra_files type="file" file="out3.imzml" name="imzml" lines_diff="6"/>
                 <extra_files type="file" file="out3.ibd" name="ibd" compare="sim_size"/>
             </output>
         </test>
@@ -488,10 +504,9 @@
             <param name="annotation_file" ftype="tabular" value="inputpixels_2column.tabular"/>
             <param name="column_x" value="1"/>
             <param name="column_y" value="3"/>
-            <param name="imzml_output" value="imzml_format"/>
             <output name="QC_overview" file="imzml_filtered4.pdf" compare="sim_size"/>
             <output name="outfile_imzml" ftype="imzml" file="out4.imzml.txt" compare="sim_size">
-                <extra_files type="file" file="out4.imzml" name="imzml" lines_diff="4"/>
+                <extra_files type="file" file="out4.imzml" name="imzml" lines_diff="6"/>
                 <extra_files type="file" file="out4.ibd" name="ibd" compare="sim_size"/>
             </output>
         </test>
@@ -506,34 +521,51 @@
             <param name="mz_tabular" ftype="tabular" value = "featuresofinterest5.tabular"/>
             <param name="feature_column" value="1"/>
             <param name="feature_header" value="0"/>
-            <param name="imzml_output" value="imzml_format"/>
             <output name="QC_overview" file="imzml_filtered5.pdf" compare="sim_size"/>
             <output name="outfile_imzml" ftype="imzml" file="out5.imzml.txt" compare="sim_size">
-                <extra_files type="file" file="out5.imzml" name="imzml" lines_diff="4"/>
+                <extra_files type="file" file="out5.imzml" name="imzml" lines_diff="6"/>
                 <extra_files type="file" file="out5.ibd" name="ibd" compare="sim_size"/>
             </output>
         </test>
         <test>
             <expand macro="infile_analyze75"/>
-            <param name="imzml_output" value="imzml_format"/>
             <output name="QC_overview" file="analyze75_filtered2.pdf" compare="sim_size"/>
             <output name="outfile_imzml" ftype="imzml" file="out6.imzml.txt" compare="sim_size">
-                <extra_files type="file" file="out6.imzml" name="imzml" lines_diff="4"/>
+                <extra_files type="file" file="out6.imzml" name="imzml" lines_diff="6"/>
                 <extra_files type="file" file="out6.ibd" name="ibd" compare="sim_size"/>
             </output>
         </test>
         <test>
             <param name="infile" value="preprocessed.RData" ftype="rdata"/>
-            <conditional name="outputs">
-                <param name="outputs_select" value="no_quality_control"/>
-            </conditional>
-            <param name="imzml_output" value="imzml_format"/>
             <output name="QC_overview" file="rdata_notfiltered.pdf" compare="sim_size" />
             <output name="outfile_imzml" ftype="imzml" file="out7.imzml.txt" compare="sim_size">
-                <extra_files type="file" file="out7.imzml" name="imzml" lines_diff="4"/>
+                <extra_files type="file" file="out7.imzml" name="imzml" lines_diff="6"/>
                 <extra_files type="file" file="out7.ibd" name="ibd" compare="sim_size"/>
             </output>
         </test>
+        <test>
+            <expand macro="processed_infile_imzml"/>
+            <conditional name="processed_cond">
+                <param name="processed_file" value="processed"/>
+                <param name="accuracy" value="100"/>
+                <param name="units" value="ppm"/>
+            </conditional>
+            <param name="pixel_filtering" value="two_columns"/>
+            <param name="annotation_file" ftype="tabular" value="inputpixels_2column.tabular"/>
+            <param name="column_x" value="1"/>
+            <param name="column_y" value="3"/>
+            <param name="features_filtering" value="remove_features"/>
+            <param name="mz_tabular" ftype="tabular" value = "featuresofinterest5.tabular"/>
+            <param name="feature_column" value="1"/>
+            <param name="feature_header" value="0"/>
+            <param name="removal_plusminus" value="100"/>
+            <param name="units_removal" value="ppm"/>
+            <output name="QC_overview" file="imzml_filtered8.pdf" compare="sim_size"/>
+            <output name="outfile_imzml" ftype="imzml" file="out8.imzml.txt" compare="sim_size">
+                <extra_files type="file" file="out8.imzml" name="imzml" lines_diff="6"/>
+                <extra_files type="file" file="out8.ibd" name="ibd" compare="sim_size"/>
+            </output>
+        </test>
     </tests>
     <help>
         <![CDATA[
@@ -581,7 +613,7 @@
 
 - m/z feature removing: 
 
-    - Perturbing m/z features such as matrix contaminants can be removed by specifying their m/z value in a tabular file, optionally with a half window size in ppm or m/z for the window in which peaks should be removed
+    - Perturbing m/z features such as matrix contaminants, tryptic peptides and internal calibrants can be removed by specifying their m/z value in a tabular file, optionally with a half window size in ppm or m/z for the window in which peaks should be removed
 
 
 **Tips**
@@ -598,7 +630,7 @@
 
 **Output**
 
-- MSI data as imzML file or .RData (can be read with the Cardinal package in R)
+- MSI data as (continuous) imzML file
 - pdf with heatmap showing the pixels that are removed and kept as well as histograms of kept and removed m/z
 
 
--- a/macros.xml	Fri Dec 13 13:55:48 2019 -0500
+++ b/macros.xml	Wed Mar 25 08:05:39 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:55:48 2019 -0500
+++ b/test-data/out3.imzml	Wed Mar 25 08:05:39 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:55:48 2019 -0500
+++ b/test-data/out3.imzml.txt	Wed Mar 25 08:05:39 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:55:48 2019 -0500
+++ b/test-data/out4.imzml	Wed Mar 25 08:05:39 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:55:48 2019 -0500
+++ b/test-data/out4.imzml.txt	Wed Mar 25 08:05:39 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:55:48 2019 -0500
+++ b/test-data/out5.imzml	Wed Mar 25 08:05:39 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:55:48 2019 -0500
+++ b/test-data/out5.imzml.txt	Wed Mar 25 08:05:39 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:55:48 2019 -0500
+++ b/test-data/out6.imzml	Wed Mar 25 08:05:39 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:55:48 2019 -0500
+++ b/test-data/out6.imzml.txt	Wed Mar 25 08:05:39 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:55:48 2019 -0500
+++ b/test-data/out7.imzml	Wed Mar 25 08:05:39 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:55:48 2019 -0500
+++ b/test-data/out7.imzml.txt	Wed Mar 25 08:05:39 2020 -0400
@@ -1,4 +1,4 @@
 imzML file:
 total 116
--rw-r--r-- 1 meli meli 95976 Feb 12 00:51 ibd
--rw-r--r-- 1 meli meli 16846 Feb 12 00:51 imzml
+-rw-r--r-- 1 meli meli 95976 Mär 24 19:26 ibd
+-rw-r--r-- 1 meli meli 18199 Mär 24 19:26 imzml
Binary file test-data/out8.ibd has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/out8.imzml	Wed Mar 25 08:05:39 2020 -0400
@@ -0,0 +1,224 @@
+<?xml version="1.0"?>
+<mzML version="1.1" xmlns="http://psi.hupo.org/ms/mzml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://psi.hupo.org/ms/mzml http://psidev.info/files/ms/mzML/xsd/mzML1.1.0_idx.xsd">
+	<cvList count="3">
+		<cv id="MS" fullName="Proteomics Standards Initiative Mass Spectrometry Ontology" version="1.3.1" URI="http://psidev.info/ms/mzML/psi-ms.obo" />
+		<cv id="UO" fullName="Unit Ontology" version="1.15" URI="http://obo.cvs.sourceforge.net/obo/obo/ontology/phenotype/unit.obo" />
+		<cv id="IMS" fullName="Imaging MS Ontology" version="0.9.1" URI="http://www.maldi-msi.org/download/imzml/imagingMS.obo" />
+	</cvList>
+	<fileDescription>
+		<fileContent>
+			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
+			<cvParam cvRef="MS" accession="MS:1000128" name="profile spectrum" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="ace74b18-25e2-4722-89f4-6eedc2b62ed8" />
+			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="41d580d8acf3e67df8b63f001fe941da7334861b" />
+			<cvParam cvRef="IMS" accession="IMS:1000031" name="processed" value="" />
+		</fileContent>
+	</fileDescription>
+	<referenceableParamGroupList count="4">
+		<referenceableParamGroup id="spectrum1">
+			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
+			<cvParam cvRef="MS" accession="MS:1000511" name="ms level" value="0" />
+			<cvParam cvRef="MS" accession="MS:1000128" name="profile spectrum" value="" />
+		</referenceableParamGroup>
+		<referenceableParamGroup id="scan1">
+			<cvParam cvRef="MS" accession="MS:1000093" name="increasing m/z scan" value="" />
+		</referenceableParamGroup>
+		<referenceableParamGroup id="mzArray">
+			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
+			<cvParam cvRef="MS" accession="MS:1000514" name="m/z array" value="" unitCvRef="MS" unitAccession="MS:1000040" unitName="m/z" />
+			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
+		</referenceableParamGroup>
+		<referenceableParamGroup id="intensityArray">
+			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
+			<cvParam cvRef="MS" accession="MS:1000515" name="intensity array" value="" unitCvRef="MS" unitAccession="MS:1000131" unitName="number of counts" />
+			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
+		</referenceableParamGroup>
+	</referenceableParamGroupList>
+	<sampleList count="1">
+		<sample id="sample1" name="Sample1">
+			<cvParam cvRef="MS" accession="MS:1000001" name="sample number" value="1" />
+		</sample>
+	</sampleList>
+	<softwareList count="1">
+		<software id="Cardinal" version="2.4.0">
+			<cvParam cvRef="MS" accession="MS:1000799" name="custom unreleased software tool" value="" />
+		</software>
+	</softwareList>
+	<scanSettingsList count="1">
+		<scanSettings id="scansettings1">
+			<cvParam cvRef="IMS" accession="IMS:1000401" name="top down" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000413" name="flyback" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000480" name="horizontal line scan" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000491" name="linescan left right" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000042" name="max count of pixel x" value="2" />
+			<cvParam cvRef="IMS" accession="IMS:1000043" name="max count of pixel y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000044" name="max dimension x" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000045" name="max dimension y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000046" name="pixel size x" value="2.000000" />
+			<cvParam cvRef="IMS" accession="IMS:1000047" name="pixel size y" value="1.000000" />
+		</scanSettings>
+	</scanSettingsList>
+	<instrumentConfigurationList count="1">
+		<instrumentConfiguration id="IC1">
+			<cvParam cvRef="MS" accession="MS:1000031" name="instrument model" />
+		</instrumentConfiguration>
+	</instrumentConfigurationList>
+	<dataProcessingList count="1">
+		<dataProcessing id="CardinalWriteImzML">
+			<processingMethod order="1" softwareRef="Cardinal">
+				<cvParam cvRef="MS" accession="MS:1000544" name="Conversion to mzML" value="" />
+			</processingMethod>
+		</dataProcessing>
+	</dataProcessingList>
+	<run defaultInstrumentConfigurationRef="IC1" id="Experiment01" sampleRef="sample1">
+		<spectrumList count="5" defaultDataProcessingRef="CardinalWriteImzML">
+			<spectrum id="Spectrum=1" defaultArrayLength="0" index="1">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="33612" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=2" defaultArrayLength="0" index="2">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="67208" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="100804" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=3" defaultArrayLength="0" index="3">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="134400" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="167996" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=4" defaultArrayLength="0" index="4">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="201592" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="235188" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=5" defaultArrayLength="0" index="5">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="268784" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="302380" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8399" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="33596" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+		</spectrumList>
+	</run>
+</mzML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/out8.imzml.txt	Wed Mar 25 08:05:39 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:55:48 2019 -0500
+++ b/test-data/preprocessing_results1.imzml	Wed Mar 25 08:05:39 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:55:48 2019 -0500
+++ b/test-data/preprocessing_results1.imzml.txt	Wed Mar 25 08:05:39 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:55:48 2019 -0500
+++ b/test-data/preprocessing_results2.imzml	Wed Mar 25 08:05:39 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:55:48 2019 -0500
+++ b/test-data/preprocessing_results2.imzml.txt	Wed Mar 25 08:05:39 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:55:48 2019 -0500
+++ b/test-data/preprocessing_results3.imzml	Wed Mar 25 08:05:39 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:55:48 2019 -0500
+++ b/test-data/preprocessing_results3.imzml.txt	Wed Mar 25 08:05:39 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:55:48 2019 -0500
+++ b/test-data/preprocessing_results4.imzml	Wed Mar 25 08:05:39 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:55:48 2019 -0500
+++ b/test-data/preprocessing_results4.imzml.txt	Wed Mar 25 08:05:39 2020 -0400
@@ -1,4 +1,4 @@
 imzML file:
-total 28
--rw-r--r-- 1 meli meli  6376 Feb 24 14:13 ibd
--rw-r--r-- 1 meli meli 16801 Feb 24 14:13 imzml
+total 84
+-rw-r--r-- 1 meli meli 63256 Mär 24 11:35 ibd
+-rw-r--r-- 1 meli meli 18199 Mär 24 11:35 imzml
Binary file test-data/preprocessing_results4.pdf has changed
Binary file test-data/preprocessing_results5.RData has changed
Binary file test-data/preprocessing_results5.ibd has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/preprocessing_results5.imzml	Wed Mar 25 08:05:39 2020 -0400
@@ -0,0 +1,340 @@
+<?xml version="1.0"?>
+<mzML version="1.1" xmlns="http://psi.hupo.org/ms/mzml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://psi.hupo.org/ms/mzml http://psidev.info/files/ms/mzML/xsd/mzML1.1.0_idx.xsd">
+	<cvList count="3">
+		<cv id="MS" fullName="Proteomics Standards Initiative Mass Spectrometry Ontology" version="1.3.1" URI="http://psidev.info/ms/mzML/psi-ms.obo" />
+		<cv id="UO" fullName="Unit Ontology" version="1.15" URI="http://obo.cvs.sourceforge.net/obo/obo/ontology/phenotype/unit.obo" />
+		<cv id="IMS" fullName="Imaging MS Ontology" version="0.9.1" URI="http://www.maldi-msi.org/download/imzml/imagingMS.obo" />
+	</cvList>
+	<fileDescription>
+		<fileContent>
+			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
+			<cvParam cvRef="MS" accession="MS:1000128" name="profile spectrum" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="c88c7d70-c027-4fa3-b274-0af5e7f4d117" />
+			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="16a0f87989392c55b1c02770f15095dcf0d9408e" />
+			<cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" />
+		</fileContent>
+	</fileDescription>
+	<referenceableParamGroupList count="4">
+		<referenceableParamGroup id="spectrum1">
+			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
+			<cvParam cvRef="MS" accession="MS:1000511" name="ms level" value="0" />
+			<cvParam cvRef="MS" accession="MS:1000128" name="profile spectrum" value="" />
+		</referenceableParamGroup>
+		<referenceableParamGroup id="scan1">
+			<cvParam cvRef="MS" accession="MS:1000093" name="increasing m/z scan" value="" />
+		</referenceableParamGroup>
+		<referenceableParamGroup id="mzArray">
+			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
+			<cvParam cvRef="MS" accession="MS:1000514" name="m/z array" value="" unitCvRef="MS" unitAccession="MS:1000040" unitName="m/z" />
+			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
+		</referenceableParamGroup>
+		<referenceableParamGroup id="intensityArray">
+			<cvParam cvRef="MS" accession="MS:1000576" name="no compression" value="" />
+			<cvParam cvRef="MS" accession="MS:1000515" name="intensity array" value="" unitCvRef="MS" unitAccession="MS:1000131" unitName="number of counts" />
+			<cvParam cvRef="IMS" accession="IMS:1000101" name="external data" value="true" />
+			<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" value="" />
+		</referenceableParamGroup>
+	</referenceableParamGroupList>
+	<sampleList count="1">
+		<sample id="sample1" name="Sample1">
+			<cvParam cvRef="MS" accession="MS:1000001" name="sample number" value="1" />
+		</sample>
+	</sampleList>
+	<softwareList count="1">
+		<software id="Cardinal" version="2.4.0">
+			<cvParam cvRef="MS" accession="MS:1000799" name="custom unreleased software tool" value="" />
+		</software>
+	</softwareList>
+	<scanSettingsList count="1">
+		<scanSettings id="scansettings1">
+			<cvParam cvRef="IMS" accession="IMS:1000401" name="top down" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000413" name="flyback" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000480" name="horizontal line scan" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000491" name="linescan left right" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000042" name="max count of pixel x" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000043" name="max count of pixel y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000044" name="max dimension x" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000045" name="max dimension y" value="3" />
+			<cvParam cvRef="IMS" accession="IMS:1000046" name="pixel size x" value="1.000000" />
+			<cvParam cvRef="IMS" accession="IMS:1000047" name="pixel size y" value="1.000000" />
+		</scanSettings>
+	</scanSettingsList>
+	<instrumentConfigurationList count="1">
+		<instrumentConfiguration id="IC1">
+			<cvParam cvRef="MS" accession="MS:1000031" name="instrument model" />
+		</instrumentConfiguration>
+	</instrumentConfigurationList>
+	<dataProcessingList count="1">
+		<dataProcessing id="CardinalWriteImzML">
+			<processingMethod order="1" softwareRef="Cardinal">
+				<cvParam cvRef="MS" accession="MS:1000544" name="Conversion to mzML" value="" />
+			</processingMethod>
+		</dataProcessing>
+	</dataProcessingList>
+	<run defaultInstrumentConfigurationRef="IC1" id="Experiment01" sampleRef="sample1">
+		<spectrumList count="9" defaultDataProcessingRef="CardinalWriteImzML">
+			<spectrum id="Spectrum=1" defaultArrayLength="0" index="1">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="41608" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=2" defaultArrayLength="0" index="2">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="83200" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=3" defaultArrayLength="0" index="3">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="1" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="1.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="124792" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=4" defaultArrayLength="0" index="4">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="166384" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=5" defaultArrayLength="0" index="5">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="207976" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=6" defaultArrayLength="0" index="6">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="2" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="2.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="249568" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=7" defaultArrayLength="0" index="7">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="1" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="1.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="291160" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=8" defaultArrayLength="0" index="8">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="2" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="2.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="332752" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+			<spectrum id="Spectrum=9" defaultArrayLength="0" index="9">
+				<referenceableParamGroupRef ref="spectrum1" />
+				<scanList count="1">
+					<cvParam cvRef="MS" accession="MS:1000795" name="no combination" value="" />
+					<scan instrumentConfigurationRef="IC1">
+						<referenceableParamGroupRef ref="scan1" />
+						<cvParam cvRef="IMS" accession="IMS:1000050" name="position x" value="3" />
+						<cvParam cvRef="IMS" accession="IMS:1000051" name="position y" value="3" />
+						<userParam name="3DPositionX" value="3.000000" />
+						<userParam name="3DPositionY" value="3.000000" />
+					</scan>
+				</scanList>
+				<binaryDataArrayList count="2">
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="mzArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+					<binaryDataArray encodedLength="0">
+						<referenceableParamGroupRef ref="intensityArray" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="374344" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="10398" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="41592" />
+						<binary />
+					</binaryDataArray>
+				</binaryDataArrayList>
+			</spectrum>
+		</spectrumList>
+	</run>
+</mzML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/preprocessing_results5.imzml.txt	Wed Mar 25 08:05:39 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