Re: [R] 2D filter in R?

2012-01-11 Thread David Winsemius


On Jan 11, 2012, at 6:21 PM, Michael wrote:


Okay thanks guys!

I was actually looking for image processing libraries in R.

Specifically, I am looking for something like "filter2d" for
images(pixels)...

(speed is not a concern for me, since my images are really small,  
200x200,

etc.)

And in fact, these are not images, these are 2d matrix numbers(i.e.  
numbers

in a matrix format), I just wanted to smooth them.

Any more pointers?


Besides the huge amount of spatial regression material that you should  
have found by looking up links from the 'spatstat' citation (and the  
Geospatial Task View:  http://cran.r-project.org/web/views/ 
Spatial.html), you should consider looking for packages and websites  
the deal with functional MRI (fMRI). I also think there may be value  
in looking at package 'locfit' and the 'mgcv' package, although they  
may need special coercion to apply the kernels you expressed interest  
in using.


On my machine this brings up the biOps package:

??"image processing"

And this is the same search with RSiteSearch

201 hits from:
http://search.r-project.org/cgi-bin/namazu.cgi?query=%22image+processing%22&max=100&result=normal&sort=score&idxname=functions&idxname=Rhelp08&idxname=Rhelp10&idxname=Rhelp02

--
David.


Thanks a lot!

On Wed, Jan 11, 2012 at 5:18 PM, Bert Gunter  
 wrote:



?loess   ## in base R
does 2d filtering , though it's not a Gaussian one

-- Bert

On Wed, Jan 11, 2012 at 3:00 PM, Rolf Turner 
wrote:

On 12/01/12 09:17, Michael wrote:


Hi all,

I am looking for a command for doing 2D filtering (rectangular or
Gaussian) in R...

I have looked at ksmooth, filter and convolve but they seem to be  
1D...


Any thoughts?

Thanks a lot!



I'm not sure what you really need/want to do, but you might have a  
look
at "smooth.ppp" (and possibly "density.ppp") from the "spatstat"  
package.


  cheers,

  Rolf Turner

__
R-help@r-project.org mailing list
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.




--

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:

http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.


David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
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.


Re: [R] 2D filter in R?

2012-01-11 Thread Michael
Thanks a lot Bert!

Are z, y and x are of the same length?

And after the loess I just "reshape" the "stacked" outputs back into a 2d
matrix?

Thanks again!




On Wed, Jan 11, 2012 at 5:33 PM, Bert Gunter  wrote:

> You have to set the data up as 3 columns:
>
> z = Values
> y = row
> x = column
>
> (This is trivial to do)
>
> and then use:
>
> fit.lo <- loess(z ~ x + y,...)
>
> For the other stuff, check references and documentation. If this is
> too difficult for you, get local help or look elsewhere (e.g.
> Bioconductor) for something that better fits your background and
> amount of effort your willing to make.
>
> -- Bert
>
> On Wed, Jan 11, 2012 at 3:26 PM, Michael  wrote:
> > I looked the "loess" up...
> >
> > But I am confused... what should be my "formula" if I just want to smooth
> > the numbers of my matrix x?
> > And those lots of parameters are daunting... what are the essential ones
> > that I should definitely set up?
> > I remember for 2d Gaussian filter, I just need to set one parameter
> which is
> > a scaling lambda
> >
> > Could you please help me?
> >
> > Thanks a lot!
> >
> >
> > loess(formula, data, weights, subset, na.action, model = FALSE,
> >   span = 0.75, enp.target, degree = 2,
> >   parametric = FALSE, drop.square = FALSE, normalize = TRUE,
> >   family = c("gaussian", "symmetric"),
> >   method = c("loess", "model.frame"),
> >   control = loess.control(...), ...)
> >
> >
> >
> >
> >
> >
> > On Wed, Jan 11, 2012 at 5:18 PM, Bert Gunter 
> wrote:
> >>
> >> ?loess   ## in base R
> >> does 2d filtering , though it's not a Gaussian one
> >>
> >> -- Bert
> >>
> >> On Wed, Jan 11, 2012 at 3:00 PM, Rolf Turner 
> >> wrote:
> >> > On 12/01/12 09:17, Michael wrote:
> >> >>
> >> >> Hi all,
> >> >>
> >> >> I am looking for a command for doing 2D filtering (rectangular or
> >> >> Gaussian) in R...
> >> >>
> >> >> I have looked at ksmooth, filter and convolve but they seem to be
> 1D...
> >> >>
> >> >> Any thoughts?
> >> >>
> >> >> Thanks a lot!
> >> >
> >> >
> >> > I'm not sure what you really need/want to do, but you might have a
> look
> >> > at "smooth.ppp" (and possibly "density.ppp") from the "spatstat"
> >> > package.
> >> >
> >> >cheers,
> >> >
> >> >Rolf Turner
> >> >
> >> > __
> >> > R-help@r-project.org mailing list
> >> > 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.
> >>
> >>
> >>
> >> --
> >>
> >> Bert Gunter
> >> Genentech Nonclinical Biostatistics
> >>
> >> Internal Contact Info:
> >> Phone: 467-7374
> >> Website:
> >>
> >>
> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
> >
> >
>
>
>
> --
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
>
> Internal Contact Info:
> Phone: 467-7374
> Website:
>
> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.


Re: [R] 2D filter in R?

2012-01-11 Thread Michael
I looked the "loess" up...

But I am confused... what should be my "formula" if I just want to smooth
the numbers of my matrix x?
And those lots of parameters are daunting... what are the essential ones
that I should definitely set up?
I remember for 2d Gaussian filter, I just need to set one parameter which
is a scaling lambda

Could you please help me?

Thanks a lot!


loess(formula, data, weights, subset, na.action, model = FALSE,
  span = 0.75, enp.target, degree = 2,
  parametric = FALSE, drop.square = FALSE, normalize = TRUE,
  family = c("gaussian", "symmetric"),
  method = c("loess", "model.frame"),
  control = loess.control(...), ...)






On Wed, Jan 11, 2012 at 5:18 PM, Bert Gunter  wrote:

> ?loess   ## in base R
> does 2d filtering , though it's not a Gaussian one
>
> -- Bert
>
> On Wed, Jan 11, 2012 at 3:00 PM, Rolf Turner 
> wrote:
> > On 12/01/12 09:17, Michael wrote:
> >>
> >> Hi all,
> >>
> >> I am looking for a command for doing 2D filtering (rectangular or
> >> Gaussian) in R...
> >>
> >> I have looked at ksmooth, filter and convolve but they seem to be 1D...
> >>
> >> Any thoughts?
> >>
> >> Thanks a lot!
> >
> >
> > I'm not sure what you really need/want to do, but you might have a look
> > at "smooth.ppp" (and possibly "density.ppp") from the "spatstat" package.
> >
> >cheers,
> >
> >Rolf Turner
> >
> > __
> > R-help@r-project.org mailing list
> > 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.
>
>
>
> --
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
>
> Internal Contact Info:
> Phone: 467-7374
> Website:
>
> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.


Re: [R] 2D filter in R?

2012-01-11 Thread Bert Gunter
The Bioconductor list/repository will have lots of image processing stuff.

-- Bert

On Wed, Jan 11, 2012 at 3:21 PM, Michael  wrote:
> Okay thanks guys!
>
> I was actually looking for image processing libraries in R.
>
> Specifically, I am looking for something like "filter2d" for
> images(pixels)...
>
> (speed is not a concern for me, since my images are really small, 200x200,
> etc.)
>
> And in fact, these are not images, these are 2d matrix numbers(i.e. numbers
> in a matrix format), I just wanted to smooth them.
>
> Any more pointers?
>
> Thanks a lot!
>
> On Wed, Jan 11, 2012 at 5:18 PM, Bert Gunter  wrote:
>>
>> ?loess   ## in base R
>> does 2d filtering , though it's not a Gaussian one
>>
>> -- Bert
>>
>> On Wed, Jan 11, 2012 at 3:00 PM, Rolf Turner 
>> wrote:
>> > On 12/01/12 09:17, Michael wrote:
>> >>
>> >> Hi all,
>> >>
>> >> I am looking for a command for doing 2D filtering (rectangular or
>> >> Gaussian) in R...
>> >>
>> >> I have looked at ksmooth, filter and convolve but they seem to be 1D...
>> >>
>> >> Any thoughts?
>> >>
>> >> Thanks a lot!
>> >
>> >
>> > I'm not sure what you really need/want to do, but you might have a look
>> > at "smooth.ppp" (and possibly "density.ppp") from the "spatstat"
>> > package.
>> >
>> >    cheers,
>> >
>> >        Rolf Turner
>> >
>> > __
>> > R-help@r-project.org mailing list
>> > 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.
>>
>>
>>
>> --
>>
>> Bert Gunter
>> Genentech Nonclinical Biostatistics
>>
>> Internal Contact Info:
>> Phone: 467-7374
>> Website:
>>
>> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
>
>



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
R-help@r-project.org mailing list
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.


Re: [R] 2D filter in R?

2012-01-11 Thread Michael
Okay thanks guys!

I was actually looking for image processing libraries in R.

Specifically, I am looking for something like "filter2d" for
images(pixels)...

(speed is not a concern for me, since my images are really small, 200x200,
etc.)

And in fact, these are not images, these are 2d matrix numbers(i.e. numbers
in a matrix format), I just wanted to smooth them.

Any more pointers?

Thanks a lot!

On Wed, Jan 11, 2012 at 5:18 PM, Bert Gunter  wrote:

> ?loess   ## in base R
> does 2d filtering , though it's not a Gaussian one
>
> -- Bert
>
> On Wed, Jan 11, 2012 at 3:00 PM, Rolf Turner 
> wrote:
> > On 12/01/12 09:17, Michael wrote:
> >>
> >> Hi all,
> >>
> >> I am looking for a command for doing 2D filtering (rectangular or
> >> Gaussian) in R...
> >>
> >> I have looked at ksmooth, filter and convolve but they seem to be 1D...
> >>
> >> Any thoughts?
> >>
> >> Thanks a lot!
> >
> >
> > I'm not sure what you really need/want to do, but you might have a look
> > at "smooth.ppp" (and possibly "density.ppp") from the "spatstat" package.
> >
> >cheers,
> >
> >Rolf Turner
> >
> > __
> > R-help@r-project.org mailing list
> > 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.
>
>
>
> --
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
>
> Internal Contact Info:
> Phone: 467-7374
> Website:
>
> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.


Re: [R] 2D filter in R?

2012-01-11 Thread Bert Gunter
?loess   ## in base R
does 2d filtering , though it's not a Gaussian one

-- Bert

On Wed, Jan 11, 2012 at 3:00 PM, Rolf Turner  wrote:
> On 12/01/12 09:17, Michael wrote:
>>
>> Hi all,
>>
>> I am looking for a command for doing 2D filtering (rectangular or
>> Gaussian) in R...
>>
>> I have looked at ksmooth, filter and convolve but they seem to be 1D...
>>
>> Any thoughts?
>>
>> Thanks a lot!
>
>
> I'm not sure what you really need/want to do, but you might have a look
> at "smooth.ppp" (and possibly "density.ppp") from the "spatstat" package.
>
>    cheers,
>
>        Rolf Turner
>
> __
> R-help@r-project.org mailing list
> 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
R-help@r-project.org mailing list
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.


Re: [R] 2D filter in R?

2012-01-11 Thread Rolf Turner

On 12/01/12 09:17, Michael wrote:

Hi all,

I am looking for a command for doing 2D filtering (rectangular or
Gaussian) in R...

I have looked at ksmooth, filter and convolve but they seem to be 1D...

Any thoughts?

Thanks a lot!


I'm not sure what you really need/want to do, but you might have a look
at "smooth.ppp" (and possibly "density.ppp") from the "spatstat" package.

cheers,

Rolf Turner

__
R-help@r-project.org mailing list
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] 2D filter in R?

2012-01-11 Thread Michael
Hi all,

I am looking for a command for doing 2D filtering (rectangular or
Gaussian) in R...

I have looked at ksmooth, filter and convolve but they seem to be 1D...

Any thoughts?

Thanks a lot!

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.