I don't think this will be possible as it stands, the option to not check
segments is not supported and is not recommended (as per the spatstat
documentation).

Coding the solution for lines and pixels is beyond me (which is why I use
pixellate for the trip function) but my understanding is that at some level
there is a tabulation of "cell-crossing" points where the line segments
intersect pixel boundaries, and this tabulation is ambiguous for
non-intersecting points - so there's a kind of "reflection" that adds
"spurious" counts.


Anyway, I'm sure there would be a way to do it with your data, even if you
have work on smaller grids at a time and combine them later. It would be
worth creating an example that exhausts your computer so that others can
experiment with different options.

My main point is that this is not a "problem" in spatstat, just perhaps an
unexpected result from usage that is not recommended or supported.

Cheers, Mike.

On Monday, November 28, 2011, Pinaud David <pinaud@cebc.cnrs.fr> wrote:
> Dear all,
> I want to convert a line segment (trajectory of an animal) to a pixel
image (a study area), using pixellate.psp() in spatstat package.
> For some reasons, some animals moved outside the study area, so I set
spatstat.options(checksegments=F).
> It seems that pixellate.psp() adds values in cells that are not visited
by the animal, in the border of the grid (see the plot with given example)
> I was thinking about alternative solutions (like calculation on a larger
grid including all the spatial range of the trip), but we faced to memory
(or running time) problems. We need to do that for >800 trips, on a 40000
cells grid... Another way would be to use clip.psp() firt, but I need to
keep extra information about each segment (eg. ID, time).
>
> Here a reproducible example:
> library(spatstat)
> spatstat.options(checksegments=F) # to allow segment outside the window
>     # the sutdy area :
> grida <- owin(c(-0.5, 10.5), c(3.5, 6.5), mask=matrix(TRUE,
length(seq(3.5, 6.5, by=1)),length(seq(-0.5, 10.5, by=1))),
 xy=list(x=seq(-0.5, 10.5, by=1), y=seq(3.5, 6.5, by=1)))
>    # the segment :
> d <- psp(x0 = 1:9, x1 = 2:10, y0 = c(1, 1.5, 2, 4, 5, 5.5, 8, 8, 6), y1 =
c(1.5, 2, 4, 5, 5.5, 8, 8, 6, 10), window=grida)
>    # segment length per cell
> pixd <- pixellate.psp(d, W=grida)
>    # plotting, some pixels with value>0 but without segment
> plot.im(pixd)
> plot(d, add=T)
>
>  sessionInfo()
> R version 2.13.1 (2011-07-08)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252
> [3] LC_MONETARY=French_France.1252 LC_NUMERIC=C
> [5] LC_TIME=French_France.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] trip_1.1-10     sp_0.9-88       spatstat_1.23-4 deldir_0.0-15
> [5] mgcv_1.7-6
>
> loaded via a namespace (and not attached):
> [1] grid_2.13.1        lattice_0.19-30    Matrix_0.9996875-3 nlme_3.1-101
> [5] tools_2.13.1
>
> So, how to pixellate a psp object when some points fall outside the owin
without using clip.psp?
>
> Many thanks
>
> David
>
>
> --
> ***************************************************
> Dr. David PINAUD
> Ingénieur de Recherche "Analyses spatiales"
>
> Centre d'Etudes Biologiques de Chizé - CNRS UPR1934
> 79360 Villiers-en-Bois, France
> poste 485
> Tel: +33 (0)5.49.09.35.58
> Fax: +33 (0)5.49.09.65.26
> http://www.cebc.cnrs.fr/
>
> ***************************************************
>
>
>
>
> __________ Information from ESET Mail Security, version of virus
signature database 6664 (20111127) __________
>
> The message was checked by ESET Mail Security.
> http://www.eset.com
>
>

	[[alternative HTML version deleted]]

