EBImage: putting two images next to each others
2
0
Entering edit mode
Simon Anders ★ 3.7k
@simon-anders-3855
Last seen 3.7 years ago
Zentrum für Molekularbiologie, Universi…
Hi Andrzej (or anybody else who might know), if I have to Image objects with the same vertical size, how can I combine them into one wide Image object, with the two images placed next to each other? I tried the following: library( EBImage) lena <- readImage(system.file("images", "lena-color.png", package="EBImage")) display( abind( lena, lena, along=1 ) ) This work, but Lena turns from colour to black&white. Thanks in advance Simon > sessionInfo() R version 2.15.2 (2012-10-26) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8 [5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 [7] LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] abind_1.4-0 EBImage_4.0.0 loaded via a namespace (and not attached): [1] jpeg_0.1-2 png_0.1-4 tiff_0.1-3 tools_2.15.2
• 1.7k views
ADD COMMENT
0
Entering edit mode
Gregoire Pau ▴ 60
@gregoire-pau-5351
Last seen 9.6 years ago
Hello Simon, The method abind hasn't been overloaded in EBImage and returns an array, instead of an Image object, and loses the "colormode " property, which is needed by display() to render an image (since a multidimensional array could represent either a sequence of grayscale images or a color image). The array has to be recasted in an Image: the following code should work: > display(Image(abind( lena, lena, along=1 ), colormode=Color)) It should be easy to overload abind in EBImage. Cheers, Greg On Sat, Feb 9, 2013 at 4:58 AM, Simon Anders <anders@embl.de> wrote: > Hi Andrzej (or anybody else who might know), > > if I have to Image objects with the same vertical size, how can I combine > them into one wide Image object, with the two images placed next to each > other? > > I tried the following: > > library( EBImage) > lena <- readImage(system.file("images"**, > "lena-color.png", package="EBImage")) > display( abind( lena, lena, along=1 ) ) > > This work, but Lena turns from colour to black&white. > > Thanks in advance > Simon > > > sessionInfo() > R version 2.15.2 (2012-10-26) > Platform: x86_64-pc-linux-gnu (64-bit) > > locale: > [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C > [3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8 > [5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 > [7] LC_PAPER=C LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] abind_1.4-0 EBImage_4.0.0 > > loaded via a namespace (and not attached): > [1] jpeg_0.1-2 png_0.1-4 tiff_0.1-3 tools_2.15.2 > > ______________________________**_________________ > Bioconductor mailing list > Bioconductor@r-project.org > https://stat.ethz.ch/mailman/**listinfo/bioconductor<https: stat.et="" hz.ch="" mailman="" listinfo="" bioconductor=""> > Search the archives: http://news.gmane.org/gmane.** > science.biology.informatics.**conductor<http: news.gmane.org="" gmane.="" science.biology.informatics.conductor=""> > [[alternative HTML version deleted]]
ADD COMMENT
0
Entering edit mode
Simon Anders ★ 3.7k
@simon-anders-3855
Last seen 3.7 years ago
Zentrum für Molekularbiologie, Universi…
Hi On 09/02/13 13:58, Simon Anders wrote: > if I have to Image objects with the same vertical size, how can I > combine them into one wide Image object, with the two images placed next > to each other? Sorry, I was to fast in asking, and found the answer myself: This here removes the colours, > display( abind( lena, lena, along=1 ) ) but this works: > display( Image( abind( lena, lena, along=1 ), colormode="color" ) ) Overloading 'rbind' and 'cbind' might be a good idea for the next release to get a more elegant idiom. Or do we already have something like that? Simon
ADD COMMENT

Login before adding your answer.

Traffic: 950 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6