Your workflow in principle is: - read the image into an object for which you can obtain values-per-pixel in a 2D structure; - read the shapefile and convert into a polygon; - determine the bounding box of the polygon; - use the inout() function of the splancs package to get a list of booleans for the points in the bounding box, TRUE if they are _inside_ the polygon; - subset your image points to those for which inout() returns TRUE; - plot as boxplot().
The CRAN taskview http://cran.r-project.org/web/views/MedicalImaging.html has a section on general image processing, guiding you to helpful packages. Ask again if you get stuck - but(!): - see here for some hints on how to ask questions productively: http://adv-r.had.co.nz/Reproducibility.html http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example - ... and please read the posting guide and don't post in HTML. B. On Jun 15, 2015, at 7:19 AM, Preethi Balaji <preet.balaj...@gmail.com> wrote: > Dear all, > > I am trying to generate boxplots by giving a shapefile and an image as > input. The shapefile takes the pixel values from the image and shows > the distribution of pixels in the form of a boxplot. > > Can somebody please tell me how I can execute this in R? > > Many thanks! > > -- > > Regards, > Preethi Malur Balaji | PhD Student > University College Cork | Cork, Ireland. > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.