Running ‘test_constructors.R’ [10s/11s]
  Running ‘test_csr_filter.R’ [78s/90s]
  Running ‘test_ext_data.R’ [16s/21s]
  Running ‘test_global_ref_filter.R’ [100s/120s]
  Running ‘test_pixel_count_filter.R’ [133s/149s]
Running the tests in ‘tests/test_pixel_count_filter.R’ failed.
Complete output:
  > # Test pixel count filter
  > 
  > library(testthat)
  > library(SPUTNIK)
  > 
  > test_that("pixel count filter", {
  +   MIN_NUM_PIXELS <- 9
  + 
  +   x <- bladderMALDIRompp2010(verbose = TRUE)
  +   mz <- attr(x, "mass")
  +   shape <- attr(x, "size")
  + 
  +   msX <- msiDataset(values = x, mz = mz, rsize = shape[1], csize = shape[2])
  +   msX <- normIntensity(msX, "PQN")
  +   msX <- varTransform(msX, "log2")
  +   
  +   refImg <- refImageContinuous(msX, method = "sum")
  +   roiImg <- refImageBinaryOtsu(refImg)
  +   
  +   cpfAggr0 <- countPixelsFilter(
  +     msiData = msX, roiImage = roiImg,
  +     minNumPixels = MIN_NUM_PIXELS, aggressive = 0
  +   )
  +   cpfAggr1 <- countPixelsFilter(
  +     msiData = msX, roiImage = roiImg,
  +     minNumPixels = MIN_NUM_PIXELS, aggressive = 1
  +   )
  +   cpfAggr2 <- countPixelsFilter(
  +     msiData = msX, roiImage = roiImg,
  +     minNumPixels = MIN_NUM_PIXELS, aggressive = 2
  +   )
  +   expect_is(cpfAggr0, "list")
  +   expect_equal(attr(cpfAggr0, "peak.filter"), T)
  +   expect_equal(attr(cpfAggr0, "filter"), "countPixels")
  +   expect_is(cpfAggr1, "list")
  +   expect_equal(attr(cpfAggr1, "peak.filter"), T)
  +   expect_equal(attr(cpfAggr1, "filter"), "countPixels")
  +   expect_is(cpfAggr2, "list")
  +   expect_equal(attr(cpfAggr2, "peak.filter"), T)
  +   expect_equal(attr(cpfAggr2, "filter"), "countPixels")
  + 
  +   # Number of selected peaks must be: numAggressive0 >= numAggressive1 >=
  +   # numAggressive >= 2
  +   expect_true((length(cpfAggr0$sel.peaks) >= length(cpfAggr1$sel.peaks)) &&
  +     (length(cpfAggr0$sel.peaks) >= length(cpfAggr2$sel.peaks)) &&
  +     (length(cpfAggr1$sel.peaks) >= length(cpfAggr2$sel.peaks)))
  +   expect_equal(length(cpfAggr0$sel.peaks), 174)
  +   expect_equal(length(cpfAggr1$sel.peaks), 152)
  +   expect_equal(length(cpfAggr2$sel.peaks), 86)
  + })
  Downloading the data from the repository...
  trying URL 'https://raw.github.com/paoloinglese/SPUTNIKexamples/master/data/maldiData.rda'
  Content type 'application/octet-stream' length 6306944 bytes (6.0 MB)
  ==================================================
  downloaded 6.0 MB
  
  Loading the data in the R environment...
  Creating msiDataset object...
  Detecting constant peaks...
  Generating image of detected peaks...
  Generating total-ion-count image...
  Counting connected pixels within signal region...
  Counting connected pixels within signal region...
  Counting connected pixels within signal region...
  ── Failure (???): pixel count filter ───────────────────────────────────────────
  length(cpfAggr1$sel.peaks) not equal to 152.
  1/1 mismatches
  [1] 151 - 152 == -1
  
  Error in reporter$stop_if_needed() : Test failed
  Calls: test_that -> <Anonymous>
  Execution halted