From stefan at sun.ac.za Thu Mar 1 01:47:04 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Wed, 29 Feb 2012 22:47:04 -0800 Subject: RFC: Multiple backends + speedy looping In-Reply-To: References: Message-ID: Hi Nadav On Wed, Feb 29, 2012 at 9:36 PM, Nadav Horesh wrote: > I am working on a simple frame work as a replacement for > ndimage.genereic_filter and numeric's neighbourhood iterator (I hope it > would be faster and easier to use). The goal of this PR is to support any backend (including, possibly, the one you are writing). I'd like to provide multiple implementations of some commonly used functions (convolution, e.g.), so that we can have a performance based series of fallbacks, such as GPU -> Cython -> Python. That way, algorithms can be run on any system, but will execute most rapidly on those supporting, say, OpenCL. Another advantage is that if, in the future, we write an even faster implementation, the benefit is immediately available to the user, without rewriting any code. St?fan From nadavh.horesh at gmail.com Thu Mar 1 00:36:56 2012 From: nadavh.horesh at gmail.com (Nadav Horesh) Date: Thu, 1 Mar 2012 07:36:56 +0200 Subject: RFC: Multiple backends + speedy looping In-Reply-To: References: Message-ID: I am working on a simple frame work as a replacement for ndimage.genereic_filter and numeric's neighbourhood iterator (I hope it would be faster and easier to use). Do you plan that the backend engine would fill this purpose? Nadav. ?????? 1 ???? 2012 01:13, ??? St?fan van der Walt : > Hello everyone, > > After the skimage 0.5 release, it's time to start planning the Next > Big Thing (TM). I hoped there would be a better solution by now, but > it seems that one of our main weak points is still that we cannot do > fast looping over images (e.g., filtering). > > We have multiple computing back-end support available as a pull > request from Pieter Holtzhausen's GSOC--the code is fairly simple to > understand, and doesn't complicate the framework more than necessary. > This will allow us to, when doing convolutions e.g., first try doing > it via OpenCL, and then to fall back to the CPU. We also have a full > testing framework in place, so that the output from different > back-ends are compared. > > Have a look at the code here: > > https://github.com/scikits-image/scikits-image/pull/14/files > > If you have a better solution or other alternatives in mind, please > let me know; I'm keen to explore this space further. > > Regards > St?fan > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kmichael.aye at gmail.com Fri Mar 2 09:54:54 2012 From: kmichael.aye at gmail.com (Michael Aye) Date: Fri, 2 Mar 2012 06:54:54 -0800 (PST) Subject: ANN: scikits-image v0.5 In-Reply-To: References: Message-ID: <16003163.926.1330700094618.JavaMail.geo-discussion-forums@vbgu10> Can it be that you accidentally GIT-ted version.py, a file that presumably is being created automatically? Or is there a reason for GITting it? Regards, Michael On Monday, February 27, 2012 6:16:40 AM UTC+1, Stefan van der Walt wrote: > > Announcement: scikits-image 0.5 > =============================== > > We're happy to announce the 0.5 release of scikits-image, our image > processing > toolbox for SciPy. > > For more information, please visit our website > > http://scikits-image.org > > New Features > ------------ > - Consistent intensity rescaling and improved range conversion. > - Random walker segmentation. > - Harris corner detection. > - Otsu thresholding. > - Block views, window views and montage. > - Plugin for Christoph Golke's "tifffile". > - Peak detection. > - Improved FreeImage wrappers and meta-data reading. > - 8-neighbor and background labelling. > > ... along with updates to the documentation and website, and a number of > bug > fixes. > > Contributors to this release > ---------------------------- > * Andreas Mueller > * Brian Holt > * Christoph Gohlke > * Emmanuelle Gouillart > * Michael Aye > * Nelle Varoquaux > * Nicolas Pinto > * Nicolas Poilvert > * Pieter Holtzhausen > * Stefan van der Walt > * Tony S Yu > * Warren Weckesser > * Zachary Pincus > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan at sun.ac.za Fri Mar 2 10:30:25 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Fri, 2 Mar 2012 07:30:25 -0800 Subject: ANN: scikits-image v0.5 In-Reply-To: <16003163.926.1330700094618.JavaMail.geo-discussion-forums@vbgu10> References: <16003163.926.1330700094618.JavaMail.geo-discussion-forums@vbgu10> Message-ID: On Fri, Mar 2, 2012 at 6:54 AM, Michael Aye wrote: > Can it be that you accidentally GIT-ted version.py, a file that presumably > is being created automatically? Or is there a reason for GITting it? The file should be checked in, and has the following contents: https://github.com/scikits-image/scikits-image/blob/master/skimage/version.py Note the "unbuilt-dev" designation. St?fan From kmichael.aye at gmail.com Fri Mar 2 12:12:24 2012 From: kmichael.aye at gmail.com (Michael Aye) Date: Fri, 2 Mar 2012 09:12:24 -0800 (PST) Subject: sub modules missing? Message-ID: <2972847.1315.1330708344535.JavaMail.geo-discussion-forums@vbbfy7> In [48]: import skimage. skimage._osp skimage.util skimage.version In [48]: import skimage. and: In [46]: from skimage import exposure --------------------------------------------------------------------------- ImportError Traceback (most recent call last) /Users/maye/Dropbox/src/pymars/ in () ----> 1 from skimage import exposure ImportError: cannot import name exposure In [47]: skimage.__version__ Out[47]: '0.6dev' What happened here? Please help. Best regards, Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From kmichael.aye at gmail.com Fri Mar 2 12:37:56 2012 From: kmichael.aye at gmail.com (Michael Aye) Date: Fri, 2 Mar 2012 09:37:56 -0800 (PST) Subject: sub modules missing? In-Reply-To: <2972847.1315.1330708344535.JavaMail.geo-discussion-forums@vbbfy7> References: <2972847.1315.1330708344535.JavaMail.geo-discussion-forums@vbbfy7> Message-ID: <29534680.1210.1330709876547.JavaMail.geo-discussion-forums@vbbgt10> On Friday, March 2, 2012 6:12:24 PM UTC+1, Michael Aye wrote: > > In [48]: import skimage. > skimage._osp skimage.util skimage.version > > In [48]: import skimage. > > and: > > In [46]: from skimage import exposure > --------------------------------------------------------------------------- > ImportError Traceback (most recent call last) > /Users/maye/Dropbox/src/pymars/ in > () > ----> 1 from skimage import exposure > > ImportError: cannot import name exposure > > In [47]: skimage.__version__ > Out[47]: '0.6dev' > > What happened here? > Please help. > > Not the most orthodox and efficient method but I guess I required some clean-up somewhere from my previous 0.5dev build. I removed my git clone and started from scratch. Then the 0.6dev works fine. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kmichael.aye at gmail.com Fri Mar 2 12:38:37 2012 From: kmichael.aye at gmail.com (Michael Aye) Date: Fri, 2 Mar 2012 09:38:37 -0800 (PST) Subject: sub modules missing? In-Reply-To: <29534680.1210.1330709876547.JavaMail.geo-discussion-forums@vbbgt10> References: <2972847.1315.1330708344535.JavaMail.geo-discussion-forums@vbbfy7> <29534680.1210.1330709876547.JavaMail.geo-discussion-forums@vbbgt10> Message-ID: <18494649.405.1330709917583.JavaMail.geo-discussion-forums@vbcu2> On Friday, March 2, 2012 6:37:56 PM UTC+1, Michael Aye wrote: > > > > On Friday, March 2, 2012 6:12:24 PM UTC+1, Michael Aye wrote: >> >> In [48]: import skimage. >> skimage._osp skimage.util skimage.version >> >> In [48]: import skimage. >> >> and: >> >> In [46]: from skimage import exposure >> >> --------------------------------------------------------------------------- >> ImportError Traceback (most recent call >> last) >> /Users/maye/Dropbox/src/pymars/ in >> () >> ----> 1 from skimage import exposure >> >> ImportError: cannot import name exposure >> >> In [47]: skimage.__version__ >> Out[47]: '0.6dev' >> >> What happened here? >> Please help. >> >> > Not the most orthodox and efficient method but I guess I required some > clean-up somewhere from my previous 0.5dev build. I removed my git clone > and started from scratch. Then the 0.6dev works fine. > > With unorthodox and low efficiency I described my solution of removing the whole clone. ;) -------------- next part -------------- An HTML attachment was scrubbed... URL: From kmichael.aye at gmail.com Fri Mar 2 12:42:05 2012 From: kmichael.aye at gmail.com (Michael Aye) Date: Fri, 2 Mar 2012 09:42:05 -0800 (PST) Subject: sub modules missing? In-Reply-To: <18494649.405.1330709917583.JavaMail.geo-discussion-forums@vbcu2> References: <2972847.1315.1330708344535.JavaMail.geo-discussion-forums@vbbfy7> <29534680.1210.1330709876547.JavaMail.geo-discussion-forums@vbbgt10> <18494649.405.1330709917583.JavaMail.geo-discussion-forums@vbcu2> Message-ID: <19617838.1303.1330710125439.JavaMail.geo-discussion-forums@vbai14> On Friday, March 2, 2012 6:38:37 PM UTC+1, Michael Aye wrote: > > > > On Friday, March 2, 2012 6:37:56 PM UTC+1, Michael Aye wrote: >> >> >> >> On Friday, March 2, 2012 6:12:24 PM UTC+1, Michael Aye wrote: >>> >>> In [48]: import skimage. >>> skimage._osp skimage.util skimage.version >>> >>> In [48]: import skimage. >>> >>> and: >>> >>> In [46]: from skimage import exposure >>> >>> --------------------------------------------------------------------------- >>> ImportError Traceback (most recent call >>> last) >>> /Users/maye/Dropbox/src/pymars/ in >>> () >>> ----> 1 from skimage import exposure >>> >>> ImportError: cannot import name exposure >>> >>> In [47]: skimage.__version__ >>> Out[47]: '0.6dev' >>> >>> What happened here? >>> Please help. >>> >>> >> Not the most orthodox and efficient method but I guess I required some >> clean-up somewhere from my previous 0.5dev build. I removed my git clone >> and started from scratch. Then the 0.6dev works fine. >> >> With unorthodox and low efficiency I described my solution of removing > the whole clone. ;) > I'm talking to myself, sorry for the SPAM. But I just wanted to let people know, that it all might just have been fine with a %rehash in iPython, because interestingly it even uses the hash when typing skimage..( I thought submodules would be found by 'real-time' digging into the module namespace given, but I was wrong.) Now that I destroyed the line of evidence, I can not know though if that was all that was wrong here. Case closed. ;) Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From kmichael.aye at gmail.com Fri Mar 2 12:50:31 2012 From: kmichael.aye at gmail.com (Michael Aye) Date: Fri, 2 Mar 2012 09:50:31 -0800 (PST) Subject: Imshow and Linescan - first version In-Reply-To: <4F4B491D.5070902@mitotic-machine.org> References: <0a962708-d617-45d0-b343-b7e774f23965@b23g2000yqn.googlegroups.com> <4F3E69CD.3010204@mitotic-machine.org> <4F422A54.9000902@mitotic-machine.org> <4F462170.4010206@mitotic-machine.org> <4F4743FD.20304@mitotic-machine.org> <4F4B491D.5070902@mitotic-machine.org> Message-ID: <26204287.708.1330710631363.JavaMail.geo-discussion-forums@vbne13> On Monday, February 27, 2012 10:13:01 AM UTC+1, Guillaume wrote: > > Le 26/02/2012 21:15, St?fan van der Walt a ?crit : > > On Sat, Feb 25, 2012 at 11:10 AM, Tony Yu wrote: > >> Plugin system > >> ------ > >> It might be nice to have some sort of plugin system for the image > viewer. > >> That way, tools like this could be implemented a bit more easily and, > also, > >> easily added to the viewer or ignored by the user. > > At the moment, we basically have a double-viewer implementation: > > simply vs fancy. So we separate out > > > > imshow(x) and imshow(x, fancy=True) > My 0.6dev does not know the property fancy: In [8]: io.imshow(ctx.data, fancy=True) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /Users/maye/Dropbox/src/scikits-image/ in () ----> 1 io.imshow(ctx.data, fancy=True) [....] AttributeError: Unknown property fancy Do I need to activate something at compile time with the setup.py? Michael > I thought one solution was to sub-class FigureCanvas, with extra > buttons, but from what I understand, it is not that easy to do this at > the platform independant level. > > But maybe adding arguments to the function call, for exemple imshow(x, > set_contrast=True, linescan=True) plus keyboard toggles is enough? > > > > >> agree to an extent. Nevertheless, I think providing a viewer that > supplies > >> *an infrastructure* for creating GUI tools might be really valuable. I > >> haven't really thought through what this plugin system would look like, > so > >> it may just be a pipe dream. > > This is a tricky problem (which set of tools to use, etc.)--but in > > principle, it would be nice to have a few standard viewers, e.g., > > image compare, image compare + parameter adjust, mask editor (to build > > custom filters, e.g.) and image inspector (like the one you and > > Guillaume are working on). > > > > St?fan > > > What do you mean by mask editor? Something like a slider to adjust a > threshold with a superimposed mask? > > Guillaume > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dfarmernv at gmail.com Fri Mar 2 13:11:15 2012 From: dfarmernv at gmail.com (Dan Farmer) Date: Fri, 2 Mar 2012 10:11:15 -0800 Subject: Imshow and Linescan - first version In-Reply-To: <26204287.708.1330710631363.JavaMail.geo-discussion-forums@vbne13> References: <0a962708-d617-45d0-b343-b7e774f23965@b23g2000yqn.googlegroups.com> <4F3E69CD.3010204@mitotic-machine.org> <4F422A54.9000902@mitotic-machine.org> <4F462170.4010206@mitotic-machine.org> <4F4743FD.20304@mitotic-machine.org> <4F4B491D.5070902@mitotic-machine.org> <26204287.708.1330710631363.JavaMail.geo-discussion-forums@vbne13> Message-ID: I think fancy depends on what plugin you have active. try io.use_plugin('qt') before doing that. -Dan On Fri, Mar 2, 2012 at 9:50 AM, Michael Aye wrote: > > > On Monday, February 27, 2012 10:13:01 AM UTC+1, Guillaume wrote: >> >> Le 26/02/2012 21:15, St?fan van der Walt a ?crit : >> > On Sat, Feb 25, 2012 at 11:10 AM, Tony Yu ?wrote: >> >> Plugin system >> >> ------ >> >> It might be nice to have some sort of plugin system for the image >> >> viewer. >> >> That way, tools like this could be implemented a bit more easily and, >> >> also, >> >> easily added to the viewer or ignored by the user. >> > At the moment, we basically have a double-viewer implementation: >> > simply vs fancy. ?So we separate out >> > >> > imshow(x) and imshow(x, fancy=True) > > > My 0.6dev does not know the property fancy: > > In [8]: io.imshow(ctx.data, fancy=True) > --------------------------------------------------------------------------- > AttributeError ? ? ? ? ? ? ? ? ? ? ? ? ? ?Traceback (most recent call last) > /Users/maye/Dropbox/src/scikits-image/ in > () > ----> 1 io.imshow(ctx.data, fancy=True) > [....] > AttributeError: Unknown property fancy > > > Do I need to activate something at compile time with the setup.py? > > Michael > > >> >> I thought one solution was to sub-class FigureCanvas, with extra >> buttons, but from what I understand, it is not that easy to do this at >> the platform independant level. >> >> ? But maybe adding arguments to the function call, for exemple imshow(x, >> set_contrast=True, linescan=True) plus keyboard toggles is enough? >> >> > >> >> agree to an extent. Nevertheless, I think providing a viewer that >> >> supplies >> >> *an infrastructure* for creating GUI tools might be really valuable. I >> >> haven't really thought through what this plugin system would look like, >> >> so >> >> it may just be a pipe dream. >> > This is a tricky problem (which set of tools to use, etc.)--but in >> > principle, it would be nice to have a few standard viewers, e.g., >> > image compare, image compare + parameter adjust, mask editor (to build >> > custom filters, e.g.) and image inspector (like the one you and >> > Guillaume are working on). >> > >> > St?fan >> > >> What do you mean by mask editor? Something like a slider to adjust a >> threshold with a superimposed mask? >> >> Guillaume From tsyu80 at gmail.com Fri Mar 2 10:47:02 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Fri, 2 Mar 2012 10:47:02 -0500 Subject: ANN: scikits-image v0.5 In-Reply-To: References: <16003163.926.1330700094618.JavaMail.geo-discussion-forums@vbgu10> Message-ID: 2012/3/2 St?fan van der Walt > On Fri, Mar 2, 2012 at 6:54 AM, Michael Aye > wrote: > > Can it be that you accidentally GIT-ted version.py, a file that > presumably > > is being created automatically? Or is there a reason for GITting it? > > The file should be checked in, and has the following contents: > > > https://github.com/scikits-image/scikits-image/blob/master/skimage/version.py > > Note the "unbuilt-dev" designation. > > St?fan > I'm also a bit curious about why `version.py` needs to be tracked. I imagine it's used somewhere to tell the user why something doesn't work, but maybe that could be accomplished some other way? The file is a bit annoying when adding changes and even more so when switching branches. (The make file behavior, I think, makes it a bit harder to switch branches since `git stash` won't restore `version.py`) -Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan at sun.ac.za Fri Mar 2 14:13:55 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Fri, 2 Mar 2012 11:13:55 -0800 Subject: ANN: scikits-image v0.5 In-Reply-To: References: <16003163.926.1330700094618.JavaMail.geo-discussion-forums@vbgu10> Message-ID: On Fri, Mar 2, 2012 at 7:47 AM, Tony Yu wrote: > The file is a bit annoying when adding changes and even more so when > switching branches. (The make file behavior, I think, makes it a bit harder > to switch branches since `git stash` won't restore `version.py`) Yes, version.py is rather annoying. Here's a PR: https://github.com/scikits-image/scikits-image/pull/159 St?fan From stefan at sun.ac.za Fri Mar 2 14:19:08 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Fri, 2 Mar 2012 11:19:08 -0800 Subject: Imshow and Linescan - first version In-Reply-To: References: <0a962708-d617-45d0-b343-b7e774f23965@b23g2000yqn.googlegroups.com> <4F3E69CD.3010204@mitotic-machine.org> <4F422A54.9000902@mitotic-machine.org> <4F462170.4010206@mitotic-machine.org> <4F4743FD.20304@mitotic-machine.org> <4F4B491D.5070902@mitotic-machine.org> <26204287.708.1330710631363.JavaMail.geo-discussion-forums@vbne13> Message-ID: On Fri, Mar 2, 2012 at 10:11 AM, Dan Farmer wrote: > I think fancy depends on what plugin you have active. try > io.use_plugin('qt') before doing that. We should provide a catch-all for this situation that let's the user know what's going on, e.g. "The current I/O plugin does not have a fancy viewer." PRs welcome! St?fan From stefan at sun.ac.za Fri Mar 2 14:36:22 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Fri, 2 Mar 2012 11:36:22 -0800 Subject: [scikits-image] Restore previous io plugins (#152) In-Reply-To: References: <70C87030-C54F-4868-B772-75FA82CA8227@yale.edu> <4F4A954A.8070904@gmail.com> Message-ID: On Fri, Mar 2, 2012 at 10:26 AM, Tony Yu wrote: > Hmm, another issue: Using ``imshow(..., plugin='qt')`` doesn't behave > correctly (even after the PR above) because the ``show()`` function still > uses the default plugin (i.e. not necessarily the qt plugin), so the window > opened by ``imshow`` just disappears. We could stick a use_plugin call inside of qt's imshow. It's kind of nasty to adjust global state this way, but should fix the problem in the majority of cases. St?fan From tsyu80 at gmail.com Fri Mar 2 13:26:53 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Fri, 2 Mar 2012 13:26:53 -0500 Subject: [scikits-image] Restore previous io plugins (#152) In-Reply-To: References: <70C87030-C54F-4868-B772-75FA82CA8227@yale.edu> <4F4A954A.8070904@gmail.com> Message-ID: On Tue, Feb 28, 2012 at 12:20 AM, Tony Yu wrote: > > > 2012/2/26 St?fan van der Walt > >> On Sun, Feb 26, 2012 at 12:25 PM, Christoph Gohlke >> wrote: >> > Instead of restoring the default plugins after each test module, maybe >> it >> > would be better/cleaner/safer for the tests to never change the default >> > plugins but to just load the plugin and explicitly specify the plugin in >> > each imread, imwrite, etc. function call? It seems there is currently >> no way >> > to load a plugin without making it the default. This could be achieved >> by >> > changing the use_plugin function to accept another option for the `kind` >> > parameter, e.g. an empty string, signaling that the plugin should only >> be >> > loaded. Probably too late for the 0.5 release. >> >> Ideally, the ``imread(..., plugin='fits')`` functionality should >> auto-load the FITS-plugin---I should see why this is not currently >> working, because it seems like a bug. >> >> St?fan >> > > I just submitted PR #157 to > address an error raised with non-loaded plugins. I'm not sure if this > addresses the issue you mention above, but it's related, at least. > > -Tony > Hmm, another issue: Using ``imshow(..., plugin='qt')`` doesn't behave correctly (even after the PR above) because the ``show()`` function still uses the default plugin (i.e. not necessarily the qt plugin), so the window opened by ``imshow`` just disappears. I don't have time to look at the code right now, but this seems like a more difficult issue to solve. -Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From kmichael.aye at gmail.com Mon Mar 5 05:12:03 2012 From: kmichael.aye at gmail.com (Michael Aye) Date: Mon, 5 Mar 2012 02:12:03 -0800 (PST) Subject: harris example for 0.6dev missing a harris. Message-ID: <9696005.34.1330942323262.JavaMail.geo-discussion-forums@yner4> The example does an import of the harris module, not the class. Therefore for me in the code I have to call it like harris.harris(img, min_distance=6) Do I have a messed up system or is that an error? If yes, I can issue a PR. Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From kmichael.aye at gmail.com Mon Mar 5 09:36:54 2012 From: kmichael.aye at gmail.com (Michael Aye) Date: Mon, 5 Mar 2012 06:36:54 -0800 (PST) Subject: harris example for 0.6dev missing a harris. In-Reply-To: References: <9696005.34.1330942323262.JavaMail.geo-discussion-forums@yner4> Message-ID: <4495635.3106.1330958214707.JavaMail.geo-discussion-forums@vbux23> On Monday, March 5, 2012 11:37:16 AM UTC+1, Nelle wrote: > > Hi Michael, > > The example imports the harris method and not the module. It is a bit > confusing because the method and the module have both the same name (maybe > we can modify that ?). > > I've checked both on the documentation and on my machine, and the example > works fine. > What error message do you get when trying to run the example ? > > The documentation of the harris corner example on http://scikits-image.org/docs/dev/auto_examples/plot_harris.html states for the import: from skimage.feature import harris So when I do that, I get a module, with the method inside: In [149]: from skimage.feature import harris In [150]: harris Out[150]: In [151]: type(harris) Out[151]: module In [152]: harris. harris.harris harris.ndimage harris.peak And the error is accordingly, a TypeError for the module not being callable: In [152]: harris(ctx.data) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /Users/maye/Dropbox/src/pymars/ in () ----> 1 harris(ctx.data) TypeError: 'module' object is not callable Regards, Michael Cheers, > N > > > > The example does an import of the harris module, not the class. >> Therefore for me in the code I have to call it like harris.harris(img, >> min_distance=6) >> >> Do I have a messed up system or is that an error? If yes, I can issue a >> PR. >> >> Michael >> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kmichael.aye at gmail.com Mon Mar 5 12:23:41 2012 From: kmichael.aye at gmail.com (Michael Aye) Date: Mon, 5 Mar 2012 09:23:41 -0800 (PST) Subject: harris example for 0.6dev missing a harris. In-Reply-To: References: <9696005.34.1330942323262.JavaMail.geo-discussion-forums@yner4> <4495635.3106.1330958214707.JavaMail.geo-discussion-forums@vbux23> Message-ID: <23085827.903.1330968221270.JavaMail.geo-discussion-forums@vbze11> On Monday, March 5, 2012 3:49:41 PM UTC+1, Tony S Yu wrote: > > > > >> On Monday, March 5, 2012 11:37:16 AM UTC+1, Nelle wrote: >>> >>> Hi Michael, >>> >>> The example imports the harris method and not the module. It is a bit >>> confusing because the method and the module have both the same name (maybe >>> we can modify that ?). >>> >>> I've checked both on the documentation and on my machine, and the >>> example works fine. >>> What error message do you get when trying to run the example ? >>> >>> >> The documentation of the harris corner example on >> http://scikits-image.org/docs/dev/auto_examples/plot_harris.html >> states for the import: >> >> from skimage.feature import harris >> >> So when I do that, I get a module, with the method inside: >> >> In [149]: from skimage.feature import harris >> >> In [150]: harris >> Out[150]: > '/Users/maye/Library/Python/2.7/site-packages/skimage-0.4-py2.7-macosx-10.5-i386.egg/skimage/feature/harris.pyc'> >> > > Hi Michael, > > It appears that you're importing skimage 0.4 here. You may need to clean > out this older version and try again. > > -Tony > > >> >> Thanks, I had a messed up easy-install.pth. I wrongly assumed during a hot edit of that file that anything that starts with skimage is newer than something that starts with scikits_image and left the old entry up front newer later entries. Sorry for the noise. Michael > In [151]: type(harris) >> Out[151]: module >> >> In [152]: harris. >> harris.harris harris.ndimage harris.peak >> >> And the error is accordingly, a TypeError for the module not being >> callable: >> >> In [152]: harris(ctx.data) >> >> --------------------------------------------------------------------------- >> TypeError Traceback (most recent call >> last) >> /Users/maye/Dropbox/src/pymars/ in >> () >> ----> 1 harris(ctx.data) >> >> TypeError: 'module' object is not callable >> >> >> Regards, >> Michael >> >> >> Cheers, >>> N >>> >>> >>> >>> The example does an import of the harris module, not the class. >>>> Therefore for me in the code I have to call it like harris.harris(img, >>>> min_distance=6) >>>> >>>> Do I have a messed up system or is that an error? If yes, I can issue a >>>> PR. >>>> >>>> Michael >>>> >>>> >>>> >>> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tsyu80 at gmail.com Mon Mar 5 09:49:41 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Mon, 5 Mar 2012 09:49:41 -0500 Subject: harris example for 0.6dev missing a harris. In-Reply-To: <4495635.3106.1330958214707.JavaMail.geo-discussion-forums@vbux23> References: <9696005.34.1330942323262.JavaMail.geo-discussion-forums@yner4> <4495635.3106.1330958214707.JavaMail.geo-discussion-forums@vbux23> Message-ID: On Mon, Mar 5, 2012 at 9:36 AM, Michael Aye wrote: > > > On Monday, March 5, 2012 11:37:16 AM UTC+1, Nelle wrote: >> >> Hi Michael, >> >> The example imports the harris method and not the module. It is a bit >> confusing because the method and the module have both the same name (maybe >> we can modify that ?). >> >> I've checked both on the documentation and on my machine, and the example >> works fine. >> What error message do you get when trying to run the example ? >> >> > The documentation of the harris corner example on > http://scikits-image.org/docs/dev/auto_examples/plot_harris.html > states for the import: > > from skimage.feature import harris > > So when I do that, I get a module, with the method inside: > > In [149]: from skimage.feature import harris > > In [150]: harris > Out[150]: '/Users/maye/Library/Python/2.7/site-packages/skimage-0.4-py2.7-macosx-10.5-i386.egg/skimage/feature/harris.pyc'> > Hi Michael, It appears that you're importing skimage 0.4 here. You may need to clean out this older version and try again. -Tony > > In [151]: type(harris) > Out[151]: module > > In [152]: harris. > harris.harris harris.ndimage harris.peak > > And the error is accordingly, a TypeError for the module not being > callable: > > In [152]: harris(ctx.data) > --------------------------------------------------------------------------- > TypeError Traceback (most recent call last) > /Users/maye/Dropbox/src/pymars/ in > () > ----> 1 harris(ctx.data) > > TypeError: 'module' object is not callable > > > Regards, > Michael > > > Cheers, >> N >> >> >> >> The example does an import of the harris module, not the class. >>> Therefore for me in the code I have to call it like harris.harris(img, >>> min_distance=6) >>> >>> Do I have a messed up system or is that an error? If yes, I can issue a >>> PR. >>> >>> Michael >>> >>> >>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From nelle.varoquaux at gmail.com Mon Mar 5 05:37:16 2012 From: nelle.varoquaux at gmail.com (Nelle Varoquaux) Date: Mon, 5 Mar 2012 11:37:16 +0100 Subject: harris example for 0.6dev missing a harris. In-Reply-To: <9696005.34.1330942323262.JavaMail.geo-discussion-forums@yner4> References: <9696005.34.1330942323262.JavaMail.geo-discussion-forums@yner4> Message-ID: Hi Michael, The example imports the harris method and not the module. It is a bit confusing because the method and the module have both the same name (maybe we can modify that ?). I've checked both on the documentation and on my machine, and the example works fine. What error message do you get when trying to run the example ? Cheers, N On 5 March 2012 11:12, Michael Aye wrote: > The example does an import of the harris module, not the class. > Therefore for me in the code I have to call it like harris.harris(img, > min_distance=6) > > Do I have a messed up system or is that an error? If yes, I can issue a PR. > > Michael > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan at sun.ac.za Mon Mar 5 21:59:05 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Mon, 5 Mar 2012 18:59:05 -0800 Subject: Shining Panda continuous integration Message-ID: Hi all, Have a look at our new continuous integration display at Shining Panda: https://jenkins.shiningpanda.com/skimage/ We're not doing too badly on the test coverage! https://jenkins.shiningpanda.com/skimage/job/skimage-linux-py32/44/cobertura/? St?fan From malcolm.reynolds at gmail.com Tue Mar 6 12:16:37 2012 From: malcolm.reynolds at gmail.com (Malcolm Reynolds) Date: Tue, 6 Mar 2012 09:16:37 -0800 (PST) Subject: Normalised cross correlation Message-ID: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> Hi everyone, I've just stumbled across skimage as I'm going through to arduous process of trying to switch my workflow (PhD study of computer vision & machine learning) from matlab to python. The project looks great but I'm currently in need of a fast Normalised Cross Correlation function. As it is, I can't find any python implementation which is anywhere near the speed of Matlab's normxcorr2 (correct me if I'm wrong...) and it looks like a corresponding function to match the normxcorr2 behaviour is planned but not yet implemented for skimage. Is this correct? I'd be interested in looking into this and contributing some code to the project, but before I put a heap of time into it I just wanted to check that something didn't already exist in this or another numpy-based project. Cheers, Malcolm -------------- next part -------------- An HTML attachment was scrubbed... URL: From tsyu80 at gmail.com Tue Mar 6 13:54:22 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Tue, 6 Mar 2012 13:54:22 -0500 Subject: Normalised cross correlation In-Reply-To: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> References: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> Message-ID: On Tue, Mar 6, 2012 at 12:16 PM, Malcolm Reynolds < malcolm.reynolds at gmail.com> wrote: > Hi everyone, > > I've just stumbled across skimage as I'm going through to arduous process > of trying to switch my workflow (PhD study of computer vision & machine > learning) from matlab to python. The project looks great but I'm currently > in need of a fast Normalised Cross Correlation function. As it is, I can't > find any python implementation which is anywhere near the speed of Matlab's > normxcorr2 (correct me if I'm wrong...) and it looks like a corresponding > function to match the normxcorr2 behaviour is planned but not yet > implemented for skimage. Is this correct? I'd be interested in looking into > this and contributing some code to the project, but before I put a heap of > time into it I just wanted to check that something didn't already exist in > this or another numpy-based project. > > Cheers, > > Malcolm > Hi Malcolm, I currently have a PR for a normalized cross-correlation function(which was originally implemented by Pieter Holtzhausen). Comments/suggestions would definitely be appreciated. -Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From tsyu80 at gmail.com Sat Mar 10 12:34:10 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Sat, 10 Mar 2012 12:34:10 -0500 Subject: Imshow and Linescan - first version In-Reply-To: <4F4B491D.5070902@mitotic-machine.org> References: <0a962708-d617-45d0-b343-b7e774f23965@b23g2000yqn.googlegroups.com> <4F3E69CD.3010204@mitotic-machine.org> <4F422A54.9000902@mitotic-machine.org> <4F462170.4010206@mitotic-machine.org> <4F4743FD.20304@mitotic-machine.org> <4F4B491D.5070902@mitotic-machine.org> Message-ID: On Mon, Feb 27, 2012 at 4:13 AM, Guillaume Gay < guillaume at mitotic-machine.org> wrote: > Le 26/02/2012 21:15, St?fan van der Walt a ?crit : > > On Sat, Feb 25, 2012 at 11:10 AM, Tony Yu wrote: >> >>> Plugin system >>> ------ >>> It might be nice to have some sort of plugin system for the image viewer. >>> That way, tools like this could be implemented a bit more easily and, >>> also, >>> easily added to the viewer or ignored by the user. >>> >> At the moment, we basically have a double-viewer implementation: >> simply vs fancy. So we separate out >> >> imshow(x) and imshow(x, fancy=True) >> > I thought one solution was to sub-class FigureCanvas, with extra buttons, > but from what I understand, it is not that easy to do this at the platform > independant level. > > But maybe adding arguments to the function call, for exemple imshow(x, > set_contrast=True, linescan=True) plus keyboard toggles is enough? Hey Guillaume, I'm still tossing around ideas for implementing some sort of interactive viewer with pluggable tools. Based off your LineProfile idea, I created the beginnings of a matplotlib image-viewer, which could have some sort of plugin system (not really implemented). I took a different approach than your original implementation: the line-profile output shows up as a separate figure. I think it'd be nice to have tools integrated into the image window, but I think this will be really difficult to do well (specifically, resizing the figure window and adjusting canvas area when connecting and disconnecting the tool). Using multiple figures is easier, although a little more cumbersome for the user. One advantage is that you can disconnect the tool just by closing the tool's figure (this doesn't currently work for Qt4 backends because of an MPL bug ). Right now, the LineProfile tool is just a test case: the main components are an ImageWindow class and the Widget base class. I'd like to test the architecture with some different use cases (e.g. contrast-adjustment widget, mask editor, etc.) when I have the time. I could see these classes changing dramatically after testing different uses. Everything's in a single file at the moment, but the idea would be to move the Widget subclasses to some sort of "widgets" directory. -Tony P.S. Guillaume: I couldn't figure out why `img_zoomed`/`previous_axis`/`current_axis` were necessary, so I just removed them. If there was some functionality that I missed, let me know. > > > >> agree to an extent. Nevertheless, I think providing a viewer that >>> supplies >>> *an infrastructure* for creating GUI tools might be really valuable. I >>> haven't really thought through what this plugin system would look like, >>> so >>> it may just be a pipe dream. >>> >> This is a tricky problem (which set of tools to use, etc.)--but in >> principle, it would be nice to have a few standard viewers, e.g., >> image compare, image compare + parameter adjust, mask editor (to build >> custom filters, e.g.) and image inspector (like the one you and >> Guillaume are working on). >> >> St?fan >> >> What do you mean by mask editor? Something like a slider to adjust a > threshold with a superimposed mask? > > Guillaume > -------------- next part -------------- An HTML attachment was scrubbed... URL: From guillaume at mitotic-machine.org Mon Mar 12 04:08:44 2012 From: guillaume at mitotic-machine.org (Guillaume Gay) Date: Mon, 12 Mar 2012 09:08:44 +0100 Subject: Imshow and Linescan - first version In-Reply-To: References: <0a962708-d617-45d0-b343-b7e774f23965@b23g2000yqn.googlegroups.com> <4F3E69CD.3010204@mitotic-machine.org> <4F422A54.9000902@mitotic-machine.org> <4F462170.4010206@mitotic-machine.org> <4F4743FD.20304@mitotic-machine.org> <4F4B491D.5070902@mitotic-machine.org> Message-ID: <4F5DAF0C.4000403@mitotic-machine.org> Hi Tony, This looks great. I was Le 10/03/2012 18:34, Tony Yu a ?crit : > > > On Mon, Feb 27, 2012 at 4:13 AM, Guillaume Gay > > > wrote: > > Le 26/02/2012 21:15, St?fan van der Walt a ?crit : > > On Sat, Feb 25, 2012 at 11:10 AM, Tony Yu > wrote: > > Plugin system > ------ > It might be nice to have some sort of plugin system for > the image viewer. > That way, tools like this could be implemented a bit more > easily and, also, > easily added to the viewer or ignored by the user. > > At the moment, we basically have a double-viewer implementation: > simply vs fancy. So we separate out > > imshow(x) and imshow(x, fancy=True) > > I thought one solution was to sub-class FigureCanvas, with extra > buttons, but from what I understand, it is not that easy to do > this at the platform independant level. > > But maybe adding arguments to the function call, for exemple > imshow(x, set_contrast=True, linescan=True) plus keyboard toggles > is enough? > > > Hey Guillaume, > > I'm still tossing around ideas for implementing some sort of > interactive viewer with pluggable tools. Based off your LineProfile > idea, I created the beginnings of a matplotlib image-viewer > , > which could have some sort of plugin system (not really implemented). > > I took a different approach than your original implementation: the > line-profile output shows up as a separate figure. I think it'd be > nice to have tools integrated into the image window, but I think this > will be really difficult to do well (specifically, resizing the figure > window and adjusting canvas area when connecting and disconnecting the > tool). Yes, I scratched my head on that, and I agree with you it is difficult and would certainly look really ugly (and buggy) most of the time. > Using multiple figures is easier, although a little more cumbersome > for the user. One advantage is that you can disconnect the tool just > by closing the tool's figure (this doesn't currently work for Qt4 > backends because of an MPL bug > ). One thing I didn't figure out > > Right now, the LineProfile tool is just a test case: the main > components are an ImageWindow class and the Widget base class. I'd > like to test the architecture with some different use cases (e.g. > contrast-adjustment widget, mask editor, etc.) when I have the time. I > could see these classes changing dramatically after testing different > uses. I already have some ideas on the contrast setter, I'll try to work on that piece this week. > > Everything's in a single file at the moment, but the idea would be to > move the Widget subclasses to some sort of "widgets" directory. > > -Tony > > P.S. Guillaume: I couldn't figure out why > `img_zoomed`/`previous_axis`/`current_axis` were necessary, so I just > removed them. If there was some functionality that I missed, let me know. This was a - more or less effective I must confess - work around to return to the correct view after a reset() callback, once the image was zoomed in, because this was drawing the image back to it's full scale. Maybe with your implementation this is not needed, I'll investigate this. Guillaume > > > > > agree to an extent. Nevertheless, I think providing a > viewer that supplies > *an infrastructure* for creating GUI tools might be really > valuable. I > haven't really thought through what this plugin system > would look like, so > it may just be a pipe dream. > > This is a tricky problem (which set of tools to use, etc.)--but in > principle, it would be nice to have a few standard viewers, e.g., > image compare, image compare + parameter adjust, mask editor > (to build > custom filters, e.g.) and image inspector (like the one you and > Guillaume are working on). > > St?fan > > What do you mean by mask editor? Something like a slider to adjust > a threshold with a superimposed mask? > > Guillaume > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: guillaume.vcf Type: text/x-vcard Size: 282 bytes Desc: not available URL: From stefan at sun.ac.za Mon Mar 12 23:48:11 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Mon, 12 Mar 2012 20:48:11 -0700 Subject: Numba: fast Python loops via LLVM Message-ID: Hi all, Travis announced his LLVM-based compiler for Python loops at PyCon2012: https://github.com/ContinuumIO/numba I think this is an interesting option for skimage. If we integrate the multiple-backend system, we can very easily slot into this mechanism. St?fan From tsyu80 at gmail.com Wed Mar 14 20:28:26 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Wed, 14 Mar 2012 20:28:26 -0400 Subject: RFC: Multiple backends + speedy looping In-Reply-To: References: Message-ID: 2012/3/1 St?fan van der Walt > Hi Nadav > > On Wed, Feb 29, 2012 at 9:36 PM, Nadav Horesh > wrote: > > I am working on a simple frame work as a replacement for > > ndimage.genereic_filter and numeric's neighbourhood iterator (I hope it > > would be faster and easier to use). > > The goal of this PR is to support any backend (including, possibly, > the one you are writing). I'd like to provide multiple > implementations of some commonly used functions (convolution, e.g.), > so that we can have a performance based series of fallbacks, such as > GPU -> Cython -> Python. That way, algorithms can be run on any > system, but will execute most rapidly on those supporting, say, > OpenCL. Another advantage is that if, in the future, we write an even > faster implementation, the benefit is immediately available to the > user, without rewriting any code. > > St?fan > >From the looks of the implementation, it seems none of the current modules would need to be changed unless a backend was added. And even then, it looks simple to modify an existing function to add a backend. Does this sum it up: * Add `@add_backends` to function with new (optional) backend * register backend function using `backend.register` in the `__init__` file for the function * Subclass tests from `BackendTester` (an additional decorator for test functions might be good, if possible) The rest of the changes would happen in separate files for each function implementation. If this is an accurate description, then I think the backend system would be a good addition and wouldn't really add any annoying boilerplate code. Stefan: Do you have an idea of what needs to be done to get this merged? After a quick look: 1) It needs to be moved from the scikits.image namespace to skimage, 2) there are questionable changes to "filter/edges.py" and "filter/tests/test_edges.py" in the PR, 3) implementation should be moved from "backend/__init__.py" to something like "backend/core.py" (or I guess we've been using the convention "backend/_backend.py"). Also, I'm not crazy about dumping backend functions into a "backend" subdirectory for each module. Maybe they should go in a backend-specific subdirectory. So, for example, "filter/backend/edges_opencl.py" would move to "filter/opencl/edges.py". -Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan at sun.ac.za Thu Mar 15 03:00:46 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Thu, 15 Mar 2012 00:00:46 -0700 Subject: RFC: Multiple backends + speedy looping In-Reply-To: References: Message-ID: Hi Tony On Wed, Mar 14, 2012 at 5:28 PM, Tony Yu wrote: > From the looks of the implementation, it seems none of the current modules > would need to be changed unless a backend was added. And even then, it looks > simple to modify an existing function to add a backend. Does this sum it up: > > ? ? * Add `@add_backends` to function with new (optional) backend > ? ? * register backend function using `backend.register` in the `__init__` > file for the function > ? ? * Subclass tests from `BackendTester` (an additional decorator for test > functions might be good, if possible) That's right--the design is aimed to be minimally invasive. > Stefan: Do you have an idea of what needs to be done to get this merged? > After a quick look: 1) It needs to be moved from the scikits.image namespace > to skimage, 2) there are questionable changes to "filter/edges.py" and > "filter/tests/test_edges.py" in the PR, 3) implementation should be moved > from "backend/__init__.py" to something like "backend/core.py" (or I guess > we've been using the convention "backend/_backend.py"). > Also, I'm not crazy about dumping backend functions into a "backend" > subdirectory for each module. Maybe they should go in a backend-specific > subdirectory. So, for example, "filter/backend/edges_opencl.py" would move > to "filter/opencl/edges.py". You've identified the three core issues. (1) is easy to do. (2) -- I believe we should rework or remove those examples. (3) I share your sentiment--skimage.filter.opencl seems like a better place. Thanks for the valuable comments! The more I think about this, the more I think that this can be a great way of experimentally incorporating new and maturing technologies, such as numba. Even if we can just start by having the fastest convolution of all the available packages--without giving up the advantages of high-level description--I'd be very happy. St?fan From kmichael.aye at gmail.com Thu Mar 15 06:44:18 2012 From: kmichael.aye at gmail.com (Michael Aye) Date: Thu, 15 Mar 2012 03:44:18 -0700 (PDT) Subject: [offtopic] how to get PyQT running for EPD? Message-ID: <6248821.7867.1331808258856.JavaMail.geo-discussion-forums@ynje13> Sorry, for the offtopic question, but I am so interested in your fancy viewer and still haven't seen it yet, because I don't have a running pyqt. I got pyqt compiled with MacPorts on my Mac but am unsure how or if it would be working together with my EPD? Alternatively, can I force the MacPort compilation to use the EPD directly? If you like some answer points on stackoverflow, you could also answer my question there: http://stackoverflow.com/questions/9600474/how-can-i-link-macports-pyqt-to-enthoughts-python-distribution Best regards, Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan at sun.ac.za Thu Mar 15 11:41:33 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Thu, 15 Mar 2012 08:41:33 -0700 Subject: [offtopic] how to get PyQT running for EPD? In-Reply-To: <6248821.7867.1331808258856.JavaMail.geo-discussion-forums@ynje13> References: <6248821.7867.1331808258856.JavaMail.geo-discussion-forums@ynje13> Message-ID: Hi Michael On Mar 15, 2012 3:57 AM, "Michael Aye" wrote: > > Sorry, for the offtopic question, but I am so interested in your fancy viewer and still haven't seen it yet, because I don't have a running pyqt. Have you tried asking on enthought-dev? St?fan -------------- next part -------------- An HTML attachment was scrubbed... URL: From nadavh.horesh at gmail.com Fri Mar 16 01:42:57 2012 From: nadavh.horesh at gmail.com (Nadav Horesh) Date: Fri, 16 Mar 2012 07:42:57 +0200 Subject: [OT] pass a C callback function to a cythom module via python Message-ID: I have the following: - A library of C function which is compiled into a dll - A cython module with a function that expects as a parameter a C callback function. My problem is how to make a python script to pass directly the address of a C function from the dll to the cython function. example: -- C code --- float mul(float a, float b) { return a*b; } -- cython module -- ctypedef float c2f(float, float) def call_c(c2f fun, float x, float y): return fun(x, y) ---------------------- I can use ctypes as the follows, but the call goes through a python wrapper from ctypes import * import cython_module dll = cdll.LoadLibrary('./C_modile.so') mul = dll.mul mul.argtypes = [c_float, c_float] mul.restype = c_float cython_module.call_c(mul, c_float(3), c_float(2)) I found a work around by adding the following line to the C code: void* mulp = mul So the following line in the python module provides the address of the mul function: mull_addr = c_void_p.in_dll(dll, "mul") I am wondering if there is a friendly and simple(r) solution. Nadav. -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan at sun.ac.za Fri Mar 16 12:09:58 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Fri, 16 Mar 2012 09:09:58 -0700 Subject: [OT] pass a C callback function to a cythom module via python In-Reply-To: References: Message-ID: Hi Nadav On Mar 15, 2012 10:54 PM, "Nadav Horesh" wrote: > > I have the following: > A library of C function which is compiled into a dll > A cython module with a function that expects as a parameter a C callback function. > > My problem is how to make a python script to pass directly the address of a C function from the dll to the cython function. There's a Cython Enhancement Proposal for this, but it hasn't been implemented: http://wiki.cython.org/enhancements/nativecall So, I don't think there's a cleaner way, unfortunately. It's great that you found a workaround, though--many people have been struggling with this issue. St?fan -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan at sun.ac.za Fri Mar 16 15:59:17 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Fri, 16 Mar 2012 12:59:17 -0700 Subject: Imshow and Linescan - first version In-Reply-To: References: <0a962708-d617-45d0-b343-b7e774f23965@b23g2000yqn.googlegroups.com> <4F3E69CD.3010204@mitotic-machine.org> <4F422A54.9000902@mitotic-machine.org> <4F462170.4010206@mitotic-machine.org> <4F4743FD.20304@mitotic-machine.org> <4F4B491D.5070902@mitotic-machine.org> <4F5DAF0C.4000403@mitotic-machine.org> Message-ID: Hi Tony On Fri, Mar 16, 2012 at 12:18 PM, Tony Yu wrote: > Sorry to change things up while you're working on this, but I wanted to > split the viewer into different files; so, I've moved development to a repo > called `skloupe`: > > https://github.com/tonysyu/skloupe Out of curiosity, what is the motivation for developing this outside of skimage? St?fan From tsyu80 at gmail.com Fri Mar 16 15:18:26 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Fri, 16 Mar 2012 15:18:26 -0400 Subject: Imshow and Linescan - first version In-Reply-To: <4F5DAF0C.4000403@mitotic-machine.org> References: <0a962708-d617-45d0-b343-b7e774f23965@b23g2000yqn.googlegroups.com> <4F3E69CD.3010204@mitotic-machine.org> <4F422A54.9000902@mitotic-machine.org> <4F462170.4010206@mitotic-machine.org> <4F4743FD.20304@mitotic-machine.org> <4F4B491D.5070902@mitotic-machine.org> <4F5DAF0C.4000403@mitotic-machine.org> Message-ID: On Mon, Mar 12, 2012 at 4:08 AM, Guillaume Gay < guillaume at mitotic-machine.org> wrote: > Hi Tony, > > This looks great. > > I was > > Le 10/03/2012 18:34, Tony Yu a ?crit : > > > > On Mon, Feb 27, 2012 at 4:13 AM, Guillaume Gay < > guillaume at mitotic-machine.org> wrote: > >> Le 26/02/2012 21:15, St?fan van der Walt a ?crit : >> >> On Sat, Feb 25, 2012 at 11:10 AM, Tony Yu wrote: >>> >>>> Plugin system >>>> ------ >>>> It might be nice to have some sort of plugin system for the image >>>> viewer. >>>> That way, tools like this could be implemented a bit more easily and, >>>> also, >>>> easily added to the viewer or ignored by the user. >>>> >>> At the moment, we basically have a double-viewer implementation: >>> simply vs fancy. So we separate out >>> >>> imshow(x) and imshow(x, fancy=True) >>> >> I thought one solution was to sub-class FigureCanvas, with extra >> buttons, but from what I understand, it is not that easy to do this at the >> platform independant level. >> >> But maybe adding arguments to the function call, for exemple imshow(x, >> set_contrast=True, linescan=True) plus keyboard toggles is enough? > > > Hey Guillaume, > > I'm still tossing around ideas for implementing some sort of interactive > viewer with pluggable tools. Based off your LineProfile idea, I created the > beginnings of a matplotlib image-viewer, > which could have some sort of plugin system (not really implemented). > > > > I took a different approach than your original implementation: the > line-profile output shows up as a separate figure. I think it'd be nice to > have tools integrated into the image window, but I think this will be > really difficult to do well (specifically, resizing the figure window and > adjusting canvas area when connecting and disconnecting the tool). > > Yes, I scratched my head on that, and I agree with you it is difficult and > would certainly look really ugly (and buggy) most of the time. > > > Using multiple figures is easier, although a little more cumbersome for > the user. One advantage is that you can disconnect the tool just by closing > the tool's figure (this doesn't currently work for Qt4 backends because of > an MPL bug ). > > One thing I didn't figure out > > > Right now, the LineProfile tool is just a test case: the main components > are an ImageWindow class and the Widget base class. I'd like to test the > architecture with some different use cases (e.g. contrast-adjustment > widget, mask editor, etc.) when I have the time. I could see these classes > changing dramatically after testing different uses. > > > I already have some ideas on the contrast setter, I'll try to work on that > piece this week. > Hey Guillaume, Sorry to change things up while you're working on this, but I wanted to split the viewer into different files; so, I've moved development to a repo called `skloupe`: https://github.com/tonysyu/skloupe This name could change at some point. (Am I even allowed to call it a SciKit?) If you've already started working on a contrast-adjustment plugin, it shouldn't be too hard to switch over. The original classes were moved to - ImageWindow --> skloupe.viewers.ImageViewer - Widget --> skloupe.plugins.Plugin I renamed "Widget" to "Plugin" because there's a separate `widgets` subpackage for "basic" interactive tools, which currently has a `Slider` object that you may find useful. Also, based off of Christophe Gohlke's `tifffile.imshow`, I've added support for viewing image collections in `skloupe.viewers.CollectionViewer`. Ideally, there will be a `skloupe.viewers.imshow` function that opens both images and image collections, but this isn't yet implemented. Cheers, -Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan at sun.ac.za Fri Mar 16 19:12:52 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Fri, 16 Mar 2012 16:12:52 -0700 Subject: Imshow and Linescan - first version In-Reply-To: References: <0a962708-d617-45d0-b343-b7e774f23965@b23g2000yqn.googlegroups.com> <4F3E69CD.3010204@mitotic-machine.org> <4F422A54.9000902@mitotic-machine.org> <4F462170.4010206@mitotic-machine.org> <4F4743FD.20304@mitotic-machine.org> <4F4B491D.5070902@mitotic-machine.org> <4F5DAF0C.4000403@mitotic-machine.org> Message-ID: Hey Tony On Fri, Mar 16, 2012 at 2:08 PM, Tony Yu wrote: > Here's an example plugin for using skimage's canny edge detector: > > https://github.com/tonysyu/skloupe/blob/master/skloupe/plugins/edgedetector.py Very cool! I also like the styled slider. The reason I asked about the repo is because I definitely want some of this functionality to be available in skimage (a good viewer, editor, etc.). You are, of course, welcome to create a loupe repo under the scikits-image org (I think you have the necessary permissions); I just want to think about how we can integrate this into the main package most efficiently without introducing a dependency (and preferably avoiding the pain of submodules). St?fan From tsyu80 at gmail.com Fri Mar 16 16:17:16 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Fri, 16 Mar 2012 16:17:16 -0400 Subject: Imshow and Linescan - first version In-Reply-To: References: <0a962708-d617-45d0-b343-b7e774f23965@b23g2000yqn.googlegroups.com> <4F3E69CD.3010204@mitotic-machine.org> <4F422A54.9000902@mitotic-machine.org> <4F462170.4010206@mitotic-machine.org> <4F4743FD.20304@mitotic-machine.org> <4F4B491D.5070902@mitotic-machine.org> <4F5DAF0C.4000403@mitotic-machine.org> Message-ID: 2012/3/16 St?fan van der Walt > Hi Tony > > On Fri, Mar 16, 2012 at 12:18 PM, Tony Yu wrote: > > Sorry to change things up while you're working on this, but I wanted to > > split the viewer into different files; so, I've moved development to a > repo > > called `skloupe`: > > > > https://github.com/tonysyu/skloupe > > Out of curiosity, what is the motivation for developing this outside of > skimage? > > St?fan > Mainly because it was getting messy. For example, I'm not sure how I feel about putting subdirectories into the plugins directory. If this actually became a useful project, I think a good place for it would in the scikits-image github account but in a separate repo. The reason being that it could be quite large if there are a lot of plugins. Even if it isn't, I'd like to play around with it outside of skimage so that I don't have to switch between branches so often. If you think otherwise, then I'm happy to move it back into the main repo after I've played around a bit in the sandbox. -Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From tsyu80 at gmail.com Fri Mar 16 17:08:43 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Fri, 16 Mar 2012 17:08:43 -0400 Subject: Imshow and Linescan - first version In-Reply-To: References: <0a962708-d617-45d0-b343-b7e774f23965@b23g2000yqn.googlegroups.com> <4F3E69CD.3010204@mitotic-machine.org> <4F422A54.9000902@mitotic-machine.org> <4F462170.4010206@mitotic-machine.org> <4F4743FD.20304@mitotic-machine.org> <4F4B491D.5070902@mitotic-machine.org> <4F5DAF0C.4000403@mitotic-machine.org> Message-ID: On Fri, Mar 16, 2012 at 4:17 PM, Tony Yu wrote: > > > 2012/3/16 St?fan van der Walt > >> Hi Tony >> >> On Fri, Mar 16, 2012 at 12:18 PM, Tony Yu wrote: >> > Sorry to change things up while you're working on this, but I wanted to >> > split the viewer into different files; so, I've moved development to a >> repo >> > called `skloupe`: >> > >> > https://github.com/tonysyu/skloupe >> >> Out of curiosity, what is the motivation for developing this outside of >> skimage? >> >> St?fan >> > > Mainly because it was getting messy. For example, I'm not sure how I feel > about putting subdirectories into the plugins directory. > > If this actually became a useful project, I think a good place for it > would in the scikits-image github account but in a separate repo. The > reason being that it could be quite large if there are a lot of plugins. > Even if it isn't, I'd like to play around with it outside of skimage so > that I don't have to switch between branches so often. > > If you think otherwise, then I'm happy to move it back into the main repo > after I've played around a bit in the sandbox. > > -Tony > Here's an example plugin for using skimage's canny edge detector: https://github.com/tonysyu/skloupe/blob/master/skloupe/plugins/edgedetector.py and the demo script: https://github.com/tonysyu/skloupe/blob/master/examples/plugins/edgedetector_demo.py -Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan at sun.ac.za Fri Mar 16 21:18:15 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Fri, 16 Mar 2012 18:18:15 -0700 Subject: Imshow and Linescan - first version In-Reply-To: References: <0a962708-d617-45d0-b343-b7e774f23965@b23g2000yqn.googlegroups.com> <4F3E69CD.3010204@mitotic-machine.org> <4F422A54.9000902@mitotic-machine.org> <4F462170.4010206@mitotic-machine.org> <4F4743FD.20304@mitotic-machine.org> <4F4B491D.5070902@mitotic-machine.org> <4F5DAF0C.4000403@mitotic-machine.org> Message-ID: On Fri, Mar 16, 2012 at 5:44 PM, Tony Yu wrote: > And I'll move this into scikits-image org as soon as I know what name to put > it under. I'm not sure how I feel about `skloupe`---as always there's the > pronunciation issue. `skoupe`... that's a stretch. `sciloupe`? Based on > pypi, `loupe` is available (it turns out there's a django-loupe project), > but then there's the branding issue. `loupepy` or `louppy` (pyloupe is > taken)? Too cutesy, maybe. `pypeye` (python picture eyer---that's not a > word). Some bikeshedding would actually be welcome here. Well, skimage.viewer is still available :) And there it will also get installed everywhere skimage does; but you know all the pros and cons of maintaining a separate package already. St?fan From tsyu80 at gmail.com Fri Mar 16 20:44:38 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Fri, 16 Mar 2012 20:44:38 -0400 Subject: Imshow and Linescan - first version In-Reply-To: References: <0a962708-d617-45d0-b343-b7e774f23965@b23g2000yqn.googlegroups.com> <4F3E69CD.3010204@mitotic-machine.org> <4F422A54.9000902@mitotic-machine.org> <4F462170.4010206@mitotic-machine.org> <4F4743FD.20304@mitotic-machine.org> <4F4B491D.5070902@mitotic-machine.org> <4F5DAF0C.4000403@mitotic-machine.org> Message-ID: 2012/3/16 St?fan van der Walt > Hey Tony > > On Fri, Mar 16, 2012 at 2:08 PM, Tony Yu wrote: > > Here's an example plugin for using skimage's canny edge detector: > > > > > https://github.com/tonysyu/skloupe/blob/master/skloupe/plugins/edgedetector.py > > Very cool! I also like the styled slider. > > The reason I asked about the repo is because I definitely want some of > this functionality to be available in skimage (a good viewer, editor, > etc.). You are, of course, welcome to create a loupe repo under the > scikits-image org (I think you have the necessary permissions); I just > want to think about how we can integrate this into the main package > most efficiently without introducing a dependency (and preferably > avoiding the pain of submodules). > > St?fan > I agree: some of this functionality should be moved into skimage. I would, however, like to keep whatever's moved to be fairly small---maybe something that can fit into a single file. (I really don't think having a subdirectory in the io-plugins directory would be pretty.) My plan is to play around with the code for awhile before deciding which parts should be moved directly into skimage. And I'll move this into scikits-image org as soon as I know what name to put it under. I'm not sure how I feel about `skloupe`---as always there's the pronunciation issue. `skoupe`... that's a stretch. `sciloupe`? Based on pypi, `loupe` is available (it turns out there's a django-loupe project), but then there's the branding issue. `loupepy` or `louppy` (pyloupe is taken)? Too cutesy, maybe. `pypeye` (python picture eyer---that's not a word). Some bikeshedding would actually be welcome here. -Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From tsyu80 at gmail.com Fri Mar 16 21:49:46 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Fri, 16 Mar 2012 21:49:46 -0400 Subject: Imshow and Linescan - first version In-Reply-To: References: <0a962708-d617-45d0-b343-b7e774f23965@b23g2000yqn.googlegroups.com> <4F3E69CD.3010204@mitotic-machine.org> <4F422A54.9000902@mitotic-machine.org> <4F462170.4010206@mitotic-machine.org> <4F4743FD.20304@mitotic-machine.org> <4F4B491D.5070902@mitotic-machine.org> <4F5DAF0C.4000403@mitotic-machine.org> Message-ID: 2012/3/16 St?fan van der Walt > On Fri, Mar 16, 2012 at 5:44 PM, Tony Yu wrote: > > And I'll move this into scikits-image org as soon as I know what name to > put > > it under. I'm not sure how I feel about `skloupe`---as always there's the > > pronunciation issue. `skoupe`... that's a stretch. `sciloupe`? Based on > > pypi, `loupe` is available (it turns out there's a django-loupe project), > > but then there's the branding issue. `loupepy` or `louppy` (pyloupe is > > taken)? Too cutesy, maybe. `pypeye` (python picture eyer---that's not a > > word). Some bikeshedding would actually be welcome here. > > Well, skimage.viewer is still available :) And there it will also get > installed everywhere skimage does; but you know all the pros and cons > of maintaining a separate package already. > > St?fan > Oh, I guess I was artificially constraining myself to io.plugins. This sounds like a good idea to me. Are there any cons to this? Possible Con ------------------------ Someone mentioned a while back that it would be a good idea to keep skimage focused on the basic toolset, and then a separate package could build off of it. Counter-argument: This infrastructure (so far, at least) is fairly lightweight, and I imagine the biggest area of growth would be the plugins---most of which would just provide an interactive interface to skimage functions. ------------------------ Possible Con ------------------------ Moving this to skimage.viewer kind of marginalizes the other plugins. Counter-argument: skimage would provide the simplest possible interface for adding interactivity (taking advantage of Matplotlib tools for plotting histograms, etc and its support for multiple gui toolkits). A separate project would be ideal for gui-toolkit--specific viewers (which could potentially be significantly fast) since it would likely take more code to do some of these things (I could be wrong about this). Also, I assume more people using skimage would know matplotlib over any specific backend. ------------------------ I'd like to come to some sort of consensus, if possible, so please---if you *any* opinions on this---let your voice be heard. -Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From nadavh.horesh at gmail.com Sat Mar 17 01:52:30 2012 From: nadavh.horesh at gmail.com (Nadav Horesh) Date: Sat, 17 Mar 2012 07:52:30 +0200 Subject: [OT] pass a C callback function to a cythom module via python In-Reply-To: References: Message-ID: It is good to know that there is still a hope. In my case I could make it if only a ctype object would expose the address of the underlying C object. Thank you, Nadav. ?????? 16 ???? 2012 18:09, ??? St?fan van der Walt : > Hi Nadav > > On Mar 15, 2012 10:54 PM, "Nadav Horesh" wrote: > > > > I have the following: > > A library of C function which is compiled into a dll > > A cython module with a function that expects as a parameter a C callback > function. > > > > My problem is how to make a python script to pass directly the address > of a C function from the dll to the cython function. > > There's a Cython Enhancement Proposal for this, but it hasn't been > implemented: > > http://wiki.cython.org/enhancements/nativecall > > So, I don't think there's a cleaner way, unfortunately. It's great that > you found a workaround, though--many people have been struggling with this > issue. > > St?fan > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sccolbert at gmail.com Sat Mar 17 15:44:43 2012 From: sccolbert at gmail.com (Chris Colbert) Date: Sat, 17 Mar 2012 14:44:43 -0500 Subject: [OT] pass a C callback function to a cythom module via python In-Reply-To: References: Message-ID: You can see how we did this before with the opencv wrappers starting at line 117 of this file: https://github.com/scikits-image/scikits-image/blob/0.3.1/scikits/image/opencv/opencv_cv.pyx On Sat, Mar 17, 2012 at 2:35 PM, Chris Colbert wrote: > cytpes.addressof(...) > On Mar 17, 2012 12:52 AM, "Nadav Horesh" wrote: > >> It is good to know that there is still a hope. In my case I could make >> it if only a ctype object would expose the address of the underlying C >> object. >> >> Thank you, >> >> Nadav. >> >> ?????? 16 ???? 2012 18:09, ??? St?fan van der Walt : >> >>> Hi Nadav >>> >>> On Mar 15, 2012 10:54 PM, "Nadav Horesh" >>> wrote: >>> > >>> > I have the following: >>> > A library of C function which is compiled into a dll >>> > A cython module with a function that expects as a parameter a C >>> callback function. >>> > >>> > My problem is how to make a python script to pass directly the address >>> of a C function from the dll to the cython function. >>> >>> There's a Cython Enhancement Proposal for this, but it hasn't been >>> implemented: >>> >>> http://wiki.cython.org/enhancements/nativecall >>> >>> So, I don't think there's a cleaner way, unfortunately. It's great that >>> you found a workaround, though--many people have been struggling with this >>> issue. >>> >>> St?fan >>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From sccolbert at gmail.com Sat Mar 17 15:35:18 2012 From: sccolbert at gmail.com (Chris Colbert) Date: Sat, 17 Mar 2012 15:35:18 -0400 Subject: [OT] pass a C callback function to a cythom module via python In-Reply-To: References: Message-ID: cytpes.addressof(...) On Mar 17, 2012 12:52 AM, "Nadav Horesh" wrote: > It is good to know that there is still a hope. In my case I could make it > if only a ctype object would expose the address of the underlying C object. > > Thank you, > > Nadav. > > ?????? 16 ???? 2012 18:09, ??? St?fan van der Walt : > >> Hi Nadav >> >> On Mar 15, 2012 10:54 PM, "Nadav Horesh" wrote: >> > >> > I have the following: >> > A library of C function which is compiled into a dll >> > A cython module with a function that expects as a parameter a C >> callback function. >> > >> > My problem is how to make a python script to pass directly the address >> of a C function from the dll to the cython function. >> >> There's a Cython Enhancement Proposal for this, but it hasn't been >> implemented: >> >> http://wiki.cython.org/enhancements/nativecall >> >> So, I don't think there's a cleaner way, unfortunately. It's great that >> you found a workaround, though--many people have been struggling with this >> issue. >> >> St?fan >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan at sun.ac.za Sun Mar 18 12:55:12 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Sun, 18 Mar 2012 09:55:12 -0700 Subject: Imshow and Linescan - first version In-Reply-To: References: <0a962708-d617-45d0-b343-b7e774f23965@b23g2000yqn.googlegroups.com> <4F3E69CD.3010204@mitotic-machine.org> <4F422A54.9000902@mitotic-machine.org> <4F462170.4010206@mitotic-machine.org> <4F4743FD.20304@mitotic-machine.org> <4F4B491D.5070902@mitotic-machine.org> <4F5DAF0C.4000403@mitotic-machine.org> Message-ID: Hey, Tony On Fri, Mar 16, 2012 at 6:49 PM, Tony Yu wrote: > Possible Con > ------------------------ > Someone mentioned a while back that it would be a good idea to keep skimage > focused on the basic toolset, and then a separate package could build off of > it. > > Counter-argument: This infrastructure (so far, at least) is fairly > lightweight, and I imagine the biggest area of growth would be the > plugins---most of which would just provide an interactive interface to > skimage functions. This is the way I see it too: one of skimage's most important contributions is to provide an easily-accessible Python platform for building image processing solutions. This exactly means having good pipelines, good display, and all the tools needed to build a complete solution. Some of the algorithms may be obtained from elsewhere (e.g., opencv)--but even so, building a solution using those packages is currently still a pain. So, I see the construction of these basic tools and building blocks as a fundamental part of what we're trying to do. > Counter-argument: skimage would provide the simplest possible interface for > adding interactivity (taking advantage of Matplotlib tools for plotting > histograms, etc and its support for multiple gui toolkits). A separate > project would be ideal for gui-toolkit--specific viewers (which could > potentially be significantly fast) since it would likely take more code to > do some of these things (I could be wrong about this). Also, I assume more > people using skimage would know matplotlib over any specific backend. I think from the start we assumed that we'd be building tools on Matplotlib and Qt. If something better comes along, we should consider it--of course--but in the meantime it still seems like a reasonable choice. If the plugin infrastructure can be improved to make it easier to build external tools, I'm also all for that. > I'd like to come to some sort of consensus, if possible, so please---if you > *any* opinions on this---let your voice be heard. I guess my opinion is obvious, but for the record: I'd love to include this work directly as part of skimage. But, if that's not to be, I still encourage it whole-heartedly! St?fan From stefan at sun.ac.za Mon Mar 19 12:04:24 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Mon, 19 Mar 2012 09:04:24 -0700 Subject: Imshow and Linescan - first version In-Reply-To: <4F6719CD.10204@mitotic-machine.org> References: <0a962708-d617-45d0-b343-b7e774f23965@b23g2000yqn.googlegroups.com> <4F4B491D.5070902@mitotic-machine.org> <4F5DAF0C.4000403@mitotic-machine.org> <4F6719CD.10204@mitotic-machine.org> Message-ID: On Mon, Mar 19, 2012 at 4:34 AM, Guillaume Gay wrote: > St?fan you said > > > I think from the start we assumed that we'd be building tools on > Matplotlib and Qt. > > Is Qt the *required* backend, or do we stick to the matplotlib higher > compatibility layer? So far, there is no hard dependency on Qt, but we can certainly require it for fancier GUIs. I don't think it makes much sense to build those in Matplotlib. St?fan From guillaume at mitotic-machine.org Mon Mar 19 07:34:37 2012 From: guillaume at mitotic-machine.org (Guillaume Gay) Date: Mon, 19 Mar 2012 12:34:37 +0100 Subject: Imshow and Linescan - first version In-Reply-To: References: <0a962708-d617-45d0-b343-b7e774f23965@b23g2000yqn.googlegroups.com> <4F4B491D.5070902@mitotic-machine.org> <4F5DAF0C.4000403@mitotic-machine.org> Message-ID: <4F6719CD.10204@mitotic-machine.org> Hi, No problem for the structure change. I think things are clearer that way - at least for all that is below the skloupe/ directory. As for the debate on whether skloupe (in French this sounds great btw) should be part of skimage, I think it should be the case, for the same arguments both of you used. I started looking at the code. Running edgedetector_demo.py, I have some issues with the slider window not updating the slider position. This also happens when I run example/widgets/slider_demo.py (I openned an issue on the github page). St?fan you said I think from the start we assumed that we'd be building tools on Matplotlib and Qt. Is Qt the *required* backend, or do we stick to the matplotlib higher compatibility layer? Guillaume Le 18/03/2012 17:55, St?fan van der Walt a ?crit : > Hey, Tony > > On Fri, Mar 16, 2012 at 6:49 PM, Tony Yu wrote: >> Possible Con >> ------------------------ >> Someone mentioned a while back that it would be a good idea to keep skimage >> focused on the basic toolset, and then a separate package could build off of >> it. >> >> Counter-argument: This infrastructure (so far, at least) is fairly >> lightweight, and I imagine the biggest area of growth would be the >> plugins---most of which would just provide an interactive interface to >> skimage functions. > This is the way I see it too: one of skimage's most important > contributions is to provide an easily-accessible Python platform for > building image processing solutions. This exactly means having good > pipelines, good display, and all the tools needed to build a complete > solution. Some of the algorithms may be obtained from elsewhere > (e.g., opencv)--but even so, building a solution using those packages > is currently still a pain. So, I see the construction of these basic > tools and building blocks as a fundamental part of what we're trying > to do. > >> Counter-argument: skimage would provide the simplest possible interface for >> adding interactivity (taking advantage of Matplotlib tools for plotting >> histograms, etc and its support for multiple gui toolkits). A separate >> project would be ideal for gui-toolkit--specific viewers (which could >> potentially be significantly fast) since it would likely take more code to >> do some of these things (I could be wrong about this). Also, I assume more >> people using skimage would know matplotlib over any specific backend. > I think from the start we assumed that we'd be building tools on > Matplotlib and Qt. If something better comes along, we should > consider it--of course--but in the meantime it still seems like a > reasonable choice. If the plugin infrastructure can be improved to > make it easier to build external tools, I'm also all for that. > >> I'd like to come to some sort of consensus, if possible, so please---if you >> *any* opinions on this---let your voice be heard. > I guess my opinion is obvious, but for the record: I'd love to include > this work directly as part of skimage. But, if that's not to be, I > still encourage it whole-heartedly! > > St?fan > -------------- next part -------------- A non-text attachment was scrubbed... Name: guillaume.vcf Type: text/x-vcard Size: 282 bytes Desc: not available URL: From vincent.albufera at gmail.com Tue Mar 20 06:27:29 2012 From: vincent.albufera at gmail.com (Vincent Albufera) Date: Tue, 20 Mar 2012 03:27:29 -0700 (PDT) Subject: Presentation Message-ID: Hello, I'm Vincent Albufera and I work with Emmanuelle Gouillart as image processing engineer. I would like to contribute to the development of scikits-image. I would like to add and complement the documentation of scikits-image. Best regards, Vincent From malcolm.reynolds at gmail.com Tue Mar 20 10:56:14 2012 From: malcolm.reynolds at gmail.com (Malcolm Reynolds) Date: Tue, 20 Mar 2012 07:56:14 -0700 (PDT) Subject: Normalised cross correlation In-Reply-To: References: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> Message-ID: <17457986.119.1332255374275.JavaMail.geo-discussion-forums@vbun14> On Tuesday, March 6, 2012 6:54:22 PM UTC, Tony S Yu wrote: > > > Hi Malcolm, > > I currently have a PR for a normalized cross-correlation function(which was originally implemented by Pieter Holtzhausen). > Comments/suggestions would definitely be appreciated. > > -Tony > Hi Tony I've just got round to trying this and I may be using it wrong, but currently I'm finding it doesn't match the result given by matlab's normxcorr2. For one thing I think it would make sense to raise an error when the user passes the template and image the wrong way round (matlab does this). Also, I've tested by having the template as the central part of some image, and using ncc to compare the template to the whole image. Ideally since there is one arrangement which makes each pixel match perfectly, there will be a very clear strong peak in the NCC image - which is indeed what I see in matlab (eg http://img840.imageshack.us/img840/8577/screenshot20120320at143.png ). With your match_template function however, I'm unable to get the same result, what I get instead is this: http://img844.imageshack.us/img844/8577/screenshot20120320at143.png - and if I put the template and image arguments in a different order I get an image that looks like it may have accessed invalid memory: http://img849.imageshack.us/img849/7696/screenshot20120320at144.png Additionally, calling template_match a second time with the arguments in this 'wrong' order produces a segmentation fault. Also note that the matlab, when given a 768x432 image and 384x216 template the size of the result from normxcorr2 is 647x1151. As far as I can see this size of result is not possible to create with your code, although please correct me if I'm wrong? I hope these bug reports are useful, if you need me to put together a reproduction script just let me know. Malcolm -------------- next part -------------- An HTML attachment was scrubbed... URL: From malcolm.reynolds at gmail.com Tue Mar 20 12:12:04 2012 From: malcolm.reynolds at gmail.com (Malcolm Reynolds) Date: Tue, 20 Mar 2012 09:12:04 -0700 (PDT) Subject: Normalised cross correlation In-Reply-To: References: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> <17457986.119.1332255374275.JavaMail.geo-discussion-forums@vbun14> Message-ID: <32433976.7420.1332259924268.JavaMail.geo-discussion-forums@vbgu10> > > > Wow, those results are incredibly different. Yes, please put together a > small script to reproduce the different behaviors (ideally, with the matlab > result saved as .npy---or if it's easier .mat---file; also, if you can > reproduce with a smaller image, that would be great). > > It'll be easy to check for switched arguments, but the rest might > take some time for me to get to. In your original email, it sounded like > you have some expertise in template matching; feel free to dig into the > code and see if you can spot any errors in the code. > > Cheers, > -Tony > I've quickly whipped up some scripts in both matlab (if you have access to that) and python and put them here: https://github.com/malcolmreynolds/NCC-test-program - if you don't have access to matlab, then the .mat file included should contain the inputs and outputs from matlab's normxcorr2. To run it you just need to put any image called 'lena.png' in the directory and then I ran 'ipython --pylab -i run_ncc.py' at the shell on OS X. You may have your plotting set up a different way, or not use pylab, but if all else fails the result images are written out as pngs (also included in the repository). With matlab just get to the matlab prompt and do "run_ncc". For reference, this is what I see when using a 256x256 downsampled version of the lena image: http://img843.imageshack.us/img843/2729/screenshot20120320at155.png (matlab on left, middle and right are python with and without the pad_output flag). I'm afraid I'm definitely not an expert on template matching, but I reckon it's pretty crucial to have a good free (&fast!) implementation available in numpy/scipy/skimage in order to compete.. I will take a dig through your code sometime but unfortunately deadlines are always looming for me.. I'll hopefully get a chance this coming weekend. Thanks for your quick response, let me know if you have any problems with the stuff on github. Malcolm -------------- next part -------------- An HTML attachment was scrubbed... URL: From nadavh.horesh at gmail.com Tue Mar 20 04:02:02 2012 From: nadavh.horesh at gmail.com (Nadav Horesh) Date: Tue, 20 Mar 2012 10:02:02 +0200 Subject: [OT] pass a C callback function to a cythom module via python In-Reply-To: References: Message-ID: Can you explain in more details how can I implement it? Any case I am attaching an scheme that may clarify my intend. Soon I'll post a code demonstrating the problem. Thank you, Nadav, ?????? 17 ???? 2012 21:44, ??? Chris Colbert : > You can see how we did this before with the opencv wrappers starting at > line 117 of this file: > > > https://github.com/scikits-image/scikits-image/blob/0.3.1/scikits/image/opencv/opencv_cv.pyx > > > On Sat, Mar 17, 2012 at 2:35 PM, Chris Colbert wrote: > >> cytpes.addressof(...) >> On Mar 17, 2012 12:52 AM, "Nadav Horesh" wrote: >> >>> It is good to know that there is still a hope. In my case I could make >>> it if only a ctype object would expose the address of the underlying C >>> object. >>> >>> Thank you, >>> >>> Nadav. >>> >>> ?????? 16 ???? 2012 18:09, ??? St?fan van der Walt : >>> >>>> Hi Nadav >>>> >>>> On Mar 15, 2012 10:54 PM, "Nadav Horesh" >>>> wrote: >>>> > >>>> > I have the following: >>>> > A library of C function which is compiled into a dll >>>> > A cython module with a function that expects as a parameter a C >>>> callback function. >>>> > >>>> > My problem is how to make a python script to pass directly the >>>> address of a C function from the dll to the cython function. >>>> >>>> There's a Cython Enhancement Proposal for this, but it hasn't been >>>> implemented: >>>> >>>> http://wiki.cython.org/enhancements/nativecall >>>> >>>> So, I don't think there's a cleaner way, unfortunately. It's great that >>>> you found a workaround, though--many people have been struggling with this >>>> issue. >>>> >>>> St?fan >>>> >>> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: scheme.svg Type: image/svg+xml Size: 3205 bytes Desc: not available URL: From tsyu80 at gmail.com Tue Mar 20 10:15:13 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Tue, 20 Mar 2012 10:15:13 -0400 Subject: Presentation In-Reply-To: <20120320131024.GB4109@phare.normalesup.org> References: <20120320131024.GB4109@phare.normalesup.org> Message-ID: On Tue, Mar 20, 2012 at 9:10 AM, Emmanuelle Gouillart < emmanuelle.gouillart at nsup.org> wrote: > Hi all, > > Vincent has just started a 1-year project in my lab as an image > processing engineer. He'll work on 3-D tomography images of materials > science experiments. One of his missions is to gather pieces of code used > by different teams for the processing of their images, and we hope that > some algorithms of general interest could be contributed to > scikits-image. Also, in order to get him started with Python, skimage, > git/github etc., I've asked him to work on some parts of the > documentation of skimage (docstrings, examples, etc.). I'm sure that > Vincent will appreciate any comments on his future pull requests! > > Cheers, > Emmanuelle > > On Tue, Mar 20, 2012 at 03:27:29AM -0700, Vincent Albufera wrote: > > Hello, > > I'm Vincent Albufera and I work with Emmanuelle Gouillart as image > > processing engineer. I would like to contribute to the development of > > scikits-image. I would like to add and complement the documentation of > > scikits-image. > > > Best regards, > > Vincent > Hi Vincent, Welcome! It's always nice to get a fresh pair of eyes on the documentation. You're more likely than we are to find areas of the docs/package that are confusing or unintuitive. So please fix or comment on anything that could be done better. Cheers, -Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From nadavh.horesh at gmail.com Tue Mar 20 04:16:50 2012 From: nadavh.horesh at gmail.com (Nadav Horesh) Date: Tue, 20 Mar 2012 10:16:50 +0200 Subject: Platform for filters development Message-ID: Attached here a concept code showing my attempt to produce in improved (over ndimage.generic_filter) platform for filters development. The code is very preliminary and needs a lot of extension as well as rewrite. My main questions are: 1. Is there is already a mature package for this purpose? 2. Is there is need for such a module inside scikits? Any comment is welcome. Nadav -------------- next part -------------- An HTML attachment was scrubbed... URL: From tsyu80 at gmail.com Tue Mar 20 11:13:26 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Tue, 20 Mar 2012 11:13:26 -0400 Subject: Normalised cross correlation In-Reply-To: <17457986.119.1332255374275.JavaMail.geo-discussion-forums@vbun14> References: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> <17457986.119.1332255374275.JavaMail.geo-discussion-forums@vbun14> Message-ID: On Tue, Mar 20, 2012 at 10:56 AM, Malcolm Reynolds < malcolm.reynolds at gmail.com> wrote: > On Tuesday, March 6, 2012 6:54:22 PM UTC, Tony S Yu wrote: >> >> >> Hi Malcolm, >> >> I currently have a PR for a normalized cross-correlation function(which was originally implemented by Pieter Holtzhausen). >> Comments/suggestions would definitely be appreciated. >> >> -Tony >> > > Hi Tony > > I've just got round to trying this and I may be using it wrong, but > currently I'm finding it doesn't match the result given by matlab's > normxcorr2. For one thing I think it would make sense to raise an error > when the user passes the template and image the wrong way round (matlab > does this). Also, I've tested by having the template as the central part of > some image, and using ncc to compare the template to the whole image. > Ideally since there is one arrangement which makes each pixel match > perfectly, there will be a very clear strong peak in the NCC image - which > is indeed what I see in matlab (eg > http://img840.imageshack.us/img840/8577/screenshot20120320at143.png ). > With your match_template function however, I'm unable to get the same > result, what I get instead is this: > http://img844.imageshack.us/img844/8577/screenshot20120320at143.png - and > if I put the template and image arguments in a different order I get an > image that looks like it may have accessed invalid memory: > http://img849.imageshack.us/img849/7696/screenshot20120320at144.png > > Additionally, calling template_match a second time with the arguments in > this 'wrong' order produces a segmentation fault. > > Also note that the matlab, when given a 768x432 image and 384x216 template > the size of the result from normxcorr2 is 647x1151. As far as I can see > this size of result is not possible to create with your code, although > please correct me if I'm wrong? > > I hope these bug reports are useful, if you need me to put together a > reproduction script just let me know. > > Malcolm > Wow, those results are incredibly different. Yes, please put together a small script to reproduce the different behaviors (ideally, with the matlab result saved as .npy---or if it's easier .mat---file; also, if you can reproduce with a smaller image, that would be great). It'll be easy to check for switched arguments, but the rest might take some time for me to get to. In your original email, it sounded like you have some expertise in template matching; feel free to dig into the code and see if you can spot any errors in the code. Cheers, -Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From tsyu80 at gmail.com Tue Mar 20 12:31:26 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Tue, 20 Mar 2012 12:31:26 -0400 Subject: Normalised cross correlation In-Reply-To: <32433976.7420.1332259924268.JavaMail.geo-discussion-forums@vbgu10> References: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> <17457986.119.1332255374275.JavaMail.geo-discussion-forums@vbun14> <32433976.7420.1332259924268.JavaMail.geo-discussion-forums@vbgu10> Message-ID: On Tue, Mar 20, 2012 at 12:12 PM, Malcolm Reynolds < malcolm.reynolds at gmail.com> wrote: > >> Wow, those results are incredibly different. Yes, please put together a >> small script to reproduce the different behaviors (ideally, with the matlab >> result saved as .npy---or if it's easier .mat---file; also, if you can >> reproduce with a smaller image, that would be great). >> >> It'll be easy to check for switched arguments, but the rest might >> take some time for me to get to. In your original email, it sounded like >> you have some expertise in template matching; feel free to dig into the >> code and see if you can spot any errors in the code. >> >> Cheers, >> -Tony >> > > I've quickly whipped up some scripts in both matlab (if you have access to > that) and python and put them here: > https://github.com/malcolmreynolds/NCC-test-program - if you don't have > access to matlab, then the .mat file included should contain the inputs and > outputs from matlab's normxcorr2. To run it you just need to put any image > called 'lena.png' in the directory and then I ran 'ipython --pylab -i > run_ncc.py' at the shell on OS X. You may have your plotting set up a > different way, or not use pylab, but if all else fails the result images > are written out as pngs (also included in the repository). With matlab just > get to the matlab prompt and do "run_ncc". > > For reference, this is what I see when using a 256x256 downsampled version > of the lena image: > http://img843.imageshack.us/img843/2729/screenshot20120320at155.png (matlab on left, middle and right are python with and without the > pad_output flag). > > I'm afraid I'm definitely not an expert on template matching, but I reckon > it's pretty crucial to have a good free (&fast!) implementation available > in numpy/scipy/skimage in order to compete.. I will take a dig through your > code sometime but unfortunately deadlines are always looming for me.. I'll > hopefully get a chance this coming weekend. > > Thanks for your quick response, let me know if you have any problems with > the stuff on github. > > Malcolm > Great. Thanks for putting this together and for the original bug report. I'll take a look at this soon.... I hope. :) -Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan at sun.ac.za Tue Mar 20 15:46:14 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Tue, 20 Mar 2012 12:46:14 -0700 Subject: Presentation In-Reply-To: References: Message-ID: Hi Vincent On Tue, Mar 20, 2012 at 3:27 AM, Vincent Albufera wrote: > I'm Vincent Albufera and I work with Emmanuelle Gouillart as image > processing engineer. I would like to contribute to the development of > scikits-image. I would like to add and complement the documentation of > scikits-image. We're happy to have you on board! We'd very much appreciate input on the documentation; especially if you feel like writing up parts of the user guide as you get to know the package (this narrative documentation is currently one of skimage's big deficiencies). I look forward to reviewing your pull requests. St?fan From emmanuelle.gouillart at nsup.org Tue Mar 20 09:10:24 2012 From: emmanuelle.gouillart at nsup.org (Emmanuelle Gouillart) Date: Tue, 20 Mar 2012 14:10:24 +0100 Subject: Presentation In-Reply-To: References: Message-ID: <20120320131024.GB4109@phare.normalesup.org> Hi all, Vincent has just started a 1-year project in my lab as an image processing engineer. He'll work on 3-D tomography images of materials science experiments. One of his missions is to gather pieces of code used by different teams for the processing of their images, and we hope that some algorithms of general interest could be contributed to scikits-image. Also, in order to get him started with Python, skimage, git/github etc., I've asked him to work on some parts of the documentation of skimage (docstrings, examples, etc.). I'm sure that Vincent will appreciate any comments on his future pull requests! Cheers, Emmanuelle On Tue, Mar 20, 2012 at 03:27:29AM -0700, Vincent Albufera wrote: > Hello, > I'm Vincent Albufera and I work with Emmanuelle Gouillart as image > processing engineer. I would like to contribute to the development of > scikits-image. I would like to add and complement the documentation of > scikits-image. > Best regards, > Vincent From jeanpatrick.pommier at gmail.com Wed Mar 21 07:10:16 2012 From: jeanpatrick.pommier at gmail.com (jip) Date: Wed, 21 Mar 2012 04:10:16 -0700 (PDT) Subject: Best multispectral to RGB conversion Message-ID: <24160823.40.1332328216775.JavaMail.geo-discussion-forums@ynbp26> Dear all, Some one asked me how I choose the matrix coef to convert a five multispectral image to a three (RGB) multispectral image. I feel that there is a best way to do that by maximising some distance in a color space. How would you do that? Examples of multispectral images are available here Best Regard Jean-Patrick Pommier -------------- next part -------------- An HTML attachment was scrubbed... URL: From zachary.pincus at yale.edu Wed Mar 21 08:40:14 2012 From: zachary.pincus at yale.edu (Zachary Pincus) Date: Wed, 21 Mar 2012 08:40:14 -0400 Subject: Best multispectral to RGB conversion In-Reply-To: <24160823.40.1332328216775.JavaMail.geo-discussion-forums@ynbp26> References: <24160823.40.1332328216775.JavaMail.geo-discussion-forums@ynbp26> Message-ID: > Some one asked me how I choose the matrix coef to convert a five multispectral image to a three (RGB) multispectral image. I feel that there is a best way to do that by maximising some distance in a color space. > How would you do that? > Examples of multispectral images are available here More details on the input images would be helpful: are they the result of performing spectral unmixing, so each image represents the abundance of a particular fluorophore? Or are the images the raw results? The best approach would probably differ between the two options. If the images are unmixed, then you can calculate the "true" spectrum at each pixel using the images and the emission spectra from the fluorophores. Then using these spectra, you could calculate the effective color in a number of ways, probably the simplest being a weighted average of the "red", "green", and "blue" regions of the spectra. You'd want to look at the psychophysics literature to figure out how best to do this, but I'm sure there are a ton of references online for converting a spectrum into an RGB color. If the images are mixed (that is, raw), it's even easier: figure out the "apparent color" of the emission filter for each image (see below for sample code), and then colorize each image by the apparent color, and screen the images together. (Code for screening a set of images together is below, too -- 'multi_screen()') Or, returning to the unmixed case, you could forget using the "natural" colors, and instead choose a set of colors maximally dissimilar from one another in some color space as the color for each fluorophore. This might make visualization simpler. You'd choose the colors (not sure how best), and then colorize the images and screen them together. Zach def screen(src, dst, max=255): return max - (((max - src)*(max - dst))/max) def multi_screen(images, max=255): dst = images[0] for image in images[1:]: dst = screen(image, dst, max) return dst def wavelength_to_rgb(l): # http://www.physics.sfasu.edu/astro/color/spectra.html # So-called "Bruton's Algorithm" assert (350 <= l <= 780) if l < 440: R = (440-l)/(440-350.) G = 0 B = 1 elif l < 490: R = 0 G = (l-440)/(490-440.) B = 1 elif l < 510: R = 0 G = 1 B = (510-l)/(510-490.) elif l < 580: R = (l-510)/(580-510.) G = 1 B = 0 elif l < 645: R = 1 G = (645-l)/(645-580.) B = 0 else: R = 1 G = 0 B = 0 if l > 700: intensity = 0.3 + 0.7 * (780-l)/(780-700.) elif l < 420: intensity = 0.3 + 0.7 * (l-350)/(420-350.) else: intensity = 1 return intensity*numpy.array([R,G,B], dtype=float) From emmanuelle.gouillart at nsup.org Wed Mar 21 03:57:13 2012 From: emmanuelle.gouillart at nsup.org (Emmanuelle Gouillart) Date: Wed, 21 Mar 2012 08:57:13 +0100 Subject: euroscipy 2012 Message-ID: <20120321075713.GA16574@phare.normalesup.org> Hello, is anyone planning to submit an abstract on scikits-image at Euroscipy 2012 (Brussels, August 23-27)? Cheers, Emmanuelle From stefan at sun.ac.za Wed Mar 21 16:35:31 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Wed, 21 Mar 2012 13:35:31 -0700 Subject: PyData scikits-image overview video Message-ID: Hi all, Max Walker and co. from Marakana did a fantastic job with the videos from PyData. The scikits-image lecture is now available online: http://marakana.com/s/image_processing_in_python_with_scikits-image_pydata_video,1101/index.html I find it pretty annoying listening to my own voice, so what I like to do is to go to: http://youtube.com/html5 and enable the HTML5 trial. Then, if you watch on YouTube, there's an icon at the bottom to adjust the playback speed to 1.5x (ah, the relief!). St?fan From guillaume.calmettes at gmail.com Wed Mar 21 18:09:54 2012 From: guillaume.calmettes at gmail.com (Guillaume CALMETTES) Date: Wed, 21 Mar 2012 15:09:54 -0700 Subject: PyData scikits-image overview video In-Reply-To: References: Message-ID: Thanks St?fan ! Great presentation of the scikit ! Did you make the ipython notebook you are using in the video somewhere? Guillaume 2012/3/21 St?fan van der Walt > Hi all, > > Max Walker and co. from Marakana did a fantastic job with the videos > from PyData. The scikits-image lecture is now available online: > > > http://marakana.com/s/image_processing_in_python_with_scikits-image_pydata_video,1101/index.html > > I find it pretty annoying listening to my own voice, so what I like to > do is to go to: > > http://youtube.com/html5 > > and enable the HTML5 trial. Then, if you watch on YouTube, there's an > icon at the bottom to adjust the playback speed to 1.5x (ah, the > relief!). > > St?fan > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nadavh.horesh at gmail.com Wed Mar 21 12:03:30 2012 From: nadavh.horesh at gmail.com (Nadav Horesh) Date: Wed, 21 Mar 2012 18:03:30 +0200 Subject: No subject Message-ID: (I think I missed the attachment) Attached here a concept code showing my attempt to produce in improved (over ndimage.generic_filter) platform for filters development. The code is very preliminary and needs a lot of extension as well as rewrite. My main questions are: 1. Is there is already a mature package for this purpose? 2. Is there is need for such a module inside scikits? Any comment is welcome. Nadav -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: filter_iter.tar.xz Type: application/x-xz Size: 3744 bytes Desc: not available URL: From nadavh.horesh at gmail.com Wed Mar 21 12:05:11 2012 From: nadavh.horesh at gmail.com (Nadav Horesh) Date: Wed, 21 Mar 2012 18:05:11 +0200 Subject: Fwd: Platform for filters development Message-ID: (I think I missed the attachment) Attached here a concept code showing my attempt to produce in improved (over ndimage.generic_filter) platform for filters development. The code is very preliminary and needs a lot of extension as well as rewrite. My main questions are: 1. Is there is already a mature package for this purpose? 2. Is there is need for such a module inside scikits? Any comment is welcome. Nadav -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: filter_iter.tar.xz Type: application/x-xz Size: 3744 bytes Desc: not available URL: From stefan at sun.ac.za Thu Mar 22 01:25:20 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Wed, 21 Mar 2012 22:25:20 -0700 Subject: PyData scikits-image overview video In-Reply-To: References: Message-ID: Hi Guillaume On Wed, Mar 21, 2012 at 3:09 PM, Guillaume CALMETTES wrote: > Did you make the ipython notebook you are using in the video somewhere? The material is available here: http://mentat.za.net/refer/skimage_py4science.tar.gz You may need a fairly new version of IPython to open the notebook (otherwise, just open up the notebook in a text editor and change the version number from "2" to "3"). St?fan From stefan at sun.ac.za Thu Mar 22 01:27:24 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Wed, 21 Mar 2012 22:27:24 -0700 Subject: euroscipy 2012 In-Reply-To: <20120321075713.GA16574@phare.normalesup.org> References: <20120321075713.GA16574@phare.normalesup.org> Message-ID: Hi Emmanuelle On Wed, Mar 21, 2012 at 12:57 AM, Emmanuelle Gouillart wrote: > ? ? ? ?is anyone planning to submit an abstract on scikits-image at > Euroscipy 2012 (Brussels, August 23-27)? I'll be at the conference, but I hadn't considered giving a talk. Do you have any suggestions? St?fan From guillaume.calmettes at gmail.com Thu Mar 22 01:38:26 2012 From: guillaume.calmettes at gmail.com (Guillaume CALMETTES) Date: Wed, 21 Mar 2012 22:38:26 -0700 Subject: PyData scikits-image overview video In-Reply-To: References: Message-ID: Hi St?fan, Le Mar 21, 2012 ? 10:25 PM, St?fan van der Walt a ?crit : > Hi Guillaume > > On Wed, Mar 21, 2012 at 3:09 PM, Guillaume CALMETTES > wrote: >> Did you make the ipython notebook you are using in the video >> somewhere? > > The material is available here: > > http://mentat.za.net/refer/skimage_py4science.tar.gz Thanks, it works like a charm ! > > You may need a fairly new version of IPython to open the notebook > (otherwise, just open up the notebook in a text editor and change the > version number from "2" to "3"). > > St?fan From yager.neil at gmail.com Thu Mar 22 05:05:32 2012 From: yager.neil at gmail.com (Neil Yager) Date: Thu, 22 Mar 2012 02:05:32 -0700 (PDT) Subject: PyData scikits-image overview video In-Reply-To: References: Message-ID: Great video! It's really about time I start using the ipython notebook. I've been spending quite a bit of time this week going through the PyCon 2012 videos - there's some great ones (e.g. http://pyvideo.org/video/614/high-performance-python-i). However, many are ~3 hours, so the YouTube tip is definitely going to save me some time. Neil On Mar 21, 8:35?pm, St?fan van der Walt wrote: > Hi all, > > Max Walker and co. from Marakana did a fantastic job with the videos > from PyData. ?The scikits-image lecture is now available online: > > http://marakana.com/s/image_processing_in_python_with_scikits-image_p... > > I find it pretty annoying listening to my own voice, so what I like to > do is to go to: > > http://youtube.com/html5 > > and enable the HTML5 trial. ?Then, if you watch on YouTube, there's an > icon at the bottom to adjust the playback speed to 1.5x (ah, the > relief!). > > St?fan From jeanpatrick.pommier at gmail.com Thu Mar 22 06:26:38 2012 From: jeanpatrick.pommier at gmail.com (jip) Date: Thu, 22 Mar 2012 03:26:38 -0700 (PDT) Subject: Best multispectral to RGB conversion In-Reply-To: <24160823.40.1332328216775.JavaMail.geo-discussion-forums@ynbp26> References: <24160823.40.1332328216775.JavaMail.geo-discussion-forums@ynbp26> Message-ID: <24913430.29.1332411999051.JavaMail.geo-discussion-forums@ynes7> Each image is a raw image of a given fluorochrome. A given fluorochrome targets a subset of chromosomes, more informations can be found in: *Automatic Segmentation and Classification of Multiplex-Fluorescence In-Situ Hybridization Chromosome Images by Hyo Hun Choi, B.S., M.S. * Choi gives an example of CCD integration times: * An example of integration times is [DAPI, Aqua, Green, Gold, Red, Far Red] = [0.14, 6, 0.76, 6, 2.96, 1.4] seconds* He also gives an example of spectral mixing in the raw images: With the vysis data set (example:https://github.com/jeanpat/MFISH/tree/master/MFISH_TIFF/V13__40), a given fluorochrome corresponds to several chromosomes, in the spectrumAqua image the chromosomes 3,10,11,13,15,20,21,22,X,Y are visibles. A: S. Aqua D DAPI F: Far Red G: S. Green R: S. Red Y: S. Gold To perform "perfect" spectral unmixing, I suppose it's necessary to know the integration time, the characteristic of the microscope bandpass filters, the emission spectrum of each fluorochrome; but would it be possible to make some kind of "estimated" unmixing from only the images themselves? Best regards Jean-Pat Le mercredi 21 mars 2012 12:10:16 UTC+1, jip a ?crit : > > Dear all, > Some one asked me how I choose the matrix coef to convert a five > multispectral image to a three (RGB) multispectral image. > I feel that there is a best way to do that by maximising some distance in a > color space. > How would you do that? > Examples of multispectral images are available here > > Best Regard > > Jean-Patrick Pommier > Le mercredi 21 mars 2012 12:10:16 UTC+1, jip a ?crit : > > Dear all, > Some one asked me how I choose the matrix coef to convert a five > multispectral image to a three (RGB) multispectral image. > I feel that there is a best way to do that by maximising some distance in a > color space. > How would you do that? > Examples of multispectral images are available here > > Best Regard > > Jean-Patrick Pommier > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeanpatrick.pommier at gmail.com Thu Mar 22 06:30:06 2012 From: jeanpatrick.pommier at gmail.com (jip) Date: Thu, 22 Mar 2012 03:30:06 -0700 (PDT) Subject: Best multispectral to RGB conversion In-Reply-To: <24913430.29.1332411999051.JavaMail.geo-discussion-forums@ynes7> References: <24160823.40.1332328216775.JavaMail.geo-discussion-forums@ynbp26> <24913430.29.1332411999051.JavaMail.geo-discussion-forums@ynes7> Message-ID: <6867401.1121.1332412206338.JavaMail.geo-discussion-forums@ynls18> Sorry, the spectral mixing table was not included (see before, I failed to insert an image where I want ....) Le jeudi 22 mars 2012 11:26:38 UTC+1, jip a ?crit : > > Each image is a raw image of a given fluorochrome. > > A given fluorochrome targets a subset of chromosomes, more informations > can be found in: > > *Automatic Segmentation and Classification of > Multiplex-Fluorescence In-Situ Hybridization > Chromosome Images > by > Hyo Hun Choi, B.S., M.S. > * > Choi gives an example of CCD integration times: > * > An example of integration times is [DAPI, Aqua, > Green, Gold, Red, Far Red] = [0.14, 6, 0.76, 6, 2.96, 1.4] seconds* > > He also gives an example of spectral mixing in the raw images: > > > > With the vysis data set (example: > https://github.com/jeanpat/MFISH/tree/master/MFISH_TIFF/V13__40), a given > fluorochrome corresponds to several chromosomes, in the spectrumAqua image > the chromosomes 3,10,11,13,15,20,21,22,X,Y are visibles. > > A: S. Aqua > D DAPI > F: Far Red > G: S. Green > R: S. Red > Y: S. Gold > > To perform "perfect" spectral unmixing, I suppose it's necessary to know > the integration time, the characteristic of the microscope bandpass > filters, the emission spectrum of each fluorochrome; but would it be > possible to make some kind of "estimated" unmixing from only the images > themselves? > > Best regards > Jean-Pat > > Le mercredi 21 mars 2012 12:10:16 UTC+1, jip a ?crit : >> >> Dear all, >> Some one asked me how I choose the matrix coef to convert a five >> multispectral image to a three (RGB) multispectral image. >> I feel that there is a best way to do that by maximising some distance in a >> color space. >> How would you do that? >> Examples of multispectral images are available here >> >> Best Regard >> >> Jean-Patrick Pommier >> > > Le mercredi 21 mars 2012 12:10:16 UTC+1, jip a ?crit : >> >> Dear all, >> Some one asked me how I choose the matrix coef to convert a five >> multispectral image to a three (RGB) multispectral image. >> I feel that there is a best way to do that by maximising some distance in a >> color space. >> How would you do that? >> Examples of multispectral images are available here >> >> Best Regard >> >> Jean-Patrick Pommier >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From emmanuelle.gouillart at nsup.org Thu Mar 22 03:38:22 2012 From: emmanuelle.gouillart at nsup.org (Emmanuelle Gouillart) Date: Thu, 22 Mar 2012 08:38:22 +0100 Subject: euroscipy 2012 In-Reply-To: References: <20120321075713.GA16574@phare.normalesup.org> Message-ID: <20120322073822.GA16035@phare.normalesup.org> > I'll be at the conference, but I hadn't considered giving a talk. Do > you have any suggestions? Either you could give a general talk on scikits-image (like the one at PyData), if you feel like to, or (and/or) Vincent and I could prepare a talk on scikits-image and how to use the package for our applications, that is tomography datasets in materials science. There is possibly room for two talks on scikits-image (or one talk and a poster), if one is more general and the other one focusses more on applications. Emmanuelle From zachary.pincus at yale.edu Thu Mar 22 11:43:29 2012 From: zachary.pincus at yale.edu (Zachary Pincus) Date: Thu, 22 Mar 2012 11:43:29 -0400 Subject: Best multispectral to RGB conversion In-Reply-To: <24913430.29.1332411999051.JavaMail.geo-discussion-forums@ynes7> References: <24160823.40.1332328216775.JavaMail.geo-discussion-forums@ynbp26> <24913430.29.1332411999051.JavaMail.geo-discussion-forums@ynes7> Message-ID: <73B7A652-86ED-43DD-9D29-5C418261B9B0@yale.edu> Jean-Pat, > To perform "perfect" spectral unmixing, I suppose it's necessary to know the integration time, the characteristic of the microscope bandpass filters, the emission spectrum of each fluorochrome; but would it be possible to make some kind of "estimated" unmixing from only the images themselves? Wait, are you trying to perform spectral unmixing (5 channels -> 25 channels, one per chromosome), or false coloring (5 channels -> 3 channel RGB)? The first email made it sound like the latter, but this one seems more on the former... If you want to do unmixing, there's a large literature about the MFISH case specifically, and I think there are some pretty well-known methods at this point. Presumably it would help to know the integration times and spectral characteristics of the instrument / fluorophores, especially given the table you appended to the second email about the spectral mixing issues. False-coloring is an easier subject. You'd just need to choose "target" RGB colors for each of the 5 raw images, colorize each image by that color, and screen them together. Most of the art is in choosing good "target" colors. You could choose based on the original colors ("aqua" etc.), or choose equidistant points on the hue-circle (with equivalent saturation, and brightness determined by the original grayscale pixel intensity). Zach On Mar 22, 2012, at 6:26 AM, jip wrote: > Each image is a raw image of a given fluorochrome. > > A given fluorochrome targets a subset of chromosomes, more informations can be found in: > > Automatic Segmentation and Classification of > Multiplex-Fluorescence In-Situ Hybridization > Chromosome Images > by > Hyo Hun Choi, B.S., M.S. > Choi gives an example of CCD integration times: > > An example of integration times is [DAPI, Aqua, > Green, Gold, Red, Far Red] = [0.14, 6, 0.76, 6, 2.96, 1.4] seconds > > He also gives an example of spectral mixing in the raw images: > > > With the vysis data set (example:https://github.com/jeanpat/MFISH/tree/master/MFISH_TIFF/V13__40), a given fluorochrome corresponds to several chromosomes, in the spectrumAqua image the chromosomes 3,10,11,13,15,20,21,22,X,Y are visibles. > > A: S. Aqua > D DAPI > F: Far Red > G: S. Green > R: S. Red > Y: S. Gold > > To perform "perfect" spectral unmixing, I suppose it's necessary to know the integration time, the characteristic of the microscope bandpass filters, the emission spectrum of each fluorochrome; but would it be possible to make some kind of "estimated" unmixing from only the images themselves? > > Best regards > Jean-Pat > > Le mercredi 21 mars 2012 12:10:16 UTC+1, jip a ?crit : > Dear all, > Some one asked me how I choose the matrix coef to convert a five multispectral image to a three (RGB) multispectral image. I feel that there is a best way to do that by maximising some distance in a color space. > How would you do that? > Examples of multispectral images are available here > > Best Regard > > Jean-Patrick Pommier > > Le mercredi 21 mars 2012 12:10:16 UTC+1, jip a ?crit : > Dear all, > Some one asked me how I choose the matrix coef to convert a five multispectral image to a three (RGB) multispectral image. I feel that there is a best way to do that by maximising some distance in a color space. > How would you do that? > Examples of multispectral images are available here > > Best Regard > > Jean-Patrick Pommier From jeanpatrick.pommier at gmail.com Thu Mar 22 17:08:31 2012 From: jeanpatrick.pommier at gmail.com (jip) Date: Thu, 22 Mar 2012 14:08:31 -0700 (PDT) Subject: Best multispectral to RGB conversion In-Reply-To: <73B7A652-86ED-43DD-9D29-5C418261B9B0@yale.edu> References: <24160823.40.1332328216775.JavaMail.geo-discussion-forums@ynbp26> <24913430.29.1332411999051.JavaMail.geo-discussion-forums@ynes7> <73B7A652-86ED-43DD-9D29-5C418261B9B0@yale.edu> Message-ID: <19614416.208.1332450511282.JavaMail.geo-discussion-forums@vbcv13> Le jeudi 22 mars 2012 16:43:29 UTC+1, Zachary Pincus a ?crit : > > Jean-Pat, > > > To perform "perfect" spectral unmixing, I suppose it's necessary to know > the integration time, the characteristic of the microscope bandpass > filters, the emission spectrum of each fluorochrome; but would it be > possible to make some kind of "estimated" unmixing from only the images > themselves? > > Wait, are you trying to perform spectral unmixing (5 channels -> 25 > channels, one per chromosome), or false coloring (5 channels -> 3 channel > RGB)? The first email made it sound like the latter, but this one seems > more on the former... > Sorry, you're right, my first question was about the 5 ->3 channels issue. > If you want to do unmixing, there's a large literature about the MFISH > case specifically, and I think there are some pretty well-known methods at > this point. Presumably it would help to know the integration times and > spectral characteristics of the instrument / fluorophores, especially given > the table you appended to the second email about the spectral mixing > issues. > > False-coloring is an easier subject. You'd just need to choose "target" > RGB colors for each of the 5 raw images, colorize each image by that color, > and screen them together. Most of the art is in choosing good "target" > colors. You could choose based on the original colors ("aqua" etc.), > I met that problem when I chose the matrix coef(with Stefan's code). The matrix was doing the job with: 'R': [0, 0, 0.05, 0.15, 0.8], 'V': [0.1, 0.8, 0.05, 0.05, 0], 'B': [0.8, 0.15, 0.05, 0, 0]} > or choose equidistant points on the hue-circle (with equivalent > saturation, and brightness determined by the original grayscale pixel > intensity). > The steps should be for a given image (ex s-aqua): *calculate saturation and brightness from gray scale s-aqua. (s1,b1) *choose hue (a1) Do the same for each fluo Use the 5x3 hsb values to calculate a matrix to do the convertion 5 channels->3 RGB Is it correct? Jean-Pat Zach > > > On Mar 22, 2012, at 6:26 AM, jip wrote: > > > Each image is a raw image of a given fluorochrome. > > > > A given fluorochrome targets a subset of chromosomes, more informations > can be found in: > > > > Automatic Segmentation and Classification of > > Multiplex-Fluorescence In-Situ Hybridization > > Chromosome Images > > by > > Hyo Hun Choi, B.S., M.S. > > Choi gives an example of CCD integration times: > > > > An example of integration times is [DAPI, Aqua, > > Green, Gold, Red, Far Red] = [0.14, 6, 0.76, 6, 2.96, 1.4] seconds > > > > He also gives an example of spectral mixing in the raw images: > > > > > > With the vysis data set (example: > https://github.com/?jeanpat/MFISH/tree/master/?MFISH_TIFF/V13__40), > a given fluorochrome corresponds to several chromosomes, in the > spectrumAqua image the chromosomes 3,10,11,13,15,20,21,22,X,Y are visibles. > > > > A: S. Aqua > > D DAPI > > F: Far Red > > G: S. Green > > R: S. Red > > Y: S. Gold > > > > To perform "perfect" spectral unmixing, I suppose it's necessary to know > the integration time, the characteristic of the microscope bandpass > filters, the emission spectrum of each fluorochrome; but would it be > possible to make some kind of "estimated" unmixing from only the images > themselves? > > > > Best regards > > Jean-Pat > > > > Le mercredi 21 mars 2012 12:10:16 UTC+1, jip a ?crit : > > Dear all, > > Some one asked me how I choose the matrix coef to convert a five > multispectral image to a three (RGB) multispectral image. I feel that there > is a best way to do that by maximising some distance in a color space. > > How would you do that? > > Examples of multispectral images are available here > > > > Best Regard > > > > Jean-Patrick Pommier > > > > Le mercredi 21 mars 2012 12:10:16 UTC+1, jip a ?crit : > > Dear all, > > Some one asked me how I choose the matrix coef to convert a five > multispectral image to a three (RGB) multispectral image. I feel that there > is a best way to do that by maximising some distance in a color space. > > How would you do that? > > Examples of multispectral images are available here > > > > Best Regard > > > > Jean-Patrick Pommier > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zachary.pincus at yale.edu Thu Mar 22 17:24:54 2012 From: zachary.pincus at yale.edu (Zachary Pincus) Date: Thu, 22 Mar 2012 17:24:54 -0400 Subject: Best multispectral to RGB conversion In-Reply-To: <19614416.208.1332450511282.JavaMail.geo-discussion-forums@vbcv13> References: <24160823.40.1332328216775.JavaMail.geo-discussion-forums@ynbp26> <24913430.29.1332411999051.JavaMail.geo-discussion-forums@ynes7> <73B7A652-86ED-43DD-9D29-5C418261B9B0@yale.edu> <19614416.208.1332450511282.JavaMail.geo-discussion-forums@vbcv13> Message-ID: > The steps should be for a given image (ex s-aqua): > *calculate saturation and brightness from gray scale s-aqua. (s1,b1) > *choose hue (a1) > Do the same for each fluo > Use the 5x3 hsb values to calculate a matrix to do the convertion 5 channels->3 RGB > > Is it correct? Basically correct. You could also just calculate brightness from the gray images, and leave the saturation constant. Also, my suggestion was to use the "screen" operator to combine each image. The 5x3 matrix multiplication effectively makes 5 RGB images (one from each fluor), and then sums them together. In general, I find that "screen" works better than "sum" for making visually-appealing overlays of fluorescence channels. For [0,1]-valued float images, the formula for screen-combining two images a and b is: a+b-ab. (http://en.wikipedia.org/wiki/Blend_modes#Screen ) Anyway, I'd try both sum and screen to see which looks best. Zach From jeanpatrick.pommier at gmail.com Fri Mar 23 02:57:38 2012 From: jeanpatrick.pommier at gmail.com (Jean-Patrick Pommier) Date: Fri, 23 Mar 2012 07:57:38 +0100 Subject: Best multispectral to RGB conversion In-Reply-To: References: <24160823.40.1332328216775.JavaMail.geo-discussion-forums@ynbp26> <24913430.29.1332411999051.JavaMail.geo-discussion-forums@ynes7> <73B7A652-86ED-43DD-9D29-5C418261B9B0@yale.edu> <19614416.208.1332450511282.JavaMail.geo-discussion-forums@vbcv13> Message-ID: Thank you Jean-Pat 2012/3/22 Zachary Pincus > > The steps should be for a given image (ex s-aqua): > > *calculate saturation and brightness from gray scale s-aqua. (s1,b1) > > *choose hue (a1) > > Do the same for each fluo > > Use the 5x3 hsb values to calculate a matrix to do the convertion 5 > channels->3 RGB > > > > Is it correct? > > Basically correct. > > You could also just calculate brightness from the gray images, and leave > the saturation constant. > > Also, my suggestion was to use the "screen" operator to combine each > image. The 5x3 matrix multiplication effectively makes 5 RGB images (one > from each fluor), and then sums them together. In general, I find that > "screen" works better than "sum" for making visually-appealing overlays of > fluorescence channels. > > For [0,1]-valued float images, the formula for screen-combining two images > a and b is: a+b-ab. (http://en.wikipedia.org/wiki/Blend_modes#Screen ) > > Anyway, I'd try both sum and screen to see which looks best. > > Zach -------------- next part -------------- An HTML attachment was scrubbed... URL: From tsyu80 at gmail.com Fri Mar 23 09:46:12 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Fri, 23 Mar 2012 09:46:12 -0400 Subject: New `viewer` subpackage (was [Re: Imshow and Linescan - first version]) Message-ID: 2012/3/18 St?fan van der Walt > Hey, Tony > > On Fri, Mar 16, 2012 at 6:49 PM, Tony Yu wrote: > > Possible Con > > ------------------------ > > Someone mentioned a while back that it would be a good idea to keep > skimage > > focused on the basic toolset, and then a separate package could build > off of > > it. > > > > Counter-argument: This infrastructure (so far, at least) is fairly > > lightweight, and I imagine the biggest area of growth would be the > > plugins---most of which would just provide an interactive interface to > > skimage functions. > > This is the way I see it too: one of skimage's most important > contributions is to provide an easily-accessible Python platform for > building image processing solutions. This exactly means having good > pipelines, good display, and all the tools needed to build a complete > solution. Some of the algorithms may be obtained from elsewhere > (e.g., opencv)--but even so, building a solution using those packages > is currently still a pain. So, I see the construction of these basic > tools and building blocks as a fundamental part of what we're trying > to do. > > > Counter-argument: skimage would provide the simplest possible interface > for > > adding interactivity (taking advantage of Matplotlib tools for plotting > > histograms, etc and its support for multiple gui toolkits). A separate > > project would be ideal for gui-toolkit--specific viewers (which could > > potentially be significantly fast) since it would likely take more code > to > > do some of these things (I could be wrong about this). Also, I assume > more > > people using skimage would know matplotlib over any specific backend. > > I think from the start we assumed that we'd be building tools on > Matplotlib and Qt. If something better comes along, we should > consider it--of course--but in the meantime it still seems like a > reasonable choice. If the plugin infrastructure can be improved to > make it easier to build external tools, I'm also all for that. > > > I'd like to come to some sort of consensus, if possible, so please---if > you > > *any* opinions on this---let your voice be heard. > > I guess my opinion is obvious, but for the record: I'd love to include > this work directly as part of skimage. But, if that's not to be, I > still encourage it whole-heartedly! > > St?fan > Since there weren't any objections, I added a new `viewer` subpackage in PR 165 . Sorry for the big commit: the full commit history can be found in another repo . The main parts are the viewer base classes and the plugin base class. The rest of the code just demonstrates what this backbone allows. If nothing else, you can play around with the examples . I plan on adding some sort of "How to write a custom Plugin" documentation, but Guillaume didn't seem to have much trouble writing a ContrastSetter plugin even without that :) Cheers, -Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From msarahan at gmail.com Sat Mar 24 17:16:21 2012 From: msarahan at gmail.com (Mike Sarahan) Date: Sat, 24 Mar 2012 14:16:21 -0700 Subject: Normalised cross correlation In-Reply-To: References: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> <17457986.119.1332255374275.JavaMail.geo-discussion-forums@vbun14> <32433976.7420.1332259924268.JavaMail.geo-discussion-forums@vbgu10> Message-ID: Hi guys, I have used NCC a lot in my research, so I thought I'd take a look at this. How critical is it that skimage's result image is the same size as matlab's? The difference arises from the approach to the problem. Matlab is assuming that the template might match an area of the target image that isn't fully in frame. They probably pad the original image (preferably with the target image average), and then do the cross correlation on the padded image. This would explain the different result size - Matlab seems to be M+m-1 by N+n-1. That means they pad by the template width laterally, and the template height vertically. They then have an M+2m x N+2n image, which they then apply the template match to. I haven't figured out the problem with the results not matching, though. The "good" news is that the results with padding the matlab way (pre-match) are especially fishy (nans are cropping up). That's certainly an indicator of something rather fundamental being wrong. I'm out of time for now, but I hope this helps a little. I will investigate further when time allows, provided you all don't beat me to it. Best, Mike On Tue, Mar 20, 2012 at 9:31 AM, Tony Yu wrote: > > > On Tue, Mar 20, 2012 at 12:12 PM, Malcolm Reynolds > wrote: >>> >>> >>> Wow, those results are incredibly different. Yes, please put together a >>> small script to reproduce the different behaviors (ideally, with the matlab >>> result saved as .npy---or if it's easier .mat---file; also, if you can >>> reproduce with a smaller image, that would be great). >>> >>> It'll be easy to check for switched arguments, but the rest might >>> take?some time for me to get to.?In your original email, it sounded like you >>> have some expertise in template matching; feel free to dig into the code and >>> see if you can spot any errors in the code. >>> >>> Cheers, >>> -Tony >> >> >> I've quickly whipped up some scripts in both matlab (if you have access to >> that) and python and put them >> here:?https://github.com/malcolmreynolds/NCC-test-program - if you don't >> have access to matlab, then the .mat file included should contain the inputs >> and outputs from matlab's normxcorr2. To run it you just need to put any >> image called 'lena.png' in the directory and then I ran 'ipython --pylab -i >> run_ncc.py' at the shell on OS X. You may have your plotting set up a >> different way, or not use pylab, but if all else fails the result images are >> written out as pngs (also included in the repository). With matlab just get >> to the matlab prompt and do "run_ncc". >> >> For reference, this is what I see when using a 256x256 downsampled version >> of the lena image: >> http://img843.imageshack.us/img843/2729/screenshot20120320at155.png ?(matlab >> on left, middle and right are python with and without the pad_output flag). >> >> I'm afraid I'm definitely not an expert on template matching, but I reckon >> it's pretty crucial to have a good free (&fast!) implementation available in >> numpy/scipy/skimage in order to compete.. I will take a dig through your >> code sometime but unfortunately deadlines are always looming for me.. I'll >> hopefully get a chance this coming weekend. >> >> Thanks for your quick response, let me know if you have any problems with >> the stuff on github. >> >> Malcolm > > > Great. Thanks for putting this together and for the original bug report. > I'll take a look at this soon.... I hope. :) > > -Tony -------------- next part -------------- A non-text attachment was scrubbed... Name: template.py.diff Type: text/x-patch Size: 1046 bytes Desc: not available URL: From stefan at sun.ac.za Sat Mar 24 18:07:06 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Sat, 24 Mar 2012 15:07:06 -0700 Subject: Normalised cross correlation In-Reply-To: References: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> <17457986.119.1332255374275.JavaMail.geo-discussion-forums@vbun14> <32433976.7420.1332259924268.JavaMail.geo-discussion-forums@vbgu10> Message-ID: Hi Mike On Sat, Mar 24, 2012 at 2:16 PM, Mike Sarahan wrote: > I'm out of time for now, but I hope this helps a little. ?I will > investigate further when time allows, provided you all don't beat me > to it. Thanks for looking into this, and for identifying the boundary issue. The fact that there are differences even with padding is disconcerting; I'll see if I can review this soon. St?fan From msarahan at gmail.com Sat Mar 24 20:29:24 2012 From: msarahan at gmail.com (Mike Sarahan) Date: Sat, 24 Mar 2012 17:29:24 -0700 Subject: Normalised cross correlation In-Reply-To: References: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> <17457986.119.1332255374275.JavaMail.geo-discussion-forums@vbun14> <32433976.7420.1332259924268.JavaMail.geo-discussion-forums@vbgu10> Message-ID: Hi Tony, Glad you figured this out. I'm also not a huge fan of the Matlab-style padding. I guess theoretically, it gives your match greater range - beyond the bounds of the image. In practice, I found that such behavior in the presence of noise often gave me a peak outside the image, when I knew I wanted my peak inside the image. I'm mixed on the input padding. Intuitively, I think the high value at template center is easier to understand for a human looking at the cross correlation result image. I know that this confused me a lot when I first encountered cross correlation using OpenCV. However, any subsequent analysis (peak finding, for example) would have to account for the difference, and I think this would be more of a headache than a benefit to people. I can imagine a lot of careless analyses with offsets of exactly half the template dimensions. Your proposed method for the padding makes more sense to me than Matlab's. I would recommend defaulting to no padding, and also recommend a little documentation that warns the user about the offset they will have to account for if using the pad option. I can't think of a use case for padding the output with zeros. If anyone else knows one, I'll be happy to learn, though. Best, Mike On Sat, Mar 24, 2012 at 4:03 PM, Tony Yu wrote: > > > 2012/3/24 St?fan van der Walt >> >> Hi Mike >> >> On Sat, Mar 24, 2012 at 2:16 PM, Mike Sarahan wrote: >> > I'm out of time for now, but I hope this helps a little. ?I will >> > investigate further when time allows, provided you all don't beat me >> > to it. >> >> Thanks for looking into this, and for identifying the boundary issue. >> The fact that there are differences even with padding is >> disconcerting; I'll see if I can review this soon. >> >> St?fan > > > Ok,... so it turns out I made a stupid with the convolution-to-correlation > translation. Fixing that gives comparable *looking* results to matlab (after > Mike's padding patch). BUT, I also get NaN values with the padded output. > These NaNs come from the sqrt of negative values (see code?which solves the > denominator). I *think* the argument of the sqrt should (mathematically) be > zero, but round-off errors are causing it to go negative. If that's the > case, then it's an easy fix to check that the argument is positive, but > someone should check my math to make sure the the code matches the equation. > > As for the padding---that was a hack. I noticed the original implementation > clipped the image to (M-m+1, N-n+1) so I padded *the result* with zeros to > make the output (M, N). Also, the way I padded it (all padding on bottom and > right) meant that the output has a high value when "origin" (i.e. top-left > corner) of the template matches, as opposed to the center.?This could be > done by padding the image with half the template width to the left and > right, and half the template height to the top and bottom. > > Padding *the input* sounds like a good idea, but I think it should be done > in such a way that the output is (M, N)---i.e. same size as the input image. > I'm not a huge fan of the Matlab output size (but maybe some people expect > this output?). > > Is there a "right" way to do the padding? Or maybe "pad_output" should be > changed to "mode" (to match scipy.signal.convolve) with values 'valid' (no > padding; output (M-m+1, N-n+1)), 'same' (pad input with image mean), and > 'zeros' (pad output with zeros)? > > -T From tsyu80 at gmail.com Sat Mar 24 19:03:58 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Sat, 24 Mar 2012 19:03:58 -0400 Subject: Normalised cross correlation In-Reply-To: References: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> <17457986.119.1332255374275.JavaMail.geo-discussion-forums@vbun14> <32433976.7420.1332259924268.JavaMail.geo-discussion-forums@vbgu10> Message-ID: 2012/3/24 St?fan van der Walt > Hi Mike > > On Sat, Mar 24, 2012 at 2:16 PM, Mike Sarahan wrote: > > I'm out of time for now, but I hope this helps a little. I will > > investigate further when time allows, provided you all don't beat me > > to it. > > Thanks for looking into this, and for identifying the boundary issue. > The fact that there are differences even with padding is > disconcerting; I'll see if I can review this soon. > > St?fan > Ok,... so it turns out I made a stupid with the convolution-to-correlationtranslation. Fixing that gives comparable *looking* results to matlab (after Mike's padding patch). BUT, I also get NaN values with the padded output. These NaNs come from the sqrt of negative values (see code which solves the denominator). I *think* the argument of the sqrt should (mathematically) be zero, but round-off errors are causing it to go negative. If that's the case, then it's an easy fix to check that the argument is positive, but someone should check my math to make sure the the codematches the equation . As for the padding---that was a hack. I noticed the original implementation clipped the image to (M-m+1, N-n+1) so I padded *the result* with zeros to make the output (M, N). Also, the way I padded it (all padding on bottom and right) meant that the output has a high value when "origin" (i.e. top-left corner) of the template matches, as opposed to the center. This could be done by padding the image with half the template width to the left and right, and half the template height to the top and bottom. Padding *the input* sounds like a good idea, but I think it should be done in such a way that the output is (M, N)---i.e. same size as the input image. I'm not a huge fan of the Matlab output size (but maybe some people expect this output?). Is there a "right" way to do the padding? Or maybe "pad_output" should be changed to "mode" (to match scipy.signal.convolve) with values 'valid' (no padding; output (M-m+1, N-n+1)), 'same' (pad input with image mean), and 'zeros' (pad output with zeros)? -T -------------- next part -------------- An HTML attachment was scrubbed... URL: From tsyu80 at gmail.com Sat Mar 24 20:09:45 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Sat, 24 Mar 2012 20:09:45 -0400 Subject: Normalised cross correlation In-Reply-To: References: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> <17457986.119.1332255374275.JavaMail.geo-discussion-forums@vbun14> <32433976.7420.1332259924268.JavaMail.geo-discussion-forums@vbgu10> Message-ID: On Sat, Mar 24, 2012 at 7:03 PM, Tony Yu wrote: > > > 2012/3/24 St?fan van der Walt > >> Hi Mike >> >> On Sat, Mar 24, 2012 at 2:16 PM, Mike Sarahan wrote: >> > I'm out of time for now, but I hope this helps a little. I will >> > investigate further when time allows, provided you all don't beat me >> > to it. >> >> Thanks for looking into this, and for identifying the boundary issue. >> The fact that there are differences even with padding is >> disconcerting; I'll see if I can review this soon. >> >> St?fan >> > > Ok,... so it turns out I made a stupid with the convolution-to-correlationtranslation. Fixing that gives comparable *looking* results to matlab > (after Mike's padding patch). BUT, I also get NaN values with the padded > output. These NaNs come from the sqrt of negative values (see code which > solves the denominator). > I *think* the argument of the sqrt should (mathematically) be zero, but > round-off errors are causing it to go negative. If that's the case, then > it's an easy fix to check that the argument is positive, but someone should > check my math to make sure the the codematches the > equation > . > > As for the padding---that was a hack. I noticed the original > implementation clipped the image to (M-m+1, N-n+1) so I padded *the result* > with zeros to make the output (M, N). Also, the way I padded it (all > padding on bottom and right) meant that the output has a high value when > "origin" (i.e. top-left corner) of the template matches, as opposed to the > center. This could be done by padding the image with half the template > width to the left and right, and half the template height to the top and > bottom. > > Padding *the input* sounds like a good idea, but I think it should be done > in such a way that the output is (M, N)---i.e. same size as the input > image. I'm not a huge fan of the Matlab output size (but maybe some people > expect this output?). > > Is there a "right" way to do the padding? Or maybe "pad_output" should be > changed to "mode" (to match scipy.signal.convolve) with values 'valid' (no > padding; output (M-m+1, N-n+1)), 'same' (pad input with image mean), and > 'zeros' (pad output with zeros)? > > -T > Just to follow up: This would be my preferred way to pad the image. Here, the maximum in the output corresponds to the center of the best template-match. -T -------------- next part -------------- An HTML attachment was scrubbed... URL: From tsyu80 at gmail.com Sun Mar 25 09:31:46 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Sun, 25 Mar 2012 09:31:46 -0400 Subject: Normalised cross correlation In-Reply-To: References: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> <17457986.119.1332255374275.JavaMail.geo-discussion-forums@vbun14> <32433976.7420.1332259924268.JavaMail.geo-discussion-forums@vbgu10> Message-ID: On Sat, Mar 24, 2012 at 8:29 PM, Mike Sarahan wrote: > Hi Tony, > > Glad you figured this out. > I'm also not a huge fan of the Matlab-style padding. I guess > theoretically, it gives your match greater range - beyond the bounds > of the image. In practice, I found that such behavior in the presence > of noise often gave me a peak outside the image, when I knew I wanted > my peak inside the image. > > I'm mixed on the input padding. Intuitively, I think the high value > at template center is easier to understand for a human looking at the > cross correlation result image. I know that this confused me a lot > when I first encountered cross correlation using OpenCV. However, any > subsequent analysis (peak finding, for example) would have to account > for the difference, and I think this would be more of a headache than > a benefit to people. I can imagine a lot of careless analyses with > offsets of exactly half the template dimensions. > > Your proposed method for the padding makes more sense to me than > Matlab's. I would recommend defaulting to no padding, and also > recommend a little documentation that warns the user about the offset > they will have to account for if using the pad option. > > I can't think of a use case for padding the output with zeros. If > anyone else knows one, I'll be happy to learn, though. > Hey Mike, I guess my rationale for padding with zeros was the following: I want the output hotspot to match the image coordinates, but I don't want to have matches where the template exceeds the image boundaries. With the match centered on the template-origin, this padding actually makes no difference since you're padding only the higher indices, but with the match centered on the template-center, there would be a difference. Also, there's a (usually-insignificant) computational improvement compared to padding the input. I'm just making this stuff up as I go along, so this might not actually be a desirable use case. -Tony > Best, > Mike -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan at sun.ac.za Mon Mar 26 14:44:21 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Mon, 26 Mar 2012 11:44:21 -0700 Subject: Normalised cross correlation In-Reply-To: References: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> <17457986.119.1332255374275.JavaMail.geo-discussion-forums@vbun14> <32433976.7420.1332259924268.JavaMail.geo-discussion-forums@vbgu10> Message-ID: On Sat, Mar 24, 2012 at 5:09 PM, Tony Yu wrote: > Just to follow up:?This would be my preferred way to pad the image.?Here, > the maximum in the output corresponds to the center of the best > template-match. Just as a point of interest, there should soon be some padding capabilities in numpy: https://github.com/numpy/numpy/pull/198 St?fan From stefan at sun.ac.za Mon Mar 26 15:03:04 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Mon, 26 Mar 2012 12:03:04 -0700 Subject: Normalised cross correlation In-Reply-To: References: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> <17457986.119.1332255374275.JavaMail.geo-discussion-forums@vbun14> <32433976.7420.1332259924268.JavaMail.geo-discussion-forums@vbgu10> Message-ID: Hi Tony On Sat, Mar 24, 2012 at 4:03 PM, Tony Yu wrote: > zero, but round-off errors are causing it to go negative. If that's the > case, then it's an easy fix to check that the argument is positive, but > someone should check my math to make sure the the code matches the equation. I checked the paper vs your code, and the code looks correct. The only thing I didn't check was whether the normalization was done on the correct position in the correlation. > Padding *the input* sounds like a good idea, but I think it should be done > in such a way that the output is (M, N)---i.e. same size as the input image. > I'm not a huge fan of the Matlab output size (but maybe some people expect > this output?). If the user wants to pad the input, they should probably do that themselves beforehand. Half-template matches feel sketchy (and where do you stop: when at least half the template matches?). Also, with the new proposed padding in numpy, this should become a lot easier. St?fan From tsyu80 at gmail.com Mon Mar 26 20:47:10 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Mon, 26 Mar 2012 20:47:10 -0400 Subject: Normalised cross correlation In-Reply-To: References: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> <17457986.119.1332255374275.JavaMail.geo-discussion-forums@vbun14> <32433976.7420.1332259924268.JavaMail.geo-discussion-forums@vbgu10> Message-ID: 2012/3/26 St?fan van der Walt > On Sat, Mar 24, 2012 at 5:09 PM, Tony Yu wrote: > > Just to follow up: This would be my preferred way to pad the image. Here, > > the maximum in the output corresponds to the center of the best > > template-match. > > Just as a point of interest, there should soon be some padding > capabilities in numpy: > > https://github.com/numpy/numpy/pull/198 > > St?fan > This looks like a great new feature. Thanks for the heads-up. -Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From tsyu80 at gmail.com Mon Mar 26 21:36:40 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Mon, 26 Mar 2012 21:36:40 -0400 Subject: Normalised cross correlation In-Reply-To: References: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> <17457986.119.1332255374275.JavaMail.geo-discussion-forums@vbun14> <32433976.7420.1332259924268.JavaMail.geo-discussion-forums@vbgu10> Message-ID: 2012/3/26 St?fan van der Walt > Hi Tony > > On Sat, Mar 24, 2012 at 4:03 PM, Tony Yu wrote: > > zero, but round-off errors are causing it to go negative. If that's the > > case, then it's an easy fix to check that the argument is positive, but > > someone should check my math to make sure the the code matches the > equation. > > I checked the paper vs your code, and the code looks correct. The > only thing I didn't check was whether the normalization was done on > the correct position in the correlation. > Thanks for checking. What do you mean by "correct position in the correlation"? > > > Padding *the input* sounds like a good idea, but I think it should be > done > > in such a way that the output is (M, N)---i.e. same size as the input > image. > > I'm not a huge fan of the Matlab output size (but maybe some people > expect > > this output?). > > If the user wants to pad the input, they should probably do that > themselves beforehand. Half-template matches feel sketchy (and where > do you stop: when at least half the template matches?). Also, with > the new proposed padding in numpy, this should become a lot easier. Hmm, I was under the impression that half-template matches would be appropriately penalized. Say we have a template of a face: If it perfectly matches a patch of an image, the result will have a match value of 1 at that location. Now, if half the face matches perfectly but the rest is garbage, then the result might get a value of 0.5 (I'm not sure what the value would actually be). To me, it doesn't really matter whether the face is half-obstructed by a shadow (but still fully in the image), or if it's half cropped by the image edge; they should both have values around 0.5. Unfortunately, the exact score would depend on what value was used to pad the image (Mike's suggestion of the average seems preferable, but nothing's going to be perfect). I agree that it'd be better for users to take care of the padding themselves, but I think it's a common-enough use-case that we should make it easy to pad with the image average (although turn it off by default). -Tony > > St?fan > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan at sun.ac.za Tue Mar 27 01:04:41 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Mon, 26 Mar 2012 22:04:41 -0700 Subject: Normalised cross correlation In-Reply-To: References: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> <17457986.119.1332255374275.JavaMail.geo-discussion-forums@vbun14> <32433976.7420.1332259924268.JavaMail.geo-discussion-forums@vbgu10> Message-ID: On Mon, Mar 26, 2012 at 6:36 PM, Tony Yu wrote: > Thanks for checking. What do you mean by "correct position in the > correlation"? It looked like you took the result of np.correlate, and then normalized those coefficients. I wasn't sure (didn't verify) whether the normalization was computed for the correct position in the np.correlate result. > Hmm, I was under the impression that half-template matches would be > appropriately penalized. That explanation seems reasonable--such behaviour seems totally sane. St?fan From tsyu80 at gmail.com Tue Mar 27 00:08:22 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Tue, 27 Mar 2012 00:08:22 -0400 Subject: Platform for filters development In-Reply-To: References: Message-ID: On Wed, Mar 21, 2012 at 12:05 PM, Nadav Horesh wrote: > (I think I missed the attachment) > > > Attached here a concept code showing my attempt to produce in improved > (over ndimage.generic_filter) platform for filters development. The code is > very preliminary and needs a lot of extension as well as rewrite. My main > questions are: > > 1. Is there is already a mature package for this purpose? > 2. Is there is need for such a module inside scikits? > > Any comment is welcome. > > Nadav > Hey Nadav, I had some problems building this example. (Actually, I couldn't even unzip it at first.) In case anyone else wants to try this out, I posted a version of your package to my github account with some build modifications. I think the build requires Cython 0.15 (or at least, I think so: I was getting some build errors with 0.14 and upgrading seemed to fix it (although I may have made other changes along the way).) I haven't yet had time to play around with the code, so I don't have anything constructive to say about the code yet. Cheers, -Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan at sun.ac.za Tue Mar 27 18:03:20 2012 From: stefan at sun.ac.za (=?ISO-8859-1?Q?St=E9fan_van_der_Walt?=) Date: Tue, 27 Mar 2012 15:03:20 -0700 Subject: [OT] pass a C callback function to a cythom module via python In-Reply-To: References: Message-ID: Hi Nadav I just had a chat with Dag, a core Cython contributor. He mentioned to me another alternative, which is to encapsulate the callback function in a class: https://github.com/dagss/cython-pydata12/blob/master/examples/oointegrate/integrate.pyx You can import this class from Python, and pass it along as the callback object. There may be some work on improving this functionality in the future, but for now I think that's the cleanest route (and helps us to avoid ctypes!). St?fan On Tue, Mar 20, 2012 at 1:02 AM, Nadav Horesh wrote: > > Can you explain in more details how can I implement it? Any case I am > attaching an scheme that may clarify my intend. Soon I'll post a code > demonstrating the problem. > > ? Thank you, > ???? Nadav, From nadavh.horesh at gmail.com Wed Mar 28 11:25:30 2012 From: nadavh.horesh at gmail.com (Nadav Horesh) Date: Wed, 28 Mar 2012 17:25:30 +0200 Subject: Platform for filters development In-Reply-To: References: Message-ID: Thank you. I am over-busy these days so I'll look at it ot the week-end. Nadav. ?????? 27 ???? 2012 06:08, ??? Tony Yu : > > > On Wed, Mar 21, 2012 at 12:05 PM, Nadav Horesh wrote: > >> (I think I missed the attachment) >> >> >> Attached here a concept code showing my attempt to produce in improved >> (over ndimage.generic_filter) platform for filters development. The code is >> very preliminary and needs a lot of extension as well as rewrite. My main >> questions are: >> >> 1. Is there is already a mature package for this purpose? >> 2. Is there is need for such a module inside scikits? >> >> Any comment is welcome. >> >> Nadav >> > > Hey Nadav, > > I had some problems building this example. (Actually, I couldn't even > unzip it at first.) In case anyone else wants to try this out, I posted a version > of your package to my github > account with some build modifications. I think the build requires Cython > 0.15 (or at least, I think so: I was getting some build errors with 0.14 > and upgrading seemed to fix it (although I may have made other changes > along the way).) > > I haven't yet had time to play around with the code, so I don't have > anything constructive to say about the code yet. > > Cheers, > -Tony > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nadavh.horesh at gmail.com Wed Mar 28 11:39:25 2012 From: nadavh.horesh at gmail.com (Nadav Horesh) Date: Wed, 28 Mar 2012 17:39:25 +0200 Subject: [OT] pass a C callback function to a cythom module via python In-Reply-To: References: Message-ID: Thank you. I looked at the example and I need some time to digest it. I'll take a loser look over the weekend. Nadav. ?????? 28 ???? 2012 00:03, ??? St?fan van der Walt : > Hi Nadav > > I just had a chat with Dag, a core Cython contributor. He mentioned > to me another alternative, which is to encapsulate the callback > function in a class: > > > https://github.com/dagss/cython-pydata12/blob/master/examples/oointegrate/integrate.pyx > > You can import this class from Python, and pass it along as the > callback object. There may be some work on improving this > functionality in the future, but for now I think that's the cleanest > route (and helps us to avoid ctypes!). > > St?fan > > > On Tue, Mar 20, 2012 at 1:02 AM, Nadav Horesh > wrote: > > > > Can you explain in more details how can I implement it? Any case I am > > attaching an scheme that may clarify my intend. Soon I'll post a code > > demonstrating the problem. > > > > Thank you, > > Nadav, > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tsyu80 at gmail.com Fri Mar 30 09:55:20 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Fri, 30 Mar 2012 09:55:20 -0400 Subject: Normalised cross correlation In-Reply-To: References: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> <17457986.119.1332255374275.JavaMail.geo-discussion-forums@vbun14> <32433976.7420.1332259924268.JavaMail.geo-discussion-forums@vbgu10> Message-ID: 2012/3/27 St?fan van der Walt > On Mon, Mar 26, 2012 at 6:36 PM, Tony Yu wrote: > > Thanks for checking. What do you mean by "correct position in the > > correlation"? > > It looked like you took the result of np.correlate, and then > normalized those coefficients. I wasn't sure (didn't verify) whether > the normalization was computed for the correct position in the > np.correlate result. > Yes, you're correct---not sure why I was confused by before. > > Hmm, I was under the impression that half-template matches would be > > appropriately penalized. > > That explanation seems reasonable--such behaviour seems totally sane. > > St?fan > I added some commits to the template PR. I changed the interface: `pad_output` is replaced by `pad_input`, which defaults to False. When True, the input image is padded with a border that is half the template dimensions on each side, and the padding value is the image mean, as Mike suggested. Note that this function still does not produce results similar to Matlab's; no one made the case for it, so I left it out (and as Stefan pointed out: the user can manually pad the input if such a result is desired). Are people happy with this interface? I added a simpler example plotto the gallery, but there should probably only be a single example. Personally, I prefer the simpler plot. (The more complex plot, however, is more "realistic" since it has noise and uses a peak detector.) Any objections to removing the complex plot? -Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From tsyu80 at gmail.com Fri Mar 30 10:27:15 2012 From: tsyu80 at gmail.com (Tony Yu) Date: Fri, 30 Mar 2012 10:27:15 -0400 Subject: Normalised cross correlation In-Reply-To: References: <22918232.970.1331054197610.JavaMail.geo-discussion-forums@vbiz13> <17457986.119.1332255374275.JavaMail.geo-discussion-forums@vbun14> <32433976.7420.1332259924268.JavaMail.geo-discussion-forums@vbgu10> Message-ID: On Fri, Mar 30, 2012 at 9:55 AM, Tony Yu wrote: > > > 2012/3/27 St?fan van der Walt > >> On Mon, Mar 26, 2012 at 6:36 PM, Tony Yu wrote: >> > Thanks for checking. What do you mean by "correct position in the >> > correlation"? >> >> It looked like you took the result of np.correlate, and then >> normalized those coefficients. I wasn't sure (didn't verify) whether >> the normalization was computed for the correct position in the >> np.correlate result. >> > > Yes, you're correct---not sure why I was confused by before. > > >> > Hmm, I was under the impression that half-template matches would be >> > appropriately penalized. >> >> That explanation seems reasonable--such behaviour seems totally sane. >> >> St?fan >> > > > I added some commits to the template PR. > I changed the interface: `pad_output` is replaced by `pad_input`, which > defaults to False. When True, the input image is padded with a border that > is half the template dimensions on each side, and the padding value is the > image mean, as Mike suggested. Note that this function still does not > produce results similar to Matlab's; no one made the case for it, so I left > it out (and as Stefan pointed out: the user can manually pad the input if > such a result is desired). Are people happy with this interface? > > I added a simpler example plotto the gallery, but there should probably only be a single example. > Personally, I prefer the simpler plot. (The more complex plot, > however, is more "realistic" since it has noise and uses a peak detector.) > Any objections to removing the complex plot? > > -Tony > Actually, I decided I like this third examplebetter. (I'm just trying to see how many commits I can get into this PR before it's closed.) -Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: