From ioannisgkan259 at gmail.com Sat Oct 1 15:33:28 2016 From: ioannisgkan259 at gmail.com (ioannisgkan259 at gmail.com) Date: Sat, 1 Oct 2016 12:33:28 -0700 (PDT) Subject: GLCM calculation using scikit-learn. Error when using greycomatrix In-Reply-To: <3c6b3c19-f3d8-49c6-9ffa-3942fc08ef55@googlegroups.com> References: <520f5f2b-4750-4b56-a40b-28b938b750d8@googlegroups.com> <3c6b3c19-f3d8-49c6-9ffa-3942fc08ef55@googlegroups.com> Message-ID: <978af8fd-0dfa-47ca-9e16-4a4ccccb4bc3@googlegroups.com> Hello Juan, I want to thank you for your quick reply to my question the last time and i do not want to bother you with my questions. I always try to solve my problems before posting my question here. Sometime, i just cannot figure out how to fix the error. What i want to do is to create a GLCM image using different grey levels (8-bit, 16-bit and 32-bit) and compare the results. The type of the image i am using is a float32. I used the '' rescale intensity'' as you suggested, i converted the image to 8-bit and it worked. When i try to rescale the image in 16-bit and 32-bit for some reason it doesn't work. i get the error: AssertionError Traceback (most recent call last) in () 22 23 for j in xrange(img.shape[1] ):---> 24 glcm = greycomatrix(rescale, [1], [0], symmetric = True, normed = True ) 25 26 testraster1[i,j] = greycoprops(glcm, 'contrast') C:\Anaconda2\lib\site-packages\skimage\feature\texture.pyc in greycomatrix(image, distances, angles, levels, symmetric, normed) 101 image = np.ascontiguousarray(image) 102 assert image.min() >= 0--> 103 assert image.max() < levels 104 image = image.astype(np.uint8) 105 distances = np.ascontiguousarray(distances, dtype=np.float64) AssertionError: It seems that i am allowed only to use an 8-bit image for the GLCM calculation. So, does this code in scikit-image work only for 8-bit images? is there another way to solve my problem? I will keep trying to find a solution but if you have an idea on how to solve this problem, please tell me Thank you in advance Ioannis On Monday, 19 September 2016 15:41:07 UTC+1, ioannis... at gmail.com wrote: > > Thank you very much Juan for your quick reply. > That was helpful :) > > Ioannis > > On Monday, 19 September 2016 01:03:45 UTC+1, Juan Nunez-Iglesias wrote: >> >> Hi Ioannis, >> >> Unfortunately the levels keyword is used as a hint to the function about >> the number of levels when the image is uint16, because the possible number >> of levels is huge. But if you want to convert the image to those levels, >> you have to do it manually. I suggest you look at the "rescale_intensity" >> function: >> >> >> http://scikit-image.org/docs/dev/api/skimage.exposure.html#skimage.exposure.rescale_intensity >> >> and process your image before passing it to the glcm function. >> >> I hope this helps! Keep pinging if you have more questions. =) >> >> Juan. >> >> On Sun, Sep 18, 2016 at 4:57 AM, wrote: >> >>> Hello everyone, >>> >>> I am using a SAR image (16-bit) and trying to implement GLCM algorithm >>> using sciki-learn. When trying to calculate the GLCM using greycomatrix i >>> get the following error: >>> >>> assert image.max() < levels. It says that the maximum value of the image intensity must be less than the number of grey levels. >>> Because the SAR image is really big, i want to reduce the calculation time by reducing the levels to 8. >>> Even if i remove the parameter 'level=8' when using greycomatrix, still gives me the same error >>> >>> My code is the following: >>> >>> from skimage.feature import greycomatrix, greycoprops >>> import numpy as np >>> from skimage import data >>> import rasterio >>> >>> path = 'C:\Users\GLCM_implementation\glasgow.tif' >>> >>> with rasterio.open(path, 'r') as src: >>> import_file = src.read() >>> img = import_file[0,:,:] #i need only the two dimentions (height, width) >>> print img.shape >>> >>> >>> #calculate the GLCM specifying the distance, direction(4 directions) and number of grey levels >>> GLCM = greycomatrix(img, [1], [0, np.pi/4, np.pi/2, 3*np.pi/4],levels=8, symmetric=False, normed=True) >>> #list(GLCM[:,:,0,2]) >>> >>> >>> #Calculate texture statistics >>> contrast = greycoprops(GLCM, 'contrast') >>> >>> dissimilarity = greycoprops(GLCM, 'dissimilarity') >>> >>> homogeneity = greycoprops(GLCM, 'homogeneity') >>> >>> energy = greycoprops(GLCM, 'energy') >>> >>> correlation = greycoprops(GLCM, 'correlation') >>> >>> ASM = greycoprops(GLCM, 'ASM') >>> >>> >>> >>> Error message: >>> >>> 101 image = np.ascontiguousarray(image) 102 assert image.min() >= 0--> 103 assert image.max() < levels 104 image = image.astype(np.uint8) 105 distances = np.ascontiguousarray(distances, dtype=np.float64) >>> AssertionError: >>> >>> >>> I would appreciate any help. >>> Thank you in advance >>> >>> Ioannis >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "scikit-image" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to scikit-image... at googlegroups.com. >>> To post to this group, send email to scikit... at googlegroups.com. >>> To view this discussion on the web, visit >>> https://groups.google.com/d/msgid/scikit-image/520f5f2b-4750-4b56-a40b-28b938b750d8%40googlegroups.com >>> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From ioannisgkan259 at gmail.com Sun Oct 2 04:40:42 2016 From: ioannisgkan259 at gmail.com (ioannisgkan259 at gmail.com) Date: Sun, 2 Oct 2016 01:40:42 -0700 (PDT) Subject: GLCM calculation using scikit-learn. Error when using greycomatrix In-Reply-To: References: <520f5f2b-4750-4b56-a40b-28b938b750d8@googlegroups.com> <3c6b3c19-f3d8-49c6-9ffa-3942fc08ef55@googlegroups.com> <978af8fd-0dfa-47ca-9e16-4a4ccccb4bc3@googlegroups.com> Message-ID: <98f6e5bf-7b1f-4580-835a-dda249a6dd64@googlegroups.com> Thank you very much for your quick reply, i appreciate it. It seems you always have a good answer to give me. Ioannis On Sunday, 2 October 2016 03:41:10 UTC+1, Juan Nunez-Iglesias wrote: > > Hi Ioannis, > > So, the size of the GLCM for a 32-bit image that uses all possible > intensity levels is 2**64, way too big to fit in memory. The key is: > > - rescale the image to be in [0, max_value-1] (for some integer max_value > that you determine) > - call greycomatrix on this rescaled image with the keyword argument > `levels=max_value`. > > That should work. However, note that the size of the matrix will be `4 * > max_value ** 2` or `8 * max_value ** 2`, and multiple temporary matrices of > the same size might be created for processing. So, you need to make sure > that your computer has enough memory for that. Typically, this will require > your image to have much fewer levels than even 16-bit. > > Additionally, I think this feature requires the development version of > scikit-image. You can install that with "pip install git+ > https://github.com/scikit-image/scikit-image.git". (I think that's the > command anyway...) > > Juan. > > On Sun, Oct 2, 2016 at 6:33 AM, > > wrote: > >> Hello Juan, >> >> I want to thank you for your quick reply to my question the last time and >> i do not want to bother you with my questions. I always try to solve my >> problems before posting my question here. Sometime, i just cannot figure >> out how to fix the error. >> >> What i want to do is to create a GLCM image using different grey levels >> (8-bit, 16-bit and 32-bit) and compare the results. The type of the image i >> am using is a float32. I used the '' rescale intensity'' as you suggested, >> i converted the image to 8-bit and it worked. When i try to rescale the >> image in 16-bit and 32-bit for some reason it doesn't work. >> >> i get the error: >> >> >> AssertionError Traceback (most recent call last) in () 22 23 for j in xrange(img.shape[1] ):---> 24 glcm = greycomatrix(rescale, [1], [0], symmetric = True, normed = True ) 25 26 testraster1[i,j] = greycoprops(glcm, 'contrast') >> C:\Anaconda2\lib\site-packages\skimage\feature\texture.pyc in greycomatrix(image, distances, angles, levels, symmetric, normed) 101 image = np.ascontiguousarray(image) 102 assert image.min() >= 0--> 103 assert image.max() < levels 104 image = image.astype(np.uint8) 105 distances = np.ascontiguousarray(distances, dtype=np.float64) >> AssertionError: >> >> It seems that i am allowed only to use an 8-bit image for the GLCM calculation. >> So, does this code in scikit-image work only for 8-bit images? is there another way to solve my problem? >> I will keep trying to find a solution but if you have an idea on how to solve this problem, please tell me >> >> Thank you in advance >> Ioannis >> >> >> >> On Monday, 19 September 2016 15:41:07 UTC+1, ioannis... at gmail.com wrote: >>> >>> Thank you very much Juan for your quick reply. >>> That was helpful :) >>> >>> Ioannis >>> >>> On Monday, 19 September 2016 01:03:45 UTC+1, Juan Nunez-Iglesias wrote: >>>> >>>> Hi Ioannis, >>>> >>>> Unfortunately the levels keyword is used as a hint to the function >>>> about the number of levels when the image is uint16, because the possible >>>> number of levels is huge. But if you want to convert the image to those >>>> levels, you have to do it manually. I suggest you look at the >>>> "rescale_intensity" function: >>>> >>>> >>>> http://scikit-image.org/docs/dev/api/skimage.exposure.html#skimage.exposure.rescale_intensity >>>> >>>> and process your image before passing it to the glcm function. >>>> >>>> I hope this helps! Keep pinging if you have more questions. =) >>>> >>>> Juan. >>>> >>>> On Sun, Sep 18, 2016 at 4:57 AM, wrote: >>>> >>>>> Hello everyone, >>>>> >>>>> I am using a SAR image (16-bit) and trying to implement GLCM algorithm >>>>> using sciki-learn. When trying to calculate the GLCM using greycomatrix i >>>>> get the following error: >>>>> >>>>> assert image.max() < levels. It says that the maximum value of the image intensity must be less than the number of grey levels. >>>>> Because the SAR image is really big, i want to reduce the calculation time by reducing the levels to 8. >>>>> Even if i remove the parameter 'level=8' when using greycomatrix, still gives me the same error >>>>> >>>>> My code is the following: >>>>> >>>>> from skimage.feature import greycomatrix, greycoprops >>>>> import numpy as np >>>>> from skimage import data >>>>> import rasterio >>>>> >>>>> path = 'C:\Users\GLCM_implementation\glasgow.tif' >>>>> >>>>> with rasterio.open(path, 'r') as src: >>>>> import_file = src.read() >>>>> img = import_file[0,:,:] #i need only the two dimentions (height, width) >>>>> print img.shape >>>>> >>>>> >>>>> #calculate the GLCM specifying the distance, direction(4 directions) and number of grey levels >>>>> GLCM = greycomatrix(img, [1], [0, np.pi/4, np.pi/2, 3*np.pi/4],levels=8, symmetric=False, normed=True) >>>>> #list(GLCM[:,:,0,2]) >>>>> >>>>> >>>>> #Calculate texture statistics >>>>> contrast = greycoprops(GLCM, 'contrast') >>>>> >>>>> dissimilarity = greycoprops(GLCM, 'dissimilarity') >>>>> >>>>> homogeneity = greycoprops(GLCM, 'homogeneity') >>>>> >>>>> energy = greycoprops(GLCM, 'energy') >>>>> >>>>> correlation = greycoprops(GLCM, 'correlation') >>>>> >>>>> ASM = greycoprops(GLCM, 'ASM') >>>>> >>>>> >>>>> >>>>> Error message: >>>>> >>>>> 101 image = np.ascontiguousarray(image) 102 assert image.min() >= 0--> 103 assert image.max() < levels 104 image = image.astype(np.uint8) 105 distances = np.ascontiguousarray(distances, dtype=np.float64) >>>>> AssertionError: >>>>> >>>>> >>>>> I would appreciate any help. >>>>> Thank you in advance >>>>> >>>>> Ioannis >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "scikit-image" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to scikit-image... at googlegroups.com. >>>>> To post to this group, send email to scikit... at googlegroups.com. >>>>> To view this discussion on the web, visit >>>>> https://groups.google.com/d/msgid/scikit-image/520f5f2b-4750-4b56-a40b-28b938b750d8%40googlegroups.com >>>>> >>>>> . >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> -- >> You received this message because you are subscribed to the Google Groups >> "scikit-image" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to scikit-image... at googlegroups.com . >> To post to this group, send email to scikit... at googlegroups.com >> . >> To view this discussion on the web, visit >> https://groups.google.com/d/msgid/scikit-image/978af8fd-0dfa-47ca-9e16-4a4ccccb4bc3%40googlegroups.com >> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefanv at berkeley.edu Sun Oct 2 14:20:13 2016 From: stefanv at berkeley.edu (Stefan van der Walt) Date: Sun, 02 Oct 2016 11:20:13 -0700 Subject: Line Detection In-Reply-To: <05077510-f712-483b-a881-590bdff9f5e1@googlegroups.com> References: <05077510-f712-483b-a881-590bdff9f5e1@googlegroups.com> Message-ID: <1475432413.2055040.743522033.40B61AE2@webmail.messagingengine.com> On Thu, Sep 29, 2016, at 03:30, KRISHNAMOOORTHY P wrote: > How to get oblique (+45 and 135 degree) of images using scikit-image > or with any other packages? The question is somewhat opaque. Would you like to rotate an image, as with skimage.transform.rotate? St?fan -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefanv at berkeley.edu Sun Oct 2 14:42:22 2016 From: stefanv at berkeley.edu (Stefan van der Walt) Date: Sun, 02 Oct 2016 11:42:22 -0700 Subject: New mailing list Message-ID: <1475433742.2058948.743533881.2F3C6364@webmail.messagingengine.com> Hi everyone I have transitioned our mailing list over to its new home at https://mail.python.org/mailman/listinfo/scikit-image The new mailing list address is: scikit-image at python.org Your subscription has been transferred, and you need to take no further action. Best regards St?fan From jni.soma at gmail.com Sat Oct 1 22:40:44 2016 From: jni.soma at gmail.com (Juan Nunez-Iglesias) Date: Sun, 2 Oct 2016 13:40:44 +1100 Subject: GLCM calculation using scikit-learn. Error when using greycomatrix In-Reply-To: <978af8fd-0dfa-47ca-9e16-4a4ccccb4bc3@googlegroups.com> References: <520f5f2b-4750-4b56-a40b-28b938b750d8@googlegroups.com> <3c6b3c19-f3d8-49c6-9ffa-3942fc08ef55@googlegroups.com> <978af8fd-0dfa-47ca-9e16-4a4ccccb4bc3@googlegroups.com> Message-ID: Hi Ioannis, So, the size of the GLCM for a 32-bit image that uses all possible intensity levels is 2**64, way too big to fit in memory. The key is: - rescale the image to be in [0, max_value-1] (for some integer max_value that you determine) - call greycomatrix on this rescaled image with the keyword argument `levels=max_value`. That should work. However, note that the size of the matrix will be `4 * max_value ** 2` or `8 * max_value ** 2`, and multiple temporary matrices of the same size might be created for processing. So, you need to make sure that your computer has enough memory for that. Typically, this will require your image to have much fewer levels than even 16-bit. Additionally, I think this feature requires the development version of scikit-image. You can install that with "pip install git+ https://github.com/scikit-image/scikit-image.git". (I think that's the command anyway...) Juan. On Sun, Oct 2, 2016 at 6:33 AM, wrote: > Hello Juan, > > I want to thank you for your quick reply to my question the last time and > i do not want to bother you with my questions. I always try to solve my > problems before posting my question here. Sometime, i just cannot figure > out how to fix the error. > > What i want to do is to create a GLCM image using different grey levels > (8-bit, 16-bit and 32-bit) and compare the results. The type of the image i > am using is a float32. I used the '' rescale intensity'' as you suggested, > i converted the image to 8-bit and it worked. When i try to rescale the > image in 16-bit and 32-bit for some reason it doesn't work. > > i get the error: > > > AssertionError Traceback (most recent call last) in () 22 23 for j in xrange(img.shape[1] ):---> 24 glcm = greycomatrix(rescale, [1], [0], symmetric = True, normed = True ) 25 26 testraster1[i,j] = greycoprops(glcm, 'contrast') > C:\Anaconda2\lib\site-packages\skimage\feature\texture.pyc in greycomatrix(image, distances, angles, levels, symmetric, normed) 101 image = np.ascontiguousarray(image) 102 assert image.min() >= 0--> 103 assert image.max() < levels 104 image = image.astype(np.uint8) 105 distances = np.ascontiguousarray(distances, dtype=np.float64) > AssertionError: > > It seems that i am allowed only to use an 8-bit image for the GLCM calculation. > So, does this code in scikit-image work only for 8-bit images? is there another way to solve my problem? > I will keep trying to find a solution but if you have an idea on how to solve this problem, please tell me > > Thank you in advance > Ioannis > > > > On Monday, 19 September 2016 15:41:07 UTC+1, ioannis... at gmail.com wrote: >> >> Thank you very much Juan for your quick reply. >> That was helpful :) >> >> Ioannis >> >> On Monday, 19 September 2016 01:03:45 UTC+1, Juan Nunez-Iglesias wrote: >>> >>> Hi Ioannis, >>> >>> Unfortunately the levels keyword is used as a hint to the function about >>> the number of levels when the image is uint16, because the possible number >>> of levels is huge. But if you want to convert the image to those levels, >>> you have to do it manually. I suggest you look at the "rescale_intensity" >>> function: >>> >>> http://scikit-image.org/docs/dev/api/skimage.exposure.html#s >>> kimage.exposure.rescale_intensity >>> >>> and process your image before passing it to the glcm function. >>> >>> I hope this helps! Keep pinging if you have more questions. =) >>> >>> Juan. >>> >>> On Sun, Sep 18, 2016 at 4:57 AM, wrote: >>> >>>> Hello everyone, >>>> >>>> I am using a SAR image (16-bit) and trying to implement GLCM algorithm >>>> using sciki-learn. When trying to calculate the GLCM using greycomatrix i >>>> get the following error: >>>> >>>> assert image.max() < levels. It says that the maximum value of the image intensity must be less than the number of grey levels. >>>> Because the SAR image is really big, i want to reduce the calculation time by reducing the levels to 8. >>>> Even if i remove the parameter 'level=8' when using greycomatrix, still gives me the same error >>>> >>>> My code is the following: >>>> >>>> from skimage.feature import greycomatrix, greycoprops >>>> import numpy as np >>>> from skimage import data >>>> import rasterio >>>> >>>> path = 'C:\Users\GLCM_implementation\glasgow.tif' >>>> >>>> with rasterio.open(path, 'r') as src: >>>> import_file = src.read() >>>> img = import_file[0,:,:] #i need only the two dimentions (height, width) >>>> print img.shape >>>> >>>> >>>> #calculate the GLCM specifying the distance, direction(4 directions) and number of grey levels >>>> GLCM = greycomatrix(img, [1], [0, np.pi/4, np.pi/2, 3*np.pi/4],levels=8, symmetric=False, normed=True) >>>> #list(GLCM[:,:,0,2]) >>>> >>>> >>>> #Calculate texture statistics >>>> contrast = greycoprops(GLCM, 'contrast') >>>> >>>> dissimilarity = greycoprops(GLCM, 'dissimilarity') >>>> >>>> homogeneity = greycoprops(GLCM, 'homogeneity') >>>> >>>> energy = greycoprops(GLCM, 'energy') >>>> >>>> correlation = greycoprops(GLCM, 'correlation') >>>> >>>> ASM = greycoprops(GLCM, 'ASM') >>>> >>>> >>>> >>>> Error message: >>>> >>>> 101 image = np.ascontiguousarray(image) 102 assert image.min() >= 0--> 103 assert image.max() < levels 104 image = image.astype(np.uint8) 105 distances = np.ascontiguousarray(distances, dtype=np.float64) >>>> AssertionError: >>>> >>>> >>>> I would appreciate any help. >>>> Thank you in advance >>>> >>>> Ioannis >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "scikit-image" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to scikit-image... at googlegroups.com. >>>> To post to this group, send email to scikit... at googlegroups.com. >>>> To view this discussion on the web, visit >>>> https://groups.google.com/d/msgid/scikit-image/520f5f2b-4750 >>>> -4b56-a40b-28b938b750d8%40googlegroups.com >>>> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- > You received this message because you are subscribed to the Google Groups > "scikit-image" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to scikit-image+unsubscribe at googlegroups.com. > To post to this group, send email to scikit-image at googlegroups.com. > To view this discussion on the web, visit https://groups.google.com/d/ > msgid/scikit-image/978af8fd-0dfa-47ca-9e16-4a4ccccb4bc3%40googlegroups.com > > . > > For more options, visit https://groups.google.com/d/optout. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jni.soma at gmail.com Sat Oct 1 22:47:44 2016 From: jni.soma at gmail.com (Juan Nunez-Iglesias) Date: Sun, 2 Oct 2016 13:47:44 +1100 Subject: neighbors contour length In-Reply-To: <191cefe6-7274-45f7-b266-41bb92d64428@googlegroups.com> References: <191cefe6-7274-45f7-b266-41bb92d64428@googlegroups.com> Message-ID: Hi Jaime, Sorry, it seems your message got lost in our flooded inboxes... What does your source image look like? If the objects are segmented into different labels, that is, you have an image where all the pixels of object 1 have value 1, all those of object 2 have value 2, etc., then you can build a *region adjacency graph*, or RAG, with the right values to get what you need. This function in scikit-image master gets you the contour lengths between different objects, from which it should be easy to get the information you want: https://github.com/scikit-image/scikit-image/blob/master/skimage/future/graph/rag.py#L359 By looking at the source code you might get even simpler code for your problem, because you just need the `count_matrix` sparse matrix. It should be super-fast to generate and compute the values you need. Juan. On Thu, Sep 15, 2016 at 7:29 AM, Jaime Lopez Carvajal wrote: > Hi, > > I would like to know if someone could help or suggest any idea how to do > this: > > First, I am trying to know how many neighbors (objects) one particular > object have using its contour. > Second, I need to extract the length of each shared contour with every > neighbor, > Third, calculate their respective percentage. > > The last step is the easiest, but I dont know how to get the first and > second steps. > > Example using attached image: > > Object of interest: red object > Neighbors: three neighbors with three shared contours (yellow, green and > blue). > Total length contour = lengh(yellow) + lengh(yellow) + lengh(yellow) > > Any suggestion how can I get this? > > Thanks in advance, Jaime > > -- > You received this message because you are subscribed to the Google Groups > "scikit-image" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to scikit-image+unsubscribe at googlegroups.com. > To post to this group, send email to scikit-image at googlegroups.com. > To view this discussion on the web, visit https://groups.google.com/d/ > msgid/scikit-image/191cefe6-7274-45f7-b266-41bb92d64428%40googlegroups.com > > . > For more options, visit https://groups.google.com/d/optout. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jsch at demuc.de Sun Oct 2 14:47:05 2016 From: jsch at demuc.de (=?utf-8?Q?Johannes_Sch=C3=B6nberger?=) Date: Sun, 2 Oct 2016 20:47:05 +0200 Subject: New mailing list In-Reply-To: <1475433742.2058948.743533881.2F3C6364@webmail.messagingengine.com> References: <1475433742.2058948.743533881.2F3C6364@webmail.messagingengine.com> Message-ID: Great and thanks! Johannes > On Oct 2, 2016, at 8:42 PM, Stefan van der Walt wrote: > > Hi everyone > > I have transitioned our mailing list over to its new home at > > https://mail.python.org/mailman/listinfo/scikit-image > > The new mailing list address is: scikit-image at python.org > > Your subscription has been transferred, and you need to take no further > action. > > Best regards > St?fan > > -- > You received this message because you are subscribed to the Google Groups "scikit-image" group. > To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image+unsubscribe at googlegroups.com. > To post to this group, send an email to scikit-image at googlegroups.com. > To view this discussion on the web, visit https://groups.google.com/d/msgid/scikit-image/1475433742.2058948.743533881.2F3C6364%40webmail.messagingengine.com. > For more options, visit https://groups.google.com/d/optout. From jalopcar at gmail.com Mon Oct 3 12:11:46 2016 From: jalopcar at gmail.com (Jaime Lopez Carvajal) Date: Mon, 3 Oct 2016 09:11:46 -0700 (PDT) Subject: neighbors contour length In-Reply-To: References: <191cefe6-7274-45f7-b266-41bb92d64428@googlegroups.com> Message-ID: Hi Juan, Thank you for suggestion, I am going to take a look, but maybe I need a different approach because the contour (list) of every object in image, which were extracted after an image segmentation process. So, I would like to know if there is a way to compare contours (comparing lists) between objects to find shared coordinates, but I think this is not possible because I have the inner contours of every object, so I will not find any coordinates coincidence between pair of objects. I hope this make my issue clearer. Any other idea? Thanks, Jaime On Saturday, October 1, 2016 at 9:48:07 PM UTC-5, Juan Nunez-Iglesias wrote: > > Hi Jaime, > > Sorry, it seems your message got lost in our flooded inboxes... > > What does your source image look like? If the objects are segmented into > different labels, that is, you have an image where all the pixels of object > 1 have value 1, all those of object 2 have value 2, etc., then you can > build a *region adjacency graph*, or RAG, with the right values to get what > you need. This function in scikit-image master gets you the contour lengths > between different objects, from which it should be easy to get the > information you want: > > > https://github.com/scikit-image/scikit-image/blob/master/skimage/future/graph/rag.py#L359 > > By looking at the source code you might get even simpler code for your > problem, because you just need the `count_matrix` sparse matrix. It should > be super-fast to generate and compute the values you need. > > Juan. > > On Thu, Sep 15, 2016 at 7:29 AM, Jaime Lopez Carvajal > wrote: > >> Hi, >> >> I would like to know if someone could help or suggest any idea how to do >> this: >> >> First, I am trying to know how many neighbors (objects) one particular >> object have using its contour. >> Second, I need to extract the length of each shared contour with every >> neighbor, >> Third, calculate their respective percentage. >> >> The last step is the easiest, but I dont know how to get the first and >> second steps. >> >> Example using attached image: >> >> Object of interest: red object >> Neighbors: three neighbors with three shared contours (yellow, green and >> blue). >> Total length contour = lengh(yellow) + lengh(yellow) + lengh(yellow) >> >> Any suggestion how can I get this? >> >> Thanks in advance, Jaime >> >> -- >> You received this message because you are subscribed to the Google Groups >> "scikit-image" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to scikit-image... at googlegroups.com . >> To post to this group, send email to scikit... at googlegroups.com >> . >> To view this discussion on the web, visit >> https://groups.google.com/d/msgid/scikit-image/191cefe6-7274-45f7-b266-41bb92d64428%40googlegroups.com >> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From xavi_barrull at hotmail.com Tue Oct 4 07:11:44 2016 From: xavi_barrull at hotmail.com (xavi barrull) Date: Tue, 4 Oct 2016 11:11:44 +0000 Subject: [scikit-image] GUI Python Image Processing Message-ID: Hi, I have a question about scikit image. I make a GUI in python to processing image, but I will change the gaussian Filter in opencv to scikit image, I use this function: def gaussFilter(self): targetTemp = sk.io.imread(self.original_path)# llegir imatge targetTemp a la ruta original targetTemp = sk.filters.gaussian(targetTemp, sigma=0, mode='reflect', cval=0, multichannel=False) #targetTemp = cv2.GaussianBlur(targetTemp,(sigmaX, sigmaY), 0) cv2.imwrite(self.target_path,targetTemp) self.updateTargetImage() But, when I press the button of gaussian filter the image to update becomes black, what is the problem? I need a solution for this! My code show bellow: import Tkinter as tk import numpy as np import tkFileDialog import tkMessageBox import shutil import os from PIL import Image, ImageTk, ImageFilter import cv2 import colormaps import skimage as sk import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap from matplotlib.figure import Figure from skimage import filters from skimage import io from skimage.morphology import disk from skimage.filters.rank import median from skimage.filters import gaussian from skimage.morphology import watershed from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg class App(tk.Frame): size = 500, 700 # get past scale value past=1 # inicialitzar app def __init__(self, master): tk.Frame.__init__(self, master) self.grid(row=0) self.columnconfigure(0, weight=1) self.rowconfigure(0, weight=1) master.geometry("1024x768") self.generateMenu(master) # Generacio Menu def generateMenu(self, master): # crear barra menu, dins de la llibreria TKinter (tk.) self.menuBar=tk.Menu(self) # creacio arxiu dins de la barra de menu self.fileMenu=tk.Menu(self.menuBar, tearoff=0) # crear commandes obrir, guardar i tancar, l'estat de guardar esta desactivat mentre no s'obri una imatge self.fileMenu.add_command(label="Open", command=self.open) self.fileMenu.add_command(label="Save", command=self.save, state="disabled") self.fileMenu.add_command(label="Close", command=self.exit) # Afegim tot aixo la barra de menu en cascada self.menuBar.add_cascade(label="File", menu=self.fileMenu) # Crear menu de process self.processMenu=tk.Menu(self.menuBar, tearoff=0) # crear submenu de processs/filter self.processFilterSubMenu = tk.Menu(self.processMenu, tearoff=0) self.processFilterSubMenu.add_command(label="Gaussian Filter", command=self.gaussFilter, state="disabled") self.processFilterSubMenu.add_command(label="Median Filter", command=self.medianFilter, state="disabled") self.processMenu.add_cascade(label="Process/Filter", menu=self.processFilterSubMenu, underline=0) # crear submenu segmentacio self.segmentationSubMenu = tk.Menu(self.processMenu, tearoff=0) self.segmentationSubMenu.add_command(label="Watershed", command=self.watershed, state="disabled") self.segmentationSubMenu.add_command(label="Random walker", command=self.randomwalker, state="disabled") self.processMenu.add_cascade(label="Segmentation", menu=self.segmentationSubMenu, underline=0) # crear submenu edgeDetection self.edgeDetectionSubMenu = tk.Menu(self.processMenu, tearoff=0) self.edgeDetectionSubMenu.add_command(label="Sobel", command=self.sobel, state="disabled") self.edgeDetectionSubMenu.add_command(label="Laplacian", command=self.laplacian, state="disabled") self.edgeDetectionSubMenu.add_command(label="Canny", command=self.canny, state="disabled") self.processMenu.add_cascade(label="Edge Detection", menu=self.edgeDetectionSubMenu, underline=0) # crear submenu change colormap self.colorMapSubMenu = tk.Menu(self.processMenu, tearoff=0) self.colorMapSubMenu.add_command(label="None", command=self.none, state="disabled") self.colorMapSubMenu.add_command(label="Plasma", command=self.plasma, state="disabled") self.colorMapSubMenu.add_command(label="Inferno", command=self.inferno, state="disabled") self.colorMapSubMenu.add_command(label="Viridis", command=self.viridis, state="disabled") self.processMenu.add_cascade(label="Change Colormap", menu=self.colorMapSubMenu, underline=0) self.menuBar.add_cascade(label="Process", menu=self.processMenu) master.config(menu=self.menuBar) # No colorMap def none(self): targetTemp = cv2.imread(self.original_path) cv2.imwrite(self.target_path,targetTemp)# guarda imatge targetTemp i a la ruta de desti self.updateTargetImage() # Plasma colorMap def plasma(self): plt.clf()#esborra imatge targetTemp targetTemp = cv2.imread(self.original_path) # llegir ruta original (carpeta on es troba arxiu py) targetTemp = np.fliplr(targetTemp[:,:,0]) # gir esquerra a dreta imatge original, segons 3r valor matriu, varia tonalitat plasma = ListedColormap(colormaps._plasma_data, name='plasma') plt.axis('off')#desactiva eixos a la imatge plt.register_cmap(name='plasma', cmap=plasma) # registrar colormap nou i aplicar-lo imgplot = plt.imshow(targetTemp)#mostrar imatge allotjada a targetTemp imgplot.set_cmap(plasma)#aplicar colormap imgplot.figure.savefig(self.target_path)#guardar imatge com a figura a la ruta de desti self.updateTargetImage() #actualitzar la imatge (amb aplicacio del colormap) def viridis(self): plt.clf() #esborra imatge targetTemp targetTemp = cv2.imread(self.original_path) targetTemp = np.fliplr(targetTemp[:,:,0]) viridis = ListedColormap(colormaps._viridis_data, name='viridis') plt.axis('off') plt.register_cmap(name='viridis', cmap=viridis) imgplot = plt.imshow(targetTemp) imgplot.set_cmap(viridis) imgplot.figure.savefig(self.target_path) # update target screen self.updateTargetImage() def inferno(self): plt.clf() targetTemp = cv2.imread(self.original_path) targetTemp = np.fliplr(targetTemp[:,:,0]) inferno = ListedColormap(colormaps._inferno_data, name='inferno') plt.axis('off') plt.register_cmap(name='inferno', cmap=inferno) imgplot = plt.imshow(targetTemp) imgplot.set_cmap(inferno) imgplot.figure.savefig(self.target_path) self.updateTargetImage() # funcio per obrir arxius def open(self): # obrir arxiu des del quadre de dialeg self.original_path = tkFileDialog.askopenfilename(filetypes=[("Image Files","*.jpg;*.jpeg;*.png;*.gif")]) if self.original_path!="": # si es selecciona un arxiu, s'activen totes les comandes del menu self.fileMenu.entryconfig("Save", state="normal") self.processFilterSubMenu.entryconfig("Gaussian Filter", state="normal") self.processFilterSubMenu.entryconfig("Median Filter", state="normal") self.segmentationSubMenu.entryconfig("Watershed", state="normal") self.segmentationSubMenu.entryconfig("Random walker", state="normal") self.edgeDetectionSubMenu.entryconfig("Sobel", state="normal") self.edgeDetectionSubMenu.entryconfig("Laplacian", state="normal") self.edgeDetectionSubMenu.entryconfig("Canny", state="normal") self.colorMapSubMenu.entryconfig("None", state="normal") self.colorMapSubMenu.entryconfig("Plasma", state="normal") self.colorMapSubMenu.entryconfig("Inferno", state="normal") self.colorMapSubMenu.entryconfig("Viridis", state="normal") saveButton = tk.Button(self, text="Save", command=self.save) saveButton.grid(row=7, column=10) self.actual_name = self.original_path[self.original_path.rfind("/"):self.original_path.rfind(".")] #creacio arxiu temporal de la imatge que hem obert self.target_path = self.original_path[0:self.original_path.rfind(".")]+"imatge."+self.original_path[self.original_path.rfind(".")+1:] shutil.copy2(self.original_path, self.target_path) #copia l'arxiu de la ruta original #os.popen('attrib +h ' + self.target_path) self.originalImg = Image.open(self.original_path) #obrir imatge original self.originalImg.thumbnail(App.size, Image.ANTIALIAS) #thumbnail-> aplica mida imatge escalada a la finestra App.size originalImgCanvas = tk.Canvas(self, width= 500, height=380) # aplica la mida especificada a la imatge original originalImgCanvas.grid(row=3, column=2, columnspan=6) # la posiciona dins del grid a la fila 3 i la columna 2, abasta 6 columnes tkOriginalImg = ImageTk.PhotoImage(self.originalImg) # mostra la imatge original self.originalImg.image = tkOriginalImg # associa la imatge original a la imatge dins la llibreria tkinter originalImgCanvas.create_image(100,100,image=tkOriginalImg, anchor=tk.NW, tags="IMG") # crea la imatge anterior amb amplada nord-oest dins del widget de Canvas que disposa d'estructures grafiques self.targetImg = Image.open(self.target_path)# obrir imatge a procesar self.targetImg.thumbnail(App.size, Image.ANTIALIAS) #thumbnail-> aplica mida imatge escalada a la finestra App.size self.targetImgCanvas = tk.Canvas(self, width= 500, height=380) self.targetImgCanvas.grid(row=3, column=8, columnspan=6) self.tkTargetImg = ImageTk.PhotoImage(self.targetImg) self.targetImg.image = self.tkTargetImg self.targetImgCanvas.create_image(100,100,image=self.tkTargetImg, anchor=tk.NW) # source histogram #originalCvImg = cv2.imread(self.original_path) #plt.figure(figsize=(2,2)) #color = ('b','g','r') #for channel,col in enumerate(color): # histr = cv2.calcHist([originalCvImg],[channel],None,[256],[0,256]) # plt.plot(histr,color = col) # plt.xlim([0,256]) # if( col == 'b'): # originalB=plt.imshow(histr).figure # elif( col == 'g'): # originalG=plt.imshow(histr).figure # else: # originalR=plt.imshow(histr).figure #self.NewCanvas = tk.Canvas(self, width= 30, height=50) #self.canvas = FigureCanvasTkAgg(originalR, master=self.NewCanvas) #self.NewCanvas.grid(row=4, column=0) #self.canvas.show() #self.canvas.get_tk_widget().grid(row=0, column=0) # target histogram #targetCvImg = cv2.imread(self.target_path) #plt.figure(figsize=(2,2)) #color = ('b','g','r') #for channel,col in enumerate(color): # histr = cv2.calcHist([targetCvImg],[channel],None,[256],[0,256]) # plt.plot(histr,color = col) # plt.xlim([0,256]) # if( col == 'b'): # targetB=plt.imshow(histr).figure # elif( col == 'g'): # targetG=plt.imshow(histr).figure # else: # targetR=plt.imshow(histr).figure #self.NewTargetCanvas = tk.Canvas(self, width= 30, height=50) #self.canvasTarget = FigureCanvasTkAgg(targetR, master=self.NewTargetCanvas) #self.NewTargetCanvas.grid(row=4, column=1) #self.canvasTarget.show() #self.canvasTarget.get_tk_widget().grid(row=0, column=0) # to have only odd value in scale def fix(self, xy, n): #no entenc que fa aquesta funcio! global past n = int(n) if not n % 2: if xy=="sx": scale = self.gaussianSigmaXScale elif xy=="sy": scale = self.gaussianSigmaYScale elif xy=="median": scale = self.medianSizeScale else: scale = self.kernelSizeScale scale.set(n+1 if n > self.past else n-1) self.past = scale.get() # funcio per guardar imatges procesades def save(self): if tkMessageBox.askokcancel("Save", "Do you want to save?"): os.remove(self.original_path)# esborra arxiu original de la ruta de desti os.popen('attrib -h -s ' + self.target_path)# obre arxiu target de # la ruta de desti, correspon imatge a processar os.rename(self.target_path, self.original_path) #renombra # la imatge original i la imatge a processar shutil.copy2(self.original_path, self.target_path) #copia l'arxiu # de la ruta original i tambe la imatge a processar (target) os.popen('attrib +h ' + self.target_path) # sortir del GUI def exit(self): if tkMessageBox.askokcancel("Quit", "Do you want to quit?"): try: # esborrar arxiu temporal os.remove(self.target_path) finally: self.master.destroy() def updateTargetImage(self): # funcio per actualitzar les diferents accio a la imatge a procesar self.targetImg = Image.open(self.target_path) # obre la imatge a procesar, en la ruta on es troba self.targetImg.thumbnail(App.size, Image.ANTIALIAS) #thumbnail-> aplica mida imatge escalada a la finestra App.size self.tkTargetImg = ImageTk.PhotoImage(self.targetImg)# mostra la imatge a procesar self.targetImg.image = self.tkTargetImg # associa la imatge a procesar a la imatge dins la llibreria Tkinter (que allotja tot el referent al GUI) self.targetImgCanvas.create_image(5,5,image=self.tkTargetImg, anchor=tk.NW, tags="IMG") # crea la #imatge a procesar quan se li aplica algun canvi (colormap, filtres, etc) targetCvImg = cv2.imread(self.target_path) # llegeix la imatge de la ruta de desti plt.figure(figsize=(4,4)) # crea una figura per allotjar histograma color = ('b','g','r') for i,col in enumerate(color): histr = cv2.calcHist([targetCvImg],[i],None,[256],[0,256]) plt.plot(histr,color = col) plt.xlim([0,256]) targetR=plt.imshow(histr).figure self.NewTargetCanvas = tk.Canvas(self, width= 30, height=50) #crea un nou # Canvas de la mida indicada self.canvasTarget = FigureCanvasTkAgg(targetR, master=self.NewTargetCanvas) #crea una figura dins del Canvas on s'allotja el histograma self.NewTargetCanvas.grid(row=4, column=1)# defineix posicio del grid dins el # Canvas self.canvasTarget.show() # mostra el canvas self.canvasTarget.get_tk_widget().grid(row=0, column=0) def gaussFilter(self): targetTemp = sk.io.imread(self.original_path)# llegir imatge targetTemp a la ruta original targetTemp = sk.filters.gaussian(targetTemp, sigma=0, mode='reflect', cval=0, multichannel=False) #targetTemp = cv2.GaussianBlur(targetTemp,(sigmaX, sigmaY), 0)#aplicar filtre cv2.imwrite(self.target_path,targetTemp) # actualitzar imatge Target self.updateTargetImage() My code is so long (There are another functions or filters (Sobel, Canny, etc...) I paste the finally: def on_closing(app, root): if tkMessageBox.askokcancel("Quit", "Do you want to quit?"): try: os.remove(app.target_path) except: print("error") finally: root.destroy() # inicialitzar llibreria Tkinter per creacio widget root=tk.Tk() app = App(root) # renderitzar GUI, to accept events root.protocol("WM_DELETE_WINDOW", lambda: on_closing(app, root)) app.mainloop() I need help, it's so urgent! Thanks in advance. Xavi. -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefanv at berkeley.edu Tue Oct 4 15:08:24 2016 From: stefanv at berkeley.edu (Stefan van der Walt) Date: Tue, 04 Oct 2016 12:08:24 -0700 Subject: [scikit-image] GUI Python Image Processing In-Reply-To: References: Message-ID: <1475608104.834009.745811209.47E01B97@webmail.messagingengine.com> Hi Xavi On Tue, Oct 4, 2016, at 04:11, xavi barrull wrote: > Hi, I have a question about scikit image. > I make a GUI in python to processing image, but I will change the > gaussian Filter in opencv to scikit image, I use this function: > > def gaussFilter(self): > targetTemp = sk.io.imread(self.original_path)# llegir imatge > targetTemp a la ruta original > targetTemp = sk.filters.gaussian(targetTemp, sigma=0, > mode='reflect', cval=0, multichannel=False) > #targetTemp = cv2.GaussianBlur(targetTemp,(sigmaX, sigmaY), > 0) > cv2.imwrite(self.target_path,targetTemp) > self.updateTargetImage() The sigma value for your filter is 0. Is this what you intended? St?fan -------------- next part -------------- An HTML attachment was scrubbed... URL: From google at terre-adelie.org Thu Oct 6 15:29:39 2016 From: google at terre-adelie.org (=?UTF-8?B?SsOpcsO0bWU=?= Kieffer) Date: Thu, 6 Oct 2016 21:29:39 +0200 Subject: [scikit-image] Nonrigid image registration in Python In-Reply-To: <57f6098a.8926c20a.61cd.b174@mx.google.com> References: <57f6098a.8926c20a.61cd.b174@mx.google.com> Message-ID: <20161006212939.0c9bdbcd@patagonia> On Thu, 6 Oct 2016 10:21:30 +0200 wrote: > Aside from this announcement, I?d like to propose to put together a list of Python packages that do (nonrigid) image registration. Since efforts in Python-based image registration have only resulted in relatively small and unknown packages, it would be good to have an overview. What would be a good place for this? Maybe a wiki-page on scikit-image?s Gitub repo? Hi Almar, We have implemented the SIFT algorithm on GPU a few years ago. It is now part of the silx toolkit https://github.com/silx-kit/silx/blob/master/doc/source/Tutorials/Sift/sift.ipynb Cheers, J?r?me From kevin.keraudren at googlemail.com Thu Oct 6 15:57:46 2016 From: kevin.keraudren at googlemail.com (Kevin Keraudren) Date: Thu, 6 Oct 2016 20:57:46 +0100 Subject: [scikit-image] Nonrigid image registration in Python In-Reply-To: <20161006212939.0c9bdbcd@patagonia> References: <57f6098a.8926c20a.61cd.b174@mx.google.com> <20161006212939.0c9bdbcd@patagonia> Message-ID: Hi Almar, Non-rigid registration is available in SimpleITK, see this example for BSpline registration: https://github.com/SimpleITK/SimpleITK/blob/master/Examples/Python/ImageRegistrationMethodBSpline1.py and this example for Demons registration: https://github.com/SimpleITK/SimpleITK/blob/master/Examples/Python/DemonsRegistration1.py SimpleITK is on PyPI (https://pypi.python.org/pypi/SimpleITK/0.10.0) and on conda-forge (https://anaconda.org/simpleitk/simpleitk). Kind Regards, Kevin On Thu, Oct 6, 2016 at 8:29 PM, J?r?me Kieffer wrote: > On Thu, 6 Oct 2016 10:21:30 +0200 > wrote: > > > Aside from this announcement, I?d like to propose to put together a list > of Python packages that do (nonrigid) image registration. Since efforts in > Python-based image registration have only resulted in relatively small and > unknown packages, it would be good to have an overview. What would be a > good place for this? Maybe a wiki-page on scikit-image?s Gitub repo? > > Hi Almar, > > We have implemented the SIFT algorithm on GPU a few years ago. > It is now part of the silx toolkit > https://github.com/silx-kit/silx/blob/master/doc/source/ > Tutorials/Sift/sift.ipynb > > Cheers, > > J?r?me > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image > -------------- next part -------------- An HTML attachment was scrubbed... URL: From arokem at gmail.com Thu Oct 6 16:04:32 2016 From: arokem at gmail.com (Ariel Rokem) Date: Thu, 6 Oct 2016 13:04:32 -0700 Subject: [scikit-image] Nonrigid image registration in Python In-Reply-To: <20161006212939.0c9bdbcd@patagonia> References: <57f6098a.8926c20a.61cd.b174@mx.google.com> <20161006212939.0c9bdbcd@patagonia> Message-ID: Hi Almar and all, On Thu, Oct 6, 2016 at 12:29 PM, J?r?me Kieffer wrote: > On Thu, 6 Oct 2016 10:21:30 +0200 > wrote: > > > Aside from this announcement, I?d like to propose to put together a list > of Python packages that do (nonrigid) image registration. Since efforts in > Python-based image registration have only resulted in relatively small and > unknown packages, it would be good to have an overview. What would be a > good place for this? Maybe a wiki-page on scikit-image?s Gitub repo? > > Please feel free to include this work: http://nipy.org/dipy/examples_built/syn_registration_2d.html#example-syn-registration-2d http://nipy.org/dipy/examples_built/syn_registration_3d.html#example-syn-registration-3d Cheers, Ariel > Hi Almar, > > We have implemented the SIFT algorithm on GPU a few years ago. > It is now part of the silx toolkit > https://github.com/silx-kit/silx/blob/master/doc/source/Tuto > rials/Sift/sift.ipynb > > Cheers, > > J?r?me > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image > -------------- next part -------------- An HTML attachment was scrubbed... URL: From amaury.dehecq at univ-smb.fr Thu Oct 6 20:06:04 2016 From: amaury.dehecq at univ-smb.fr (Amaury Dehecq) Date: Thu, 6 Oct 2016 17:06:04 -0700 Subject: [scikit-image] Warping image subset Message-ID: <9128e293-3d19-c8d8-2b86-e4125f98d615@univ-smb.fr> Hello everyone, I'm using skimage to correct distortions on an image, using a polynomial transformation. Basically, my commands can be summarized to: import skimage.transform as tf # estimate the transformation matrix from control points before (pts2) and after (pts1) distortion M=tf.estimate_transform('polynomial',pts2,pts1,order=3) # warp the initial image im warped=tf.warp(im,M) This does exactly what I want, except that my image is very large (35000 x 35000) and the script crashes if I try to run it for the whole image. So I thought I could just cut my image into subimages and run warp for each subimage. But as the matrix indexes are shifted (e.g always in the interval [0-5000] instead of [0-350000]), I end up applying the same correction to each subimage. Is there a way to take into account the fact that my matrix is a subset, for example by indicating the actual coordinates instead of using the matrix indexes? (Like in the MatLab function imwarp using argument RA if that helps understanding) Thanks a lot, Amaury From jsch at demuc.de Fri Oct 7 02:39:36 2016 From: jsch at demuc.de (=?utf-8?Q?Johannes=20Sch=C3=B6nberger?=) Date: Fri, 07 Oct 2016 08:39:36 +0200 Subject: [scikit-image] Warping image subset In-Reply-To: <9128e293-3d19-c8d8-2b86-e4125f98d615@univ-smb.fr> References: <9128e293-3d19-c8d8-2b86-e4125f98d615@univ-smb.fr> Message-ID: <1475822376.144200.748586633.37436AB4@webmail.messagingengine.com> You can do this by iterating over windows of your image with the following (pseudo-)code: M = tf.estimate_transform('polynomial',pts2,pts1,order=3) for minr in range(0, image.shape[0], window_size): for minc in range(0, image.shape[1], window_size): coords = M(np.array(np.mgrid[minr:minr+window_size, minc:minc+window_size])) transformed_coords = M(coords) # TODO: reshape transformed_coords into the correct size, refer to tf.warp_coords for an example. total_output_image[window_bbox] = warp(image, transformed_coords, ...) I hope it is clear what I mean here? I don't have more time at the moment... On Fri, Oct 7, 2016, at 02:06 AM, Amaury Dehecq wrote: > Hello everyone, > > I'm using skimage to correct distortions on an image, using a polynomial > transformation. Basically, my commands can be summarized to: > > import skimage.transform as tf > > # estimate the transformation matrix from control points before > (pts2) and after (pts1) distortion > M=tf.estimate_transform('polynomial',pts2,pts1,order=3) > > # warp the initial image im > warped=tf.warp(im,M) > > This does exactly what I want, except that my image is very large (35000 > x 35000) and the script crashes if I try to run it for the whole image. > So I thought I could just cut my image into subimages and run warp for > each subimage. But as the matrix indexes are shifted (e.g always in the > interval [0-5000] instead of [0-350000]), I end up applying the same > correction to each subimage. > Is there a way to take into account the fact that my matrix is a subset, > for example by indicating the actual coordinates instead of using the > matrix indexes? (Like in the MatLab function imwarp using argument RA if > that helps understanding) > > Thanks a lot, > > Amaury > > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image From xavi_barrull at hotmail.com Wed Oct 5 06:43:19 2016 From: xavi_barrull at hotmail.com (xavi barrull) Date: Wed, 5 Oct 2016 10:43:19 +0000 Subject: [scikit-image] GUI Python Image Processing Scikit-image Message-ID: Hi, I have a question about scikit image. I make a GUI in python to processing image, but I will change the gaussian Filter in opencv to scikit image, I use this function: def gaussFilter(self): targetTemp = sk.io.imread(self.original_path)# llegir imatge targetTemp a la ruta original targetTemp = sk.filters.gaussian(targetTemp, sigma=0, mode='reflect', cval=0, multichannel=False) #targetTemp = cv2.GaussianBlur(targetTemp,(sigmaX, sigmaY), 0) cv2.imwrite(self.target_path,targetTemp) self.updateTargetImage() But, when I press the button of gaussian filter the image to update becomes black, what is the problem? I need a solution for this! My code show bellow: import Tkinter as tk import numpy as np import tkFileDialog import tkMessageBox import shutil import os from PIL import Image, ImageTk, ImageFilter import cv2 import colormaps import skimage as sk import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap from matplotlib.figure import Figure from skimage import filters from skimage import io from skimage.morphology import disk from skimage.filters.rank import median from skimage.filters import gaussian from skimage.morphology import watershed from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg class App(tk.Frame): size = 500, 700 # get past scale value past=1 # inicialitzar app def __init__(self, master): tk.Frame.__init__(self, master) self.grid(row=0) self.columnconfigure(0, weight=1) self.rowconfigure(0, weight=1) master.geometry("1024x768") self.generateMenu(master) # Generacio Menu def generateMenu(self, master): # crear barra menu, dins de la llibreria TKinter (tk.) self.menuBar=tk.Menu(self) # creacio arxiu dins de la barra de menu self.fileMenu=tk.Menu(self.menuBar, tearoff=0) # crear commandes obrir, guardar i tancar, l'estat de guardar esta desactivat mentre no s'obri una imatge self.fileMenu.add_command(label="Open", command=self.open) self.fileMenu.add_command(label="Save", command=self.save, state="disabled") self.fileMenu.add_command(label="Close", command=self.exit) # Afegim tot aixo la barra de menu en cascada self.menuBar.add_cascade(label="File", menu=self.fileMenu) # Crear menu de process self.processMenu=tk.Menu(self.menuBar, tearoff=0) # crear submenu de processs/filter self.processFilterSubMenu = tk.Menu(self.processMenu, tearoff=0) self.processFilterSubMenu.add_command(label="Gaussian Filter", command=self.gaussFilter, state="disabled") self.processFilterSubMenu.add_command(label="Median Filter", command=self.medianFilter, state="disabled") self.processMenu.add_cascade(label="Process/Filter", menu=self.processFilterSubMenu, underline=0) # crear submenu segmentacio self.segmentationSubMenu = tk.Menu(self.processMenu, tearoff=0) self.segmentationSubMenu.add_command(label="Watershed", command=self.watershed, state="disabled") self.segmentationSubMenu.add_command(label="Random walker", command=self.randomwalker, state="disabled") self.processMenu.add_cascade(label="Segmentation", menu=self.segmentationSubMenu, underline=0) # crear submenu edgeDetection self.edgeDetectionSubMenu = tk.Menu(self.processMenu, tearoff=0) self.edgeDetectionSubMenu.add_command(label="Sobel", command=self.sobel, state="disabled") self.edgeDetectionSubMenu.add_command(label="Laplacian", command=self.laplacian, state="disabled") self.edgeDetectionSubMenu.add_command(label="Canny", command=self.canny, state="disabled") self.processMenu.add_cascade(label="Edge Detection", menu=self.edgeDetectionSubMenu, underline=0) # crear submenu change colormap self.colorMapSubMenu = tk.Menu(self.processMenu, tearoff=0) self.colorMapSubMenu.add_command(label="None", command=self.none, state="disabled") self.colorMapSubMenu.add_command(label="Plasma", command=self.plasma, state="disabled") self.colorMapSubMenu.add_command(label="Inferno", command=self.inferno, state="disabled") self.colorMapSubMenu.add_command(label="Viridis", command=self.viridis, state="disabled") self.processMenu.add_cascade(label="Change Colormap", menu=self.colorMapSubMenu, underline=0) self.menuBar.add_cascade(label="Process", menu=self.processMenu) master.config(menu=self.menuBar) # No colorMap def none(self): targetTemp = cv2.imread(self.original_path) cv2.imwrite(self.target_path,targetTemp)# guarda imatge targetTemp i a la ruta de desti self.updateTargetImage() # Plasma colorMap def plasma(self): plt.clf()#esborra imatge targetTemp targetTemp = cv2.imread(self.original_path) # llegir ruta original (carpeta on es troba arxiu py) targetTemp = np.fliplr(targetTemp[:,:,0]) # gir esquerra a dreta imatge original, segons 3r valor matriu, varia tonalitat plasma = ListedColormap(colormaps._plasma_data, name='plasma') plt.axis('off')#desactiva eixos a la imatge plt.register_cmap(name='plasma', cmap=plasma) # registrar colormap nou i aplicar-lo imgplot = plt.imshow(targetTemp)#mostrar imatge allotjada a targetTemp imgplot.set_cmap(plasma)#aplicar colormap imgplot.figure.savefig(self.target_path)#guardar imatge com a figura a la ruta de desti self.updateTargetImage() #actualitzar la imatge (amb aplicacio del colormap) def viridis(self): plt.clf() #esborra imatge targetTemp targetTemp = cv2.imread(self.original_path) targetTemp = np.fliplr(targetTemp[:,:,0]) viridis = ListedColormap(colormaps._viridis_data, name='viridis') plt.axis('off') plt.register_cmap(name='viridis', cmap=viridis) imgplot = plt.imshow(targetTemp) imgplot.set_cmap(viridis) imgplot.figure.savefig(self.target_path) # update target screen self.updateTargetImage() def inferno(self): plt.clf() targetTemp = cv2.imread(self.original_path) targetTemp = np.fliplr(targetTemp[:,:,0]) inferno = ListedColormap(colormaps._inferno_data, name='inferno') plt.axis('off') plt.register_cmap(name='inferno', cmap=inferno) imgplot = plt.imshow(targetTemp) imgplot.set_cmap(inferno) imgplot.figure.savefig(self.target_path) self.updateTargetImage() # funcio per obrir arxius def open(self): # obrir arxiu des del quadre de dialeg self.original_path = tkFileDialog.askopenfilename(filetypes=[("Image Files","*.jpg;*.jpeg;*.png;*.gif")]) if self.original_path!="": # si es selecciona un arxiu, s'activen totes les comandes del menu self.fileMenu.entryconfig("Save", state="normal") self.processFilterSubMenu.entryconfig("Gaussian Filter", state="normal") self.processFilterSubMenu.entryconfig("Median Filter", state="normal") self.segmentationSubMenu.entryconfig("Watershed", state="normal") self.segmentationSubMenu.entryconfig("Random walker", state="normal") self.edgeDetectionSubMenu.entryconfig("Sobel", state="normal") self.edgeDetectionSubMenu.entryconfig("Laplacian", state="normal") self.edgeDetectionSubMenu.entryconfig("Canny", state="normal") self.colorMapSubMenu.entryconfig("None", state="normal") self.colorMapSubMenu.entryconfig("Plasma", state="normal") self.colorMapSubMenu.entryconfig("Inferno", state="normal") self.colorMapSubMenu.entryconfig("Viridis", state="normal") saveButton = tk.Button(self, text="Save", command=self.save) saveButton.grid(row=7, column=10) self.actual_name = self.original_path[self.original_path.rfind("/"):self.original_path.rfind(".")] #creacio arxiu temporal de la imatge que hem obert self.target_path = self.original_path[0:self.original_path.rfind(".")]+"imatge."+self.original_path[self.original_path.rfind(".")+1:] shutil.copy2(self.original_path, self.target_path) #copia l'arxiu de la ruta original #os.popen('attrib +h ' + self.target_path) self.originalImg = Image.open(self.original_path) #obrir imatge original self.originalImg.thumbnail(App.size, Image.ANTIALIAS) #thumbnail-> aplica mida imatge escalada a la finestra App.size originalImgCanvas = tk.Canvas(self, width= 500, height=380) # aplica la mida especificada a la imatge original originalImgCanvas.grid(row=3, column=2, columnspan=6) # la posiciona dins del grid a la fila 3 i la columna 2, abasta 6 columnes tkOriginalImg = ImageTk.PhotoImage(self.originalImg) # mostra la imatge original self.originalImg.image = tkOriginalImg # associa la imatge original a la imatge dins la llibreria tkinter originalImgCanvas.create_image(100,100,image=tkOriginalImg, anchor=tk.NW, tags="IMG") # crea la imatge anterior amb amplada nord-oest dins del widget de Canvas que disposa d'estructures grafiques self.targetImg = Image.open(self.target_path)# obrir imatge a procesar self.targetImg.thumbnail(App.size, Image.ANTIALIAS) #thumbnail-> aplica mida imatge escalada a la finestra App.size self.targetImgCanvas = tk.Canvas(self, width= 500, height=380) self.targetImgCanvas.grid(row=3, column=8, columnspan=6) self.tkTargetImg = ImageTk.PhotoImage(self.targetImg) self.targetImg.image = self.tkTargetImg self.targetImgCanvas.create_image(100,100,image=self.tkTargetImg, anchor=tk.NW) # source histogram #originalCvImg = cv2.imread(self.original_path) #plt.figure(figsize=(2,2)) #color = ('b','g','r') #for channel,col in enumerate(color): # histr = cv2.calcHist([originalCvImg],[channel],None,[256],[0,256]) # plt.plot(histr,color = col) # plt.xlim([0,256]) # if( col == 'b'): # originalB=plt.imshow(histr).figure # elif( col == 'g'): # originalG=plt.imshow(histr).figure # else: # originalR=plt.imshow(histr).figure #self.NewCanvas = tk.Canvas(self, width= 30, height=50) #self.canvas = FigureCanvasTkAgg(originalR, master=self.NewCanvas) #self.NewCanvas.grid(row=4, column=0) #self.canvas.show() #self.canvas.get_tk_widget().grid(row=0, column=0) # target histogram #targetCvImg = cv2.imread(self.target_path) #plt.figure(figsize=(2,2)) #color = ('b','g','r') #for channel,col in enumerate(color): # histr = cv2.calcHist([targetCvImg],[channel],None,[256],[0,256]) # plt.plot(histr,color = col) # plt.xlim([0,256]) # if( col == 'b'): # targetB=plt.imshow(histr).figure # elif( col == 'g'): # targetG=plt.imshow(histr).figure # else: # targetR=plt.imshow(histr).figure #self.NewTargetCanvas = tk.Canvas(self, width= 30, height=50) #self.canvasTarget = FigureCanvasTkAgg(targetR, master=self.NewTargetCanvas) #self.NewTargetCanvas.grid(row=4, column=1) #self.canvasTarget.show() #self.canvasTarget.get_tk_widget().grid(row=0, column=0) # to have only odd value in scale def fix(self, xy, n): #no entenc que fa aquesta funcio! global past n = int(n) if not n % 2: if xy=="sx": scale = self.gaussianSigmaXScale elif xy=="sy": scale = self.gaussianSigmaYScale elif xy=="median": scale = self.medianSizeScale else: scale = self.kernelSizeScale scale.set(n+1 if n > self.past else n-1) self.past = scale.get() # funcio per guardar imatges procesades def save(self): if tkMessageBox.askokcancel("Save", "Do you want to save?"): os.remove(self.original_path)# esborra arxiu original de la ruta de desti os.popen('attrib -h -s ' + self.target_path)# obre arxiu target de # la ruta de desti, correspon imatge a processar os.rename(self.target_path, self.original_path) #renombra # la imatge original i la imatge a processar shutil.copy2(self.original_path, self.target_path) #copia l'arxiu # de la ruta original i tambe la imatge a processar (target) os.popen('attrib +h ' + self.target_path) # sortir del GUI def exit(self): if tkMessageBox.askokcancel("Quit", "Do you want to quit?"): try: # esborrar arxiu temporal os.remove(self.target_path) finally: self.master.destroy() def updateTargetImage(self): # funcio per actualitzar les diferents accio a la imatge a procesar self.targetImg = Image.open(self.target_path) # obre la imatge a procesar, en la ruta on es troba self.targetImg.thumbnail(App.size, Image.ANTIALIAS) #thumbnail-> aplica mida imatge escalada a la finestra App.size self.tkTargetImg = ImageTk.PhotoImage(self.targetImg)# mostra la imatge a procesar self.targetImg.image = self.tkTargetImg # associa la imatge a procesar a la imatge dins la llibreria Tkinter (que allotja tot el referent al GUI) self.targetImgCanvas.create_image(5,5,image=self.tkTargetImg, anchor=tk.NW, tags="IMG") # crea la #imatge a procesar quan se li aplica algun canvi (colormap, filtres, etc) targetCvImg = cv2.imread(self.target_path) # llegeix la imatge de la ruta de desti plt.figure(figsize=(4,4)) # crea una figura per allotjar histograma color = ('b','g','r') for i,col in enumerate(color): histr = cv2.calcHist([targetCvImg],[i],None,[256],[0,256]) plt.plot(histr,color = col) plt.xlim([0,256]) targetR=plt.imshow(histr).figure self.NewTargetCanvas = tk.Canvas(self, width= 30, height=50) #crea un nou # Canvas de la mida indicada self.canvasTarget = FigureCanvasTkAgg(targetR, master=self.NewTargetCanvas) #crea una figura dins del Canvas on s'allotja el histograma self.NewTargetCanvas.grid(row=4, column=1)# defineix posicio del grid dins el # Canvas self.canvasTarget.show() # mostra el canvas self.canvasTarget.get_tk_widget().grid(row=0, column=0) def gaussFilter(self): targetTemp = sk.io.imread(self.original_path)# llegir imatge targetTemp a la ruta original targetTemp = sk.filters.gaussian(targetTemp, sigma=0, mode='reflect', cval=0, multichannel=False) #targetTemp = cv2.GaussianBlur(targetTemp,(sigmaX, sigmaY), 0)#aplicar filtre cv2.imwrite(self.target_path,targetTemp) # actualitzar imatge Target self.updateTargetImage() My code is so long (There are another functions or filters (Sobel, Canny, etc...) I paste the finally: def on_closing(app, root): if tkMessageBox.askokcancel("Quit", "Do you want to quit?"): try: os.remove(app.target_path) except: print("error") finally: root.destroy() # inicialitzar llibreria Tkinter per creacio widget root=tk.Tk() app = App(root) # renderitzar GUI, to accept events root.protocol("WM_DELETE_WINDOW", lambda: on_closing(app, root)) app.mainloop() I attached image about my problema I need help, it's so urgent! Thanks in advance. Xavi. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Captura de pantalla 2016-10-05 a les 12.42.14.png Type: image/png Size: 697790 bytes Desc: Captura de pantalla 2016-10-05 a les 12.42.14.png URL: From stefanv at berkeley.edu Fri Oct 7 17:15:21 2016 From: stefanv at berkeley.edu (Stefan van der Walt) Date: Fri, 07 Oct 2016 14:15:21 -0700 Subject: [scikit-image] Nonrigid image registration in Python In-Reply-To: <20161006212939.0c9bdbcd@patagonia> References: <57f6098a.8926c20a.61cd.b174@mx.google.com> <20161006212939.0c9bdbcd@patagonia> Message-ID: <1475874921.22142.749321153.22321A2A@webmail.messagingengine.com> On Thu, Oct 6, 2016, at 12:29, J?r?me Kieffer wrote: > We have implemented the SIFT algorithm on GPU a few years ago. > It is now part of the silx toolkit > https://github.com/silx-kit/silx/blob/master/doc/source/Tutorials/Sift/sift.ipynb Note that SIFT is patent encumbered, that is why we have CENSURE features in skimage. St?fan From stefanv at berkeley.edu Fri Oct 7 17:19:17 2016 From: stefanv at berkeley.edu (Stefan van der Walt) Date: Fri, 07 Oct 2016 14:19:17 -0700 Subject: [scikit-image] Nonrigid image registration in Python In-Reply-To: <57f6098a.8926c20a.61cd.b174@mx.google.com> References: <57f6098a.8926c20a.61cd.b174@mx.google.com> Message-ID: <1475875157.22708.749321529.09EF73D0@webmail.messagingengine.com> Hi Almar On Thu, Oct 6, 2016, at 01:21, almar.klein at gmail.com wrote: > Aside from this announcement, I?d like to propose to put together a > list of Python packages that do (nonrigid) image registration. Since > efforts in Python-based image registration have only resulted in > relatively small and unknown packages, it would be good to have an > overview. What would be a good place for this? Maybe a wiki-page on > scikit-image?s Gitub repo? I've heard this from multiple fronts, and it is also an effort I am interested in. We would do well to unify the various implementations lying around all over the place. We worked on some tools 5 years ago: https://github.com/pyimreg/python-register I've since often used Elastix (but your wrappers would have made that a lot less painful). nipy (neuroimaging in Python) contains at least two registration packages: some functionality in DiPy, others in nireg. A wiki page + a project on GitHub may be a good way to organize these tasks. Thanks for taking this on; I am excited to see where it goes! St?fan -------------- next part -------------- An HTML attachment was scrubbed... URL: From amaury.dehecq at univ-smb.fr Fri Oct 7 18:57:51 2016 From: amaury.dehecq at univ-smb.fr (Amaury Dehecq) Date: Fri, 7 Oct 2016 15:57:51 -0700 Subject: [scikit-image] Warping image subset In-Reply-To: <1475822376.144200.748586633.37436AB4@webmail.messagingengine.com> References: <9128e293-3d19-c8d8-2b86-e4125f98d615@univ-smb.fr> <1475822376.144200.748586633.37436AB4@webmail.messagingengine.com> Message-ID: <1B23BC41-513C-4445-87A4-2C1AEF6B94D3@univ-smb.fr> Hi, Ok, Johannes answer seemed to work, thank you! There?s a bit of brainstorming to find out how to reshape the coordinates etc? so below is my solution if this can help someone : import skimage.transform as tf # estimate the transformation matrix from control points before (pts2) and after (pts1) distortion M=tf.estimate_transform('polynomial',pts2,pts1,order=3) # subimage sub = im[yl:yr,xl:xr] # get new coordinates for the subset image coords=np.mgrid[yl:yr,xl:xr] # coords must be shape (2,N) + order (x,y) not (y,x) for passing to transformation matrix coords = np.array((coords[1].ravel(),coords[0].ravel())).T # new coordinates coords_out = M(coords) # now shift the coordinates to take into account image cropping yy = coords_out[:,1].reshape(sub.shape) xx = coords_out[:,0].reshape(sub.shape) xx -= xl yy -= yl transf_coords = np.array((yy,xx)) # image warping out_sub=tf.warp(sub,transf_coords,preserve_range=True) Robert, I didn?t know PyTables but I?ll have a look as it can always be useful. Amaury Below is the > On Oct 6, 2016, at 23:39, Johannes Sch?nberger wrote: > > You can do this by iterating over windows of your image with the > following (pseudo-)code: > > M = tf.estimate_transform('polynomial',pts2,pts1,order=3) > > for minr in range(0, image.shape[0], window_size): > for minc in range(0, image.shape[1], window_size): > coords = M(np.array(np.mgrid[minr:minr+window_size, > minc:minc+window_size])) > transformed_coords = M(coords) > # TODO: reshape transformed_coords into the correct size, refer > to tf.warp_coords for an example. > total_output_image[window_bbox] = warp(image, > transformed_coords, ...) > > I hope it is clear what I mean here? I don't have more time at the > moment... > > On Fri, Oct 7, 2016, at 02:06 AM, Amaury Dehecq wrote: >> Hello everyone, >> >> I'm using skimage to correct distortions on an image, using a polynomial >> transformation. Basically, my commands can be summarized to: >> >> import skimage.transform as tf >> >> # estimate the transformation matrix from control points before >> (pts2) and after (pts1) distortion >> M=tf.estimate_transform('polynomial',pts2,pts1,order=3) >> >> # warp the initial image im >> warped=tf.warp(im,M) >> >> This does exactly what I want, except that my image is very large (35000 >> x 35000) and the script crashes if I try to run it for the whole image. >> So I thought I could just cut my image into subimages and run warp for >> each subimage. But as the matrix indexes are shifted (e.g always in the >> interval [0-5000] instead of [0-350000]), I end up applying the same >> correction to each subimage. >> Is there a way to take into account the fact that my matrix is a subset, >> for example by indicating the actual coordinates instead of using the >> matrix indexes? (Like in the MatLab function imwarp using argument RA if >> that helps understanding) >> >> Thanks a lot, >> >> Amaury >> >> _______________________________________________ >> scikit-image mailing list >> scikit-image at python.org >> https://mail.python.org/mailman/listinfo/scikit-image > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image From nathan.faggian at gmail.com Sat Oct 8 06:43:18 2016 From: nathan.faggian at gmail.com (Nathan Faggian) Date: Sat, 8 Oct 2016 21:43:18 +1100 Subject: [scikit-image] Nonrigid image registration in Python In-Reply-To: <1475875157.22708.749321529.09EF73D0@webmail.messagingengine.com> References: <57f6098a.8926c20a.61cd.b174@mx.google.com> <1475875157.22708.749321529.09EF73D0@webmail.messagingengine.com> Message-ID: I am also very excited to see movement in this space. I remember talking with Stefan about this a couple of years ago... even having a go at implementing some things.. but then life got in the way. Happy to relinquish pyimreg if anyone thinks that is a good banner for this work. On 8 Oct 2016 8:20 AM, "Stefan van der Walt" wrote: > Hi Almar > > On Thu, Oct 6, 2016, at 01:21, almar.klein at gmail.com wrote: > > Aside from this announcement, I?d like to propose to put together a list > of Python packages that do (nonrigid) image registration. Since efforts in > Python-based image registration have only resulted in relatively small and > unknown packages, it would be good to have an overview. What would be a > good place for this? Maybe a wiki-page on scikit-image?s Gitub repo? > > > I've heard this from multiple fronts, and it is also an effort I am > interested in. We would do well to unify the various implementations lying > around all over the place. > > We worked on some tools 5 years ago: https://github.com/pyimreg/ > python-register I've since often used Elastix (but your wrappers would > have made that a lot less painful). nipy (neuroimaging in Python) contains > at least two registration packages: some functionality in DiPy, others in > nireg. > > A wiki page + a project on GitHub may be a good way to organize these > tasks. > > Thanks for taking this on; I am excited to see where it goes! > > St?fan > > > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From almar.klein at gmail.com Sat Oct 8 16:27:29 2016 From: almar.klein at gmail.com (almar.klein at gmail.com) Date: Sat, 8 Oct 2016 22:27:29 +0200 Subject: [scikit-image] Nonrigid image registration in Python In-Reply-To: References: <57f6098a.8926c20a.61cd.b174@mx.google.com> <1475875157.22708.749321529.09EF73D0@webmail.messagingengine.com> Message-ID: <57f956b0.8270c20a.d52ee.22d8@mx.google.com> I think ideally unification should be in the form of a single image registration library that is well maintained by multiple people. Though I really don?t have the time to champion this effort :) Having a central place where the available libraries are listed (plus how easy each one can be installed) would be a good first step that?s easy to make. Where should we put this list? At first I thought of a wiki page on github.com/skimage/skimage, though if we?d use a new Github project, we?d already have a name and place in case someone wants to put the effort in the above... pyimreg is a clear enough name :) From: Nathan Faggian Sent: 08 October 2016 12:44 To: Stefan van der Walt Cc: scikit-image at python.org Subject: Re: [scikit-image] Nonrigid image registration in Python I am also very excited to see movement in this space. I remember talking with Stefan about this a couple of years ago... even having a go at implementing some things.. but then life got in the way. Happy to relinquish pyimreg if anyone thinks that is a good banner for this work. On 8 Oct 2016 8:20 AM, "Stefan van der Walt" wrote: Hi Almar On Thu, Oct 6, 2016, at 01:21, almar.klein at gmail.com wrote: Aside from this announcement, I?d like to propose to put together a list of Python packages that do (nonrigid) image registration. Since efforts in Python-based image registration have only resulted in relatively small and unknown packages, it would be good to have an overview. What would be a good place for this? Maybe a wiki-page on scikit-image?s Gitub repo? I've heard this from multiple fronts, and it is also an effort I am interested in.? We would do well to unify the various implementations lying around all over the place. We worked on some tools 5 years ago: https://github.com/pyimreg/python-register? I've since often used Elastix (but your wrappers would have made that a lot less painful).? nipy (neuroimaging in Python) contains at least two registration packages: some functionality in DiPy, others in nireg. A wiki page + a project on GitHub may be a good way to organize these tasks. Thanks for taking this on; I am excited to see where it goes! St?fan _______________________________________________ scikit-image mailing list scikit-image at python.org https://mail.python.org/mailman/listinfo/scikit-image -------------- next part -------------- An HTML attachment was scrubbed... URL: From google at terre-adelie.org Sun Oct 9 15:33:35 2016 From: google at terre-adelie.org (=?UTF-8?B?SsOpcsO0bWU=?= Kieffer) Date: Sun, 9 Oct 2016 21:33:35 +0200 Subject: [scikit-image] Nonrigid image registration in Python In-Reply-To: <1475874921.22142.749321153.22321A2A@webmail.messagingengine.com> References: <57f6098a.8926c20a.61cd.b174@mx.google.com> <20161006212939.0c9bdbcd@patagonia> <1475874921.22142.749321153.22321A2A@webmail.messagingengine.com> Message-ID: <20161009213335.7a60133f@patagonia> On Fri, 07 Oct 2016 14:15:21 -0700 Stefan van der Walt wrote: > On Thu, Oct 6, 2016, at 12:29, J?r?me Kieffer wrote: > > We have implemented the SIFT algorithm on GPU a few years ago. > > It is now part of the silx toolkit > > https://github.com/silx-kit/silx/blob/master/doc/source/Tutorials/Sift/sift.ipynb > > Note that SIFT is patent encumbered, that is why we have CENSURE > features in skimage. Hi Stephan, I know about the patent, but: 1. I live in Europe, where it is not applicable 2. I have neither a passport nor a visa to the USA (where it is applicable) 3. The patent is quite old and should expire by a couple of years from now. When we did the study (i.e. 2011-2012), SURF was claimed "patent-free" and this no more the case now :( I wish you the same story does not apply to CENSURE. The difference of boxes is similar to SURF, CENSURE is just using octogons, another trick to avoid the patent on gaussian blurring. By the way the difference of boxes has been patented with SURF if I remember well. My question would rather be about the quality of the descriptors ... in skimage you provide BRIEF, does this mean CENSURE has no specific keypoint descriptor ? Cheers, J?r?me From jiri.borovec at fel.cvut.cz Mon Oct 10 07:42:50 2016 From: jiri.borovec at fel.cvut.cz (=?UTF-8?B?SmnFmcOtIEJvcm92ZWM=?=) Date: Mon, 10 Oct 2016 13:42:50 +0200 Subject: [scikit-image] BPDL in skimage? Message-ID: Hello recently we made a new method Binary Pattern Dictionary learning for estimation an atlas from set of binary images where we detect and decompose frequent patterns in the image set, see paper in attachment. I was wondering if you are interested to have this method as contribution to the scikit-image library? Thanks -- Best regards, Jiri Borovec ------------------------------------------------------------------------ Ing. Jiri Borovec, MSc PhD student at CMP CTU, http://cmp.felk.cvut.cz/~borovji3 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: W18-09.compressed.pdf Type: application/pdf Size: 634132 bytes Desc: not available URL: From stefanv at berkeley.edu Tue Oct 11 14:07:31 2016 From: stefanv at berkeley.edu (Stefan van der Walt) Date: Tue, 11 Oct 2016 11:07:31 -0700 Subject: [scikit-image] BPDL in skimage? In-Reply-To: References: Message-ID: <1476209251.998616.752709505.31E31A16@webmail.messagingengine.com> Hi Jiri On Mon, Oct 10, 2016, at 04:42, Ji?? Borovec wrote: > recently we made a new method Binary Pattern Dictionary learning for > estimation an atlas from set of binary images where we detect and > decompose frequent patterns in the image set, see paper in attachment. > I was wondering if you are interested to have this method as > contribution to the scikit-image library? We typically wait a while for papers to gain popularity before we implement them in scikit-image. That said, I think it's an excellent idea to make the code available with proper licensing and documentation until such time that we can include it. Best regards St?fan -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefanv at berkeley.edu Tue Oct 11 14:04:06 2016 From: stefanv at berkeley.edu (Stefan van der Walt) Date: Tue, 11 Oct 2016 11:04:06 -0700 Subject: [scikit-image] Nonrigid image registration in Python In-Reply-To: <20161009213335.7a60133f@patagonia> References: <57f6098a.8926c20a.61cd.b174@mx.google.com> <20161006212939.0c9bdbcd@patagonia> <1475874921.22142.749321153.22321A2A@webmail.messagingengine.com> <20161009213335.7a60133f@patagonia> Message-ID: <1476209046.997770.752706361.63F16A6A@webmail.messagingengine.com> On Sun, Oct 9, 2016, at 12:33, J?r?me Kieffer wrote: > My question would rather be about the quality of the descriptors ... > in skimage you provide BRIEF, does this mean CENSURE has no specific > keypoint descriptor ? I read a comparison on the OpenCV page that showed CENSURE outperforming SIFT. Unfortunately, that article now no longer seems to be available. But, yes, CENSURE is a keypoint descriptor. St?fan From geazzo at gmail.com Tue Oct 11 14:23:06 2016 From: geazzo at gmail.com (George Azzopardi) Date: Tue, 11 Oct 2016 20:23:06 +0200 Subject: [scikit-image] COSFIRE in skimage? In-Reply-To: <1476209251.998616.752709505.31E31A16@webmail.messagingengine.com> References: <1476209251.998616.752709505.31E31A16@webmail.messagingengine.com> Message-ID: <047B6859-0006-4467-BBA4-2DF3E2E699AA@um.edu.mt> Dear All, Together with my colleagues I developed an approach for object recognition which we call COSFIRE. The approach was published on PAMI: G. Azzopardi and N. Petkov, ?Trainable COSFIRE filters for keypoint detection and pattern recognition?, IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 35 (2), pp. 490-503, 2013. Since its publication we have used it in several applications with successful results. There is already the Matlab code available online: https://nl.mathworks.com/matlabcentral/fileexchange/37395-trainable-cosfire-filters-for-keypoint-detection-and-pattern-recognition I thought it would be great if we could implement it in Python and release it for free in this community. What do you think? Best regards, George From stefanv at berkeley.edu Tue Oct 11 14:31:53 2016 From: stefanv at berkeley.edu (Stefan van der Walt) Date: Tue, 11 Oct 2016 11:31:53 -0700 Subject: [scikit-image] COSFIRE in skimage? In-Reply-To: <047B6859-0006-4467-BBA4-2DF3E2E699AA@um.edu.mt> References: <1476209251.998616.752709505.31E31A16@webmail.messagingengine.com> <047B6859-0006-4467-BBA4-2DF3E2E699AA@um.edu.mt> Message-ID: <1476210713.1003464.752735777.17CCDFB6@webmail.messagingengine.com> Hi George On Tue, Oct 11, 2016, at 11:23, George Azzopardi wrote: > G. Azzopardi and N. Petkov, ?Trainable COSFIRE filters for keypoint > detection and pattern recognition?, IEEE Transactions on Pattern Analysis > and Machine Intelligence, vol. 35 (2), pp. 490-503, 2013. > > Since its publication we have used it in several applications with > successful results. There is already the Matlab code available online: > https://nl.mathworks.com/matlabcentral/fileexchange/37395-trainable-cosfire-filters-for-keypoint-detection-and-pattern-recognition > > I thought it would be great if we could implement it in Python and > release it for free in this community. What do you think? I would love to see a Python version out there, and to have a comparison done with the current keypoint detectors in scikit-image. With the steady increase in citations of your paper, and proof of good performance, I think this could be a good candidate for inclusion in scikit-image. Are you or one of your colleagues/students available to work on the implementation? Best regards St?fan From geazzo at gmail.com Tue Oct 11 14:34:31 2016 From: geazzo at gmail.com (George Azzopardi) Date: Tue, 11 Oct 2016 20:34:31 +0200 Subject: [scikit-image] COSFIRE in skimage? In-Reply-To: <1476210713.1003464.752735777.17CCDFB6@webmail.messagingengine.com> References: <1476209251.998616.752709505.31E31A16@webmail.messagingengine.com> <047B6859-0006-4467-BBA4-2DF3E2E699AA@um.edu.mt> <1476210713.1003464.752735777.17CCDFB6@webmail.messagingengine.com> Message-ID: <71657EF4-BDB1-433D-8909-55DE1094D8F6@gmail.com> Hi Stefan, Thanks for the consideration. Unfortunately, I do not have time myself to implement it and all my students are busy with their dissertations. Could we make an advertisement to the community and perhaps an international student volunteers to implement it? In that case I would be willing to supervise him through Skype. Best regards, George > On 11 Oct 2016, at 20:31, Stefan van der Walt wrote: > > Hi George > > On Tue, Oct 11, 2016, at 11:23, George Azzopardi wrote: >> G. Azzopardi and N. Petkov, ?Trainable COSFIRE filters for keypoint >> detection and pattern recognition?, IEEE Transactions on Pattern Analysis >> and Machine Intelligence, vol. 35 (2), pp. 490-503, 2013. >> >> Since its publication we have used it in several applications with >> successful results. There is already the Matlab code available online: >> https://nl.mathworks.com/matlabcentral/fileexchange/37395-trainable-cosfire-filters-for-keypoint-detection-and-pattern-recognition >> >> I thought it would be great if we could implement it in Python and >> release it for free in this community. What do you think? > > I would love to see a Python version out there, and to have a comparison > done with the current keypoint detectors in scikit-image. With the > steady increase in citations of your paper, and proof of good > performance, I think this could be a good candidate for inclusion in > scikit-image. > > Are you or one of your colleagues/students available to work on the > implementation? > > Best regards > St?fan From stefanv at berkeley.edu Tue Oct 11 14:37:17 2016 From: stefanv at berkeley.edu (Stefan van der Walt) Date: Tue, 11 Oct 2016 11:37:17 -0700 Subject: [scikit-image] COSFIRE in skimage? In-Reply-To: <71657EF4-BDB1-433D-8909-55DE1094D8F6@gmail.com> References: <1476209251.998616.752709505.31E31A16@webmail.messagingengine.com> <047B6859-0006-4467-BBA4-2DF3E2E699AA@um.edu.mt> <1476210713.1003464.752735777.17CCDFB6@webmail.messagingengine.com> <71657EF4-BDB1-433D-8909-55DE1094D8F6@gmail.com> Message-ID: <1476211037.1004490.752742201.67145B25@webmail.messagingengine.com> On Tue, Oct 11, 2016, at 11:34, George Azzopardi wrote: > Hi Stefan, > > Thanks for the consideration. Unfortunately, I do not have time myself to > implement it and all my students are busy with their dissertations. Could > we make an advertisement to the community and perhaps an international > student volunteers to implement it? In that case I would be willing to > supervise him through Skype. We can definitely do that, and if you are willing to mentor a Google Summer of Code project, this would fit perfectly in scope. Otherwise, I can help recruit student volunteers at Berkeley next semester. Best regards St?fan From geazzo at gmail.com Tue Oct 11 14:38:24 2016 From: geazzo at gmail.com (George Azzopardi) Date: Tue, 11 Oct 2016 20:38:24 +0200 Subject: [scikit-image] COSFIRE in skimage? In-Reply-To: <1476211037.1004490.752742201.67145B25@webmail.messagingengine.com> References: <1476209251.998616.752709505.31E31A16@webmail.messagingengine.com> <047B6859-0006-4467-BBA4-2DF3E2E699AA@um.edu.mt> <1476210713.1003464.752735777.17CCDFB6@webmail.messagingengine.com> <71657EF4-BDB1-433D-8909-55DE1094D8F6@gmail.com> <1476211037.1004490.752742201.67145B25@webmail.messagingengine.com> Message-ID: Dear Stefan, I am open for both options. Let me know how to proceed. Best regards, George > On 11 Oct 2016, at 20:37, Stefan van der Walt wrote: > > On Tue, Oct 11, 2016, at 11:34, George Azzopardi wrote: >> Hi Stefan, >> >> Thanks for the consideration. Unfortunately, I do not have time myself to >> implement it and all my students are busy with their dissertations. Could >> we make an advertisement to the community and perhaps an international >> student volunteers to implement it? In that case I would be willing to >> supervise him through Skype. > > We can definitely do that, and if you are willing to mentor a Google > Summer of Code project, this would fit perfectly in scope. Otherwise, I > can help recruit student volunteers at Berkeley next semester. > > Best regards > St?fan From silvertrumpet999 at gmail.com Tue Oct 11 15:03:36 2016 From: silvertrumpet999 at gmail.com (Josh Warner) Date: Tue, 11 Oct 2016 14:03:36 -0500 Subject: [scikit-image] COSFIRE in skimage? In-Reply-To: <1476211037.1004490.752742201.67145B25@webmail.messagingengine.com> References: <1476209251.998616.752709505.31E31A16@webmail.messagingengine.com> <047B6859-0006-4467-BBA4-2DF3E2E699AA@um.edu.mt> <1476210713.1003464.752735777.17CCDFB6@webmail.messagingengine.com> <71657EF4-BDB1-433D-8909-55DE1094D8F6@gmail.com> <1476211037.1004490.752742201.67145B25@webmail.messagingengine.com> Message-ID: If you don't mind officially stating the MATLAB code referenced earlier can be ported and licensed under the 3-clause BSD for scikit-image, we'd have a good place to start. Much faster than clean room. It seems like this is your intent, we just need to have documented that we can port that specific implementation. Josh On Oct 11, 2016 1:43 PM, "Stefan van der Walt" wrote: > On Tue, Oct 11, 2016, at 11:34, George Azzopardi wrote: > > Hi Stefan, > > > > Thanks for the consideration. Unfortunately, I do not have time myself to > > implement it and all my students are busy with their dissertations. Could > > we make an advertisement to the community and perhaps an international > > student volunteers to implement it? In that case I would be willing to > > supervise him through Skype. > > We can definitely do that, and if you are willing to mentor a Google > Summer of Code project, this would fit perfectly in scope. Otherwise, I > can help recruit student volunteers at Berkeley next semester. > > Best regards > St?fan > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefanv at berkeley.edu Tue Oct 11 15:10:20 2016 From: stefanv at berkeley.edu (Stefan van der Walt) Date: Tue, 11 Oct 2016 12:10:20 -0700 Subject: [scikit-image] COSFIRE in skimage? In-Reply-To: References: <1476209251.998616.752709505.31E31A16@webmail.messagingengine.com> <047B6859-0006-4467-BBA4-2DF3E2E699AA@um.edu.mt> <1476210713.1003464.752735777.17CCDFB6@webmail.messagingengine.com> <71657EF4-BDB1-433D-8909-55DE1094D8F6@gmail.com> <1476211037.1004490.752742201.67145B25@webmail.messagingengine.com> Message-ID: <1476213020.1012136.752782561.150F585E@webmail.messagingengine.com> Hi Josh On Tue, Oct 11, 2016, at 12:03, Josh Warner wrote: > If you don't mind officially stating the MATLAB code referenced > earlier can be ported and licensed under the 3-clause BSD for scikit- > image, we'd have a good place to start. Much faster than clean room. I think the code is already BSD-3 licensed: https://www.mathworks.com/matlabcentral/fileexchange/view_license?file_info_id=37395 Would you like to see that in the description as well? Best regards St?fan -------------- next part -------------- An HTML attachment was scrubbed... URL: From silvertrumpet999 at gmail.com Tue Oct 11 16:53:43 2016 From: silvertrumpet999 at gmail.com (Josh Warner) Date: Tue, 11 Oct 2016 15:53:43 -0500 Subject: [scikit-image] COSFIRE in skimage? In-Reply-To: <1476213020.1012136.752782561.150F585E@webmail.messagingengine.com> References: <1476209251.998616.752709505.31E31A16@webmail.messagingengine.com> <047B6859-0006-4467-BBA4-2DF3E2E699AA@um.edu.mt> <1476210713.1003464.752735777.17CCDFB6@webmail.messagingengine.com> <71657EF4-BDB1-433D-8909-55DE1094D8F6@gmail.com> <1476211037.1004490.752742201.67145B25@webmail.messagingengine.com> <1476213020.1012136.752782561.150F585E@webmail.messagingengine.com> Message-ID: The MATLAB File Exchange used to have terms of use that technically applied regardless of what the stated license was. It said essentially that anything downloaded from there could only be used with MATLAB regardless of what the license was, thus blocking ports. To be really safe, you had to not just have the author's permission but obtain the code from an alternative source (email, their site, etc.). However, I just re-read the current TOS, and I can't find those conditions anymore. No idea when that changed, but it looks like we're fine. I'm glad that clause is history. Sorry for the false alarm, Josh On Tue, Oct 11, 2016 at 2:10 PM, Stefan van der Walt wrote: > Hi Josh > > On Tue, Oct 11, 2016, at 12:03, Josh Warner wrote: > > If you don't mind officially stating the MATLAB code referenced earlier > can be ported and licensed under the 3-clause BSD for scikit-image, we'd > have a good place to start. Much faster than clean room. > > > I think the code is already BSD-3 licensed: > > https://www.mathworks.com/matlabcentral/fileexchange/ > view_license?file_info_id=37395 > > Would you like to see that in the description as well? > > Best regards > St?fan > -------------- next part -------------- An HTML attachment was scrubbed... URL: From amaury.dehecq at univ-smb.fr Tue Oct 11 20:51:52 2016 From: amaury.dehecq at univ-smb.fr (Amaury Dehecq) Date: Tue, 11 Oct 2016 17:51:52 -0700 Subject: [scikit-image] Thin-plate spline interpolation In-Reply-To: <1B23BC41-513C-4445-87A4-2C1AEF6B94D3@univ-smb.fr> References: <9128e293-3d19-c8d8-2b86-e4125f98d615@univ-smb.fr> <1475822376.144200.748586633.37436AB4@webmail.messagingengine.com> <1B23BC41-513C-4445-87A4-2C1AEF6B94D3@univ-smb.fr> Message-ID: <60E551CF-07DE-4A2A-928F-1E4FCA822CE5@univ-smb.fr> Hi everyone, I?ve seen on the documentation that there is a plan to implement a thin-plate spline warping function. What are the progress on this side? Thanks, Amaury From stefanv at berkeley.edu Wed Oct 12 01:53:23 2016 From: stefanv at berkeley.edu (Stefan van der Walt) Date: Tue, 11 Oct 2016 22:53:23 -0700 Subject: [scikit-image] Thin-plate spline interpolation In-Reply-To: <60E551CF-07DE-4A2A-928F-1E4FCA822CE5@univ-smb.fr> References: <9128e293-3d19-c8d8-2b86-e4125f98d615@univ-smb.fr> <1475822376.144200.748586633.37436AB4@webmail.messagingengine.com> <1B23BC41-513C-4445-87A4-2C1AEF6B94D3@univ-smb.fr> <60E551CF-07DE-4A2A-928F-1E4FCA822CE5@univ-smb.fr> Message-ID: <1476251603.1153432.753247329.4AA51CDA@webmail.messagingengine.com> Hi Amaury On Tue, Oct 11, 2016, at 17:51, Amaury Dehecq wrote: > I?ve seen on the documentation that there is a plan to implement a > thin-plate spline warping function. What are the progress on this side? Unfortunately, none according to my knowledge. St?fan From nadim.farhat at gmail.com Wed Oct 12 12:31:13 2016 From: nadim.farhat at gmail.com (Nadim Farhat) Date: Wed, 12 Oct 2016 16:31:13 +0000 Subject: [scikit-image] Fast Radon Transform contributing Message-ID: Hi Scikit image community, I am Nadim Farhat, Ph.D. Bioengineering Student at the University of Pittsburgh. I am writing this email to introduce myself as a future contributor also to ask about the status of the Fast Radon Transform that I found from https://github.com/scikit-image/scikit-image/wiki/Requested-features. I would like to implement this feature in scikit-image. Please let me know any feedback or issues. Bests Nadim Farhat PhD. Bioengiengineering Student University of Pittsburgh -- Nadim Farhat -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefanv at berkeley.edu Wed Oct 12 13:37:39 2016 From: stefanv at berkeley.edu (Stefan van der Walt) Date: Wed, 12 Oct 2016 10:37:39 -0700 Subject: [scikit-image] Fast Radon Transform contributing In-Reply-To: References: Message-ID: <1476293859.1791846.753872377.1E2DB49B@webmail.messagingengine.com> Hi Nadim On Wed, Oct 12, 2016, at 09:31, Nadim Farhat wrote: > I am Nadim Farhat, Ph.D. Bioengineering Student at the University of > Pittsburgh. > I am writing this email to introduce myself as a future contributor > also to ask about the status of the Fast Radon Transform that I found > from > https://github.com/scikit-image/scikit-image/wiki/Requested-features. > I would like to implement this feature in scikit-image. Please let me > know any feedback or issues. It's good to meet you, and welcome! I would be happy to put you in touch with others at LBNL doing this type of reconstruction; their perspectives may be helpful. We can also look at adding SIRT (in addition to SART, that's already there). Best regards St?fan -------------- next part -------------- An HTML attachment was scrubbed... URL: From aferust at gmail.com Wed Oct 12 15:00:34 2016 From: aferust at gmail.com (=?UTF-8?Q?Ferhat_KURTULMU=C5=9E?=) Date: Wed, 12 Oct 2016 22:00:34 +0300 Subject: [scikit-image] Fast Radon Transform contributing In-Reply-To: <1476293859.1791846.753872377.1E2DB49B@webmail.messagingengine.com> References: <1476293859.1791846.753872377.1E2DB49B@webmail.messagingengine.com> Message-ID: I love scikit-image but want to unsubscribe from the list. Thanks in advance for any help. On Wed, Oct 12, 2016 at 8:37 PM, Stefan van der Walt wrote: > Hi Nadim > > On Wed, Oct 12, 2016, at 09:31, Nadim Farhat wrote: > > I am Nadim Farhat, Ph.D. Bioengineering Student at the University of > Pittsburgh. > I am writing this email to introduce myself as a future contributor also > to ask about the status of the Fast Radon Transform that I found from > https://github.com/scikit-image/scikit-image/wiki/Requested-features. I > would like to implement this feature in scikit-image. Please let me know > any feedback or issues. > > > It's good to meet you, and welcome! I would be happy to put you in touch > with others at LBNL doing this type of reconstruction; their perspectives > may be helpful. We can also look at adding SIRT (in addition to SART, > that's already there). > > Best regards > St?fan > > > > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nadim.farhat at gmail.com Wed Oct 12 18:16:08 2016 From: nadim.farhat at gmail.com (Nadim Farhat) Date: Wed, 12 Oct 2016 22:16:08 +0000 Subject: [scikit-image] Fast Radon Transform contributing In-Reply-To: <1476293859.1791846.753872377.1E2DB49B@webmail.messagingengine.com> References: <1476293859.1791846.753872377.1E2DB49B@webmail.messagingengine.com> Message-ID: Hi , That sounds great , Thanks Bests Nadim On Wed, Oct 12, 2016 at 1:37 PM Stefan van der Walt wrote: Hi Nadim On Wed, Oct 12, 2016, at 09:31, Nadim Farhat wrote: I am Nadim Farhat, Ph.D. Bioengineering Student at the University of Pittsburgh. I am writing this email to introduce myself as a future contributor also to ask about the status of the Fast Radon Transform that I found from https://github.com/scikit-image/scikit-image/wiki/Requested-features. I would like to implement this feature in scikit-image. Please let me know any feedback or issues. It's good to meet you, and welcome! I would be happy to put you in touch with others at LBNL doing this type of reconstruction; their perspectives may be helpful. We can also look at adding SIRT (in addition to SART, that's already there). Best regards St?fan _______________________________________________ scikit-image mailing list scikit-image at python.org https://mail.python.org/mailman/listinfo/scikit-image -- Nadim Farhat -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Fri Oct 14 09:40:44 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Fri, 14 Oct 2016 13:40:44 +0000 Subject: [scikit-image] Fast Radon Transform contributing In-Reply-To: References: <1476293859.1791846.753872377.1E2DB49B@webmail.messagingengine.com> Message-ID: It would also be good to touch base with the tomopy developers ( https://tomopy.github.io/tomopy/resources/tomopy.algorithms.recon.html) Tom On Wed, Oct 12, 2016 at 6:16 PM Nadim Farhat wrote: > Hi , > > That sounds great , Thanks > > Bests > > Nadim > > > On Wed, Oct 12, 2016 at 1:37 PM Stefan van der Walt > wrote: > > Hi Nadim > > On Wed, Oct 12, 2016, at 09:31, Nadim Farhat wrote: > > I am Nadim Farhat, Ph.D. Bioengineering Student at the University of > Pittsburgh. > I am writing this email to introduce myself as a future contributor also > to ask about the status of the Fast Radon Transform that I found from > https://github.com/scikit-image/scikit-image/wiki/Requested-features. I > would like to implement this feature in scikit-image. Please let me know > any feedback or issues. > > > It's good to meet you, and welcome! I would be happy to put you in touch > with others at LBNL doing this type of reconstruction; their perspectives > may be helpful. We can also look at adding SIRT (in addition to SART, > that's already there). > > Best regards > St?fan > > > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image > > -- > Nadim Farhat > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jslavin at cfa.harvard.edu Tue Oct 18 14:57:42 2016 From: jslavin at cfa.harvard.edu (Slavin, Jonathan) Date: Tue, 18 Oct 2016 14:57:42 -0400 Subject: [scikit-image] find grid points inside verts Message-ID: Hi all, I'm wondering if there is some routine that will do in 3D what grid_points_in_poly() does in 2D. That is, I'd like to use the results of a call to marching_cubes(), i.e. an array of verts, and determine which grid points in the input volume that was provided as input to marching_cubes are inside of the surface defined by those verts. Any help would be appreciated. ?Regards, Jon? -- ________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA jslavin at cfa.harvard.edu 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA ________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From lchenudc at gmail.com Sun Oct 23 21:15:45 2016 From: lchenudc at gmail.com (Lee Chen) Date: Sun, 23 Oct 2016 20:15:45 -0500 Subject: [scikit-image] find grid points inside verts In-Reply-To: References: Message-ID: This is an interesting question. Can you try to use grid_points_in_poly() for each slice of 3D. It may be slower. I think there is a mathematical extension on this. But I do not know the actual formula. Li Chen www.udc.edu/prof/chen Does anyone know SciKit work with Spark (Python version)? On Tue, Oct 18, 2016 at 1:57 PM, Slavin, Jonathan wrote: > Hi all, > > I'm wondering if there is some routine that will do in 3D what > grid_points_in_poly() does in 2D. That is, I'd like to use the results of > a call to marching_cubes(), i.e. an array of verts, and determine which > grid points in the input volume that was provided as input to > marching_cubes are inside of the surface defined by those verts. Any help > would be appreciated. > > ?Regards, > Jon? > > -- > ________________________________________________________ > Jonathan D. Slavin Harvard-Smithsonian CfA > jslavin at cfa.harvard.edu 60 Garden Street, MS 83 > phone: (617) 496-7981 Cambridge, MA 02138-1516 > cell: (781) 363-0035 USA > ________________________________________________________ > > > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jni.soma at gmail.com Tue Oct 25 18:43:57 2016 From: jni.soma at gmail.com (Juan Nunez-Iglesias) Date: Tue, 25 Oct 2016 15:43:57 -0700 Subject: [scikit-image] GUI Python Image Processing Scikit-image In-Reply-To: References: Message-ID: Hi Xavi, Sorry for the long delay in responding. I'm excited about your GUI! If you have it on GitHub somewhere, please point us to it, as it would be a great template for others to build from! Regarding your black image problem, my guess is that you are having some issues with the data types in skimage. Your input image is a uint8 image (?), with range [0, 255], but filters.gaussian runs it through our conversion to a float image, which results in the range [0.0, 1.0]. Some displays will still display this as though the full range is in [0, 255], so the image will appear black. You probably need to back-convert to int using skimage.img_as_ubyte. See: http://scikit-image.org/docs/dev/user_guide/data_types.html I hope that helps. Again, please point us to your repo if you are happy to share! Juan. On 8 October 2016 at 8:12:13 am, xavi barrull (xavi_barrull at hotmail.com) wrote: Hi, I have a question about scikit image. I make a GUI in python to processing image, but I will change the gaussian Filter in opencv to scikit image, I use this function: def gaussFilter(self): targetTemp = sk.io.imread(self.original_path)# llegir imatge targetTemp a la ruta original targetTemp = sk.filters.gaussian(targetTemp, sigma=0, mode='reflect', cval=0, multichannel=False) #targetTemp = cv2.GaussianBlur(targetTemp,(sigmaX, sigmaY), 0) cv2.imwrite(self.target_path,targetTemp) self.updateTargetImage() But, when I press the button of gaussian filter the image to update becomes black, what is the problem? I need a solution for this! My code show bellow: import Tkinter as tk import numpy as np import tkFileDialog import tkMessageBox import shutil import os from PIL import Image, ImageTk, ImageFilter import cv2 import colormaps import skimage as sk import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap from matplotlib.figure import Figure from skimage import filters from skimage import io from skimage.morphology import disk from skimage.filters.rank import median from skimage.filters import gaussian from skimage.morphology import watershed from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg class App(tk.Frame): size = 500, 700 # get past scale value past=1 # inicialitzar app def __init__(self, master): tk.Frame.__init__(self, master) self.grid(row=0) self.columnconfigure(0, weight=1) self.rowconfigure(0, weight=1) master.geometry("1024x768") self.generateMenu(master) # Generacio Menu def generateMenu(self, master): # crear barra menu, dins de la llibreria TKinter (tk.) self.menuBar=tk.Menu(self) # creacio arxiu dins de la barra de menu self.fileMenu=tk.Menu(self.menuBar, tearoff=0) # crear commandes obrir, guardar i tancar, l'estat de guardar esta desactivat mentre no s'obri una imatge self.fileMenu.add_command(label="Open", command=self.open) self.fileMenu.add_command(label="Save", command=self.save, state="disabled") self.fileMenu.add_command(label="Close", command=self.exit) # Afegim tot aixo la barra de menu en cascada self.menuBar.add_cascade(label="File", menu=self.fileMenu) # Crear menu de process self.processMenu=tk.Menu(self.menuBar, tearoff=0) # crear submenu de processs/filter self.processFilterSubMenu = tk.Menu(self.processMenu, tearoff=0) self.processFilterSubMenu.add_command(label="Gaussian Filter", command=self.gaussFilter, state="disabled") self.processFilterSubMenu.add_command(label="Median Filter", command=self.medianFilter, state="disabled") self.processMenu.add_cascade(label="Process/Filter", menu=self.processFilterSubMenu, underline=0) # crear submenu segmentacio self.segmentationSubMenu = tk.Menu(self.processMenu, tearoff=0) self.segmentationSubMenu.add_command(label="Watershed", command=self.watershed, state="disabled") self.segmentationSubMenu.add_command(label="Random walker", command=self.randomwalker, state="disabled") self.processMenu.add_cascade(label="Segmentation", menu=self.segmentationSubMenu, underline=0) # crear submenu edgeDetection self.edgeDetectionSubMenu = tk.Menu(self.processMenu, tearoff=0) self.edgeDetectionSubMenu.add_command(label="Sobel", command=self.sobel, state="disabled") self.edgeDetectionSubMenu.add_command(label="Laplacian", command=self.laplacian, state="disabled") self.edgeDetectionSubMenu.add_command(label="Canny", command=self.canny, state="disabled") self.processMenu.add_cascade(label="Edge Detection", menu=self.edgeDetectionSubMenu, underline=0) # crear submenu change colormap self.colorMapSubMenu = tk.Menu(self.processMenu, tearoff=0) self.colorMapSubMenu.add_command(label="None", command=self.none, state="disabled") self.colorMapSubMenu.add_command(label="Plasma", command=self.plasma, state="disabled") self.colorMapSubMenu.add_command(label="Inferno", command=self.inferno, state="disabled") self.colorMapSubMenu.add_command(label="Viridis", command=self.viridis, state="disabled") self.processMenu.add_cascade(label="Change Colormap", menu=self.colorMapSubMenu, underline=0) self.menuBar.add_cascade(label="Process", menu=self.processMenu) master.config(menu=self.menuBar) # No colorMap def none(self): targetTemp = cv2.imread(self.original_path) cv2.imwrite(self.target_path,targetTemp)# guarda imatge targetTemp i a la ruta de desti self.updateTargetImage() # Plasma colorMap def plasma(self): plt.clf()#esborra imatge targetTemp targetTemp = cv2.imread(self.original_path) # llegir ruta original (carpeta on es troba arxiu py) targetTemp = np.fliplr(targetTemp[:,:,0]) # gir esquerra a dreta imatge original, segons 3r valor matriu, varia tonalitat plasma = ListedColormap(colormaps._plasma_data, name='plasma') plt.axis('off')#desactiva eixos a la imatge plt.register_cmap(name='plasma', cmap=plasma) # registrar colormap nou i aplicar-lo imgplot = plt.imshow(targetTemp)#mostrar imatge allotjada a targetTemp imgplot.set_cmap(plasma)#aplicar colormap imgplot.figure.savefig(self.target_path)#guardar imatge com a figura a la ruta de desti self.updateTargetImage() #actualitzar la imatge (amb aplicacio del colormap) def viridis(self): plt.clf() #esborra imatge targetTemp targetTemp = cv2.imread(self.original_path) targetTemp = np.fliplr(targetTemp[:,:,0]) viridis = ListedColormap(colormaps._viridis_data, name='viridis') plt.axis('off') plt.register_cmap(name='viridis', cmap=viridis) imgplot = plt.imshow(targetTemp) imgplot.set_cmap(viridis) imgplot.figure.savefig(self.target_path) # update target screen self.updateTargetImage() def inferno(self): plt.clf() targetTemp = cv2.imread(self.original_path) targetTemp = np.fliplr(targetTemp[:,:,0]) inferno = ListedColormap(colormaps._inferno_data, name='inferno') plt.axis('off') plt.register_cmap(name='inferno', cmap=inferno) imgplot = plt.imshow(targetTemp) imgplot.set_cmap(inferno) imgplot.figure.savefig(self.target_path) self.updateTargetImage() # funcio per obrir arxius def open(self): # obrir arxiu des del quadre de dialeg self.original_path = tkFileDialog.askopenfilename(filetypes=[("Image Files","*.jpg;*.jpeg;*.png;*.gif")]) if self.original_path!="": # si es selecciona un arxiu, s'activen totes les comandes del menu self.fileMenu.entryconfig("Save", state="normal") self.processFilterSubMenu.entryconfig("Gaussian Filter", state="normal") self.processFilterSubMenu.entryconfig("Median Filter", state="normal") self.segmentationSubMenu.entryconfig("Watershed", state="normal") self.segmentationSubMenu.entryconfig("Random walker", state="normal") self.edgeDetectionSubMenu.entryconfig("Sobel", state="normal") self.edgeDetectionSubMenu.entryconfig("Laplacian", state="normal") self.edgeDetectionSubMenu.entryconfig("Canny", state="normal") self.colorMapSubMenu.entryconfig("None", state="normal") self.colorMapSubMenu.entryconfig("Plasma", state="normal") self.colorMapSubMenu.entryconfig("Inferno", state="normal") self.colorMapSubMenu.entryconfig("Viridis", state="normal") saveButton = tk.Button(self, text="Save", command=self.save) saveButton.grid(row=7, column=10) self.actual_name = self.original_path[self.original_path.rfind("/"):self.original_path.rfind(".")] #creacio arxiu temporal de la imatge que hem obert self.target_path = self.original_path[0:self.original_path.rfind(".")]+"imatge."+self.original_path[self.original_path.rfind(".")+1:] shutil.copy2(self.original_path, self.target_path) #copia l'arxiu de la ruta original #os.popen('attrib +h ' + self.target_path) self.originalImg = Image.open(self.original_path) #obrir imatge original self.originalImg.thumbnail(App.size, Image.ANTIALIAS) #thumbnail-> aplica mida imatge escalada a la finestra App.size originalImgCanvas = tk.Canvas(self, width= 500, height=380) # aplica la mida especificada a la imatge original originalImgCanvas.grid(row=3, column=2, columnspan=6) # la posiciona dins del grid a la fila 3 i la columna 2, abasta 6 columnes tkOriginalImg = ImageTk.PhotoImage(self.originalImg) # mostra la imatge original self.originalImg.image = tkOriginalImg # associa la imatge original a la imatge dins la llibreria tkinter originalImgCanvas.create_image(100,100,image=tkOriginalImg, anchor=tk.NW, tags="IMG") # crea la imatge anterior amb amplada nord-oest dins del widget de Canvas que disposa d'estructures grafiques self.targetImg = Image.open(self.target_path)# obrir imatge a procesar self.targetImg.thumbnail(App.size, Image.ANTIALIAS) #thumbnail-> aplica mida imatge escalada a la finestra App.size self.targetImgCanvas = tk.Canvas(self, width= 500, height=380) self.targetImgCanvas.grid(row=3, column=8, columnspan=6) self.tkTargetImg = ImageTk.PhotoImage(self.targetImg) self.targetImg.image = self.tkTargetImg self.targetImgCanvas.create_image(100,100,image=self.tkTargetImg, anchor=tk.NW) # source histogram #originalCvImg = cv2.imread(self.original_path) #plt.figure(figsize=(2,2)) #color = ('b','g','r') #for channel,col in enumerate(color): # histr = cv2.calcHist([originalCvImg],[channel],None,[256],[0,256]) # plt.plot(histr,color = col) # plt.xlim([0,256]) # if( col == 'b'): # originalB=plt.imshow(histr).figure # elif( col == 'g'): # originalG=plt.imshow(histr).figure # else: # originalR=plt.imshow(histr).figure #self.NewCanvas = tk.Canvas(self, width= 30, height=50) #self.canvas = FigureCanvasTkAgg(originalR, master=self.NewCanvas) #self.NewCanvas.grid(row=4, column=0) #self.canvas.show() #self.canvas.get_tk_widget().grid(row=0, column=0) # target histogram #targetCvImg = cv2.imread(self.target_path) #plt.figure(figsize=(2,2)) #color = ('b','g','r') #for channel,col in enumerate(color): # histr = cv2.calcHist([targetCvImg],[channel],None,[256],[0,256]) # plt.plot(histr,color = col) # plt.xlim([0,256]) # if( col == 'b'): # targetB=plt.imshow(histr).figure # elif( col == 'g'): # targetG=plt.imshow(histr).figure # else: # targetR=plt.imshow(histr).figure #self.NewTargetCanvas = tk.Canvas(self, width= 30, height=50) #self.canvasTarget = FigureCanvasTkAgg(targetR, master=self.NewTargetCanvas) #self.NewTargetCanvas.grid(row=4, column=1) #self.canvasTarget.show() #self.canvasTarget.get_tk_widget().grid(row=0, column=0) # to have only odd value in scale def fix(self, xy, n): #no entenc que fa aquesta funcio! global past n = int(n) if not n % 2: if xy=="sx": scale = self.gaussianSigmaXScale elif xy=="sy": scale = self.gaussianSigmaYScale elif xy=="median": scale = self.medianSizeScale else: scale = self.kernelSizeScale scale.set(n+1 if n > self.past else n-1) self.past = scale.get() # funcio per guardar imatges procesades def save(self): if tkMessageBox.askokcancel("Save", "Do you want to save?"): os.remove(self.original_path)# esborra arxiu original de la ruta de desti os.popen('attrib -h -s ' + self.target_path)# obre arxiu target de # la ruta de desti, correspon imatge a processar os.rename(self.target_path, self.original_path) #renombra # la imatge original i la imatge a processar shutil.copy2(self.original_path, self.target_path) #copia l'arxiu # de la ruta original i tambe la imatge a processar (target) os.popen('attrib +h ' + self.target_path) # sortir del GUI def exit(self): if tkMessageBox.askokcancel("Quit", "Do you want to quit?"): try: # esborrar arxiu temporal os.remove(self.target_path) finally: self.master.destroy() def updateTargetImage(self): # funcio per actualitzar les diferents accio a la imatge a procesar self.targetImg = Image.open(self.target_path) # obre la imatge a procesar, en la ruta on es troba self.targetImg.thumbnail(App.size, Image.ANTIALIAS) #thumbnail-> aplica mida imatge escalada a la finestra App.size self.tkTargetImg = ImageTk.PhotoImage(self.targetImg)# mostra la imatge a procesar self.targetImg.image = self.tkTargetImg # associa la imatge a procesar a la imatge dins la llibreria Tkinter (que allotja tot el referent al GUI) self.targetImgCanvas.create_image(5,5,image=self.tkTargetImg, anchor=tk.NW, tags="IMG") # crea la #imatge a procesar quan se li aplica algun canvi (colormap, filtres, etc) targetCvImg = cv2.imread(self.target_path) # llegeix la imatge de la ruta de desti plt.figure(figsize=(4,4)) # crea una figura per allotjar histograma color = ('b','g','r') for i,col in enumerate(color): histr = cv2.calcHist([targetCvImg],[i],None,[256],[0,256]) plt.plot(histr,color = col) plt.xlim([0,256]) targetR=plt.imshow(histr).figure self.NewTargetCanvas = tk.Canvas(self, width= 30, height=50) #crea un nou # Canvas de la mida indicada self.canvasTarget = FigureCanvasTkAgg(targetR, master=self.NewTargetCanvas) #crea una figura dins del Canvas on s'allotja el histograma self.NewTargetCanvas.grid(row=4, column=1)# defineix posicio del grid dins el # Canvas self.canvasTarget.show() # mostra el canvas self.canvasTarget.get_tk_widget().grid(row=0, column=0) def gaussFilter(self): targetTemp = sk.io.imread(self.original_path)# llegir imatge targetTemp a la ruta original targetTemp = sk.filters.gaussian(targetTemp, sigma=0, mode='reflect', cval=0, multichannel=False) #targetTemp = cv2.GaussianBlur(targetTemp,(sigmaX, sigmaY), 0)#aplicar filtre cv2.imwrite(self.target_path,targetTemp) # actualitzar imatge Target self.updateTargetImage() My code is so long (There are another functions or filters (Sobel, Canny, etc...) I paste the finally: def on_closing(app, root): if tkMessageBox.askokcancel("Quit", "Do you want to quit?"): try: os.remove(app.target_path) except: print("error") finally: root.destroy() # inicialitzar llibreria Tkinter per creacio widget root=tk.Tk() app = App(root) # renderitzar GUI, to accept events root.protocol("WM_DELETE_WINDOW", lambda: on_closing(app, root)) app.mainloop() I attached image about my problema I need help, it's so urgent! Thanks in advance. Xavi. _______________________________________________ scikit-image mailing list scikit-image at python.org https://mail.python.org/mailman/listinfo/scikit-image -------------- next part -------------- An HTML attachment was scrubbed... URL: From jslavin at cfa.harvard.edu Mon Oct 31 16:46:31 2016 From: jslavin at cfa.harvard.edu (Slavin, Jonathan) Date: Mon, 31 Oct 2016 16:46:31 -0400 Subject: [scikit-image] find grid points inside verts In-Reply-To: References: Message-ID: Li, So are you saying to use a slice, get a contour, e.g. with get_contour, and then use grid_points_in_poly()? I suppose that could work for part of the volume, but I would question its effectiveness for my case (quasi-spherical surface in 3D cartesian coordinates) in regions where the slice and surface are close to parallel. If I could get surfaces that are, say phi=const. surfaces, that include the origin then that could work, but then that require an interpolation onto each grid, and to cover all the voxels, I'd need many surfaces. A different thought I had was to generate a ray using methods in yt, for each voxel and find the outermost position along the ray where the surface value is obtained. That could also be very slow, but for my case, I could limit it by only doing that calculation for voxels where the value (in my case pressure) is below the surface value, since all the voxels with pressure above that value, are inside the outer surface. It would be nice to have a more general solution if such a thing exists (which seems likely). Regards, Jon On Sun, Oct 23, 2016 at 9:15 PM, Lee Chen wrote: > This is an interesting question. Can you try to use grid_points_in_poly() > for each slice of 3D. It may be slower. I think there is a mathematical > extension on this. But I do not know the actual formula. > > Li Chen > www.udc.edu/prof/chen > > > Does anyone know SciKit work with Spark (Python version)? > > > On Tue, Oct 18, 2016 at 1:57 PM, Slavin, Jonathan > wrote: > >> Hi all, >> >> I'm wondering if there is some routine that will do in 3D what >> grid_points_in_poly() does in 2D. That is, I'd like to use the results of >> a call to marching_cubes(), i.e. an array of verts, and determine which >> grid points in the input volume that was provided as input to >> marching_cubes are inside of the surface defined by those verts. Any help >> would be appreciated. >> >> ?Regards, >> Jon? >> >> -- >> ________________________________________________________ >> Jonathan D. Slavin Harvard-Smithsonian CfA >> jslavin at cfa.harvard.edu 60 Garden Street, MS 83 >> phone: (617) 496-7981 Cambridge, MA 02138-1516 >> cell: (781) 363-0035 USA >> ________________________________________________________ >> >> >> _______________________________________________ >> scikit-image mailing list >> scikit-image at python.org >> https://mail.python.org/mailman/listinfo/scikit-image >> >> > -- ________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA jslavin at cfa.harvard.edu 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA ________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefanv at berkeley.edu Mon Oct 31 17:09:26 2016 From: stefanv at berkeley.edu (Stefan van der Walt) Date: Mon, 31 Oct 2016 14:09:26 -0700 Subject: [scikit-image] GUI Python Image Processing Scikit-image In-Reply-To: References: Message-ID: <1477948166.1323820.773111313.5F562FEE@webmail.messagingengine.com> This reminds me that we have a whole GUI viewer toolkit that's not seen a lot of love and attention lately. I recently ported it to Qt5, but still have to submit cleaned up patches. That got me thinking that it would be nice to have this in a browser, in a Jupyter notebook. So I sent an email to the developers, and it looks like they've now more-or- less completed their widgets API, and it should be mostly backward compatible from version 6 onward. Shall we re-open the discussion on writing interactive Javascript widgets? I'm thinking of a Fiji or Gimp-like application that showcases various pieces of functionality. St?fan On Tue, Oct 25, 2016, at 15:43, Juan Nunez-Iglesias wrote: > Hi Xavi, > > Sorry for the long delay in responding. > > I'm excited about your GUI! If you have it on GitHub somewhere, > please point us to it, as it would be a great template for others to > build from! > > Regarding your black image problem, my guess is that you are having > some issues with the data types in skimage. Your input image is a > uint8 image (?), with range [0, 255], but filters.gaussian runs it > through our conversion to a float image, which results in the range > [0.0, 1.0]. Some displays will still display this as though the full > range is in [0, 255], so the image will appear black. You probably > need to back-convert to int using skimage.img_as_ubyte. > > See: > http://scikit-image.org/docs/dev/user_guide/data_types.html > > I hope that helps. Again, please point us to your repo if you are > happy to share! > > Juan. > > > On 8 October 2016 at 8:12:13 am, xavi barrull > (xavi_barrull at hotmail.com) wrote: >> >> >> >> Hi, I have a question about scikit image. >> I make a GUI in python to processing image, but I will change the >> gaussian Filter in opencv to scikit image, I use this function: >> >> def gaussFilter(self): targetTemp = >> sk.io.imread(self.original_path)# llegir imatge targetTemp a la ruta >> original targetTemp = sk.filters.gaussian(targetTemp, >> sigma=0, mode='reflect', cval=0, multichannel=False) >> #targetTemp = cv2.GaussianBlur(targetTemp,(sigmaX, sigmaY), 0) >> cv2.imwrite(self.target_path,targetTemp) >> self.updateTargetImage() >> >> But, when I press the button of gaussian filter the image to update >> becomes black, what is the problem? I need a solution for this! >> >> My code show bellow: >> >> >> import Tkinter as tk import numpy as np import tkFileDialog import >> tkMessageBox import shutil import os from PIL import Image, ImageTk, >> ImageFilter import cv2 import colormaps import skimage as sk import >> matplotlib.pyplot as plt from matplotlib.colors import ListedColormap >> from matplotlib.figure import Figure from skimage import filters from >> skimage import io from skimage.morphology import disk from >> skimage.filters.rank import median from skimage.filters import >> gaussian from skimage.morphology import watershed from >> matplotlib.backends.backend_tkagg import FigureCanvasTkAgg >> >> class App(tk.Frame): size = 500, 700 >> # get past scale value >> past=1 >> # inicialitzar app >> def __init__(self, master): tk.Frame.__init__(self, master) >> self.grid(row=0) self.columnconfigure(0, weight=1) >> self.rowconfigure(0, weight=1) master.geometry("1024x768") >> self.generateMenu(master) >> # Generacio Menu >> def generateMenu(self, master): >> # crear barra menu, dins de la llibreria TKinter (tk.) >> self.menuBar=tk.Menu(self) >> # creacio arxiu dins de la barra de menu >> self.fileMenu=tk.Menu(self.menuBar, tearoff=0) >> # crear commandes obrir, guardar i tancar, l'estat de >> # guardar esta desactivat mentre no s'obri una imatge >> self.fileMenu.add_command(label="Open", command=self.open) >> self.fileMenu.add_command(label="Save", command=self.save, >> state="disabled") self.fileMenu.add_command(label="Close", >> command=self.exit) >> # Afegim tot aixo la barra de menu en cascada >> self.menuBar.add_cascade(label="File", menu=self.fileMenu) >> # Crear menu de process >> self.processMenu=tk.Menu(self.menuBar, tearoff=0) >> # crear submenu de processs/filter >> self.processFilterSubMenu = tk.Menu(self.processMenu, >> tearoff=0) >> self.processFilterSubMenu.add_command(label="Gaussian >> Filter", command=self.gaussFilter, state="disabled") >> self.processFilterSubMenu.add_command(label="Median Filter", >> command=self.medianFilter, state="disabled") >> self.processMenu.add_cascade(label="Process/Filter", >> menu=self.processFilterSubMenu, underline=0) >> # crear submenu segmentacio >> self.segmentationSubMenu = tk.Menu(self.processMenu, >> tearoff=0) >> self.segmentationSubMenu.add_command(label="Watershed", >> command=self.watershed, state="disabled") >> self.segmentationSubMenu.add_command(label="Random walker", >> command=self.randomwalker, state="disabled") >> self.processMenu.add_cascade(label="Segmentation", >> menu=self.segmentationSubMenu, underline=0) >> # crear submenu edgeDetection >> self.edgeDetectionSubMenu = tk.Menu(self.processMenu, >> tearoff=0) >> self.edgeDetectionSubMenu.add_command(label="Sobel", >> command=self.sobel, state="disabled") >> self.edgeDetectionSubMenu.add_command(label="Laplacian", >> command=self.laplacian, state="disabled") >> self.edgeDetectionSubMenu.add_command(label="Canny", >> command=self.canny, state="disabled") >> self.processMenu.add_cascade(label="Edge Detection", >> menu=self.edgeDetectionSubMenu, underline=0) >> # crear submenu change colormap >> self.colorMapSubMenu = tk.Menu(self.processMenu, tearoff=0) >> self.colorMapSubMenu.add_command(label="None", >> command=self.none, state="disabled") >> self.colorMapSubMenu.add_command(label="Plasma", >> command=self.plasma, state="disabled") >> self.colorMapSubMenu.add_command(label="Inferno", >> command=self.inferno, state="disabled") >> self.colorMapSubMenu.add_command(label="Viridis", >> command=self.viridis, state="disabled") >> self.processMenu.add_cascade(label="Change Colormap", >> menu=self.colorMapSubMenu, underline=0) >> >> self.menuBar.add_cascade(label="Process", >> menu=self.processMenu) master.config(menu=self.menuBar) >> # No colorMap >> def none(self): targetTemp = cv2.imread(self.original_path) >> cv2.imwrite(self.target_path,targetTemp)# guarda imatge >> targetTemp i a la ruta de desti self.updateTargetImage() >> # Plasma colorMap >> def plasma(self): plt.clf()#esborra imatge targetTemp >> targetTemp = cv2.imread(self.original_path) # llegir ruta >> original (carpeta on es troba arxiu py) targetTemp = >> np.fliplr(targetTemp[:,:,0]) # gir esquerra a dreta imatge >> original, segons 3r valor matriu, varia tonalitat >> >> plasma = ListedColormap(colormaps._plasma_data, >> name='plasma') plt.axis('off')#desactiva eixos a la imatge >> plt.register_cmap(name='plasma', cmap=plasma) # registrar >> colormap nou i aplicar-lo imgplot = >> plt.imshow(targetTemp)#mostrar imatge allotjada a targetTemp >> imgplot.set_cmap(plasma)#aplicar colormap >> imgplot.figure.savefig(self.target_path)#guardar imatge com >> a figura a la ruta de desti >> >> self.updateTargetImage() #actualitzar la imatge (amb >> aplicacio del colormap) def viridis(self): plt.clf() >> #esborra imatge targetTemp targetTemp = >> cv2.imread(self.original_path) targetTemp = >> np.fliplr(targetTemp[:,:,0]) >> >> viridis = ListedColormap(colormaps._viridis_data, >> name='viridis') plt.axis('off') >> plt.register_cmap(name='viridis', cmap=viridis) imgplot = >> plt.imshow(targetTemp) imgplot.set_cmap(viridis) >> imgplot.figure.savefig(self.target_path) >> # update target screen >> self.updateTargetImage() def inferno(self): plt.clf() >> targetTemp = cv2.imread(self.original_path) targetTemp = >> np.fliplr(targetTemp[:,:,0]) >> >> inferno = ListedColormap(colormaps._inferno_data, >> name='inferno') plt.axis('off') >> plt.register_cmap(name='inferno', cmap=inferno) imgplot = >> plt.imshow(targetTemp) imgplot.set_cmap(inferno) >> imgplot.figure.savefig(self.target_path) >> self.updateTargetImage() >> >> # funcio per obrir arxius >> def open(self): >> # obrir arxiu des del quadre de dialeg >> self.original_path = >> tkFileDialog.askopenfilename(filetypes=[("Image >> Files","*.jpg;*.jpeg;*.png;*.gif")]) if >> self.original_path!="": # si es selecciona un arxiu, >> s'activen totes les comandes del menu >> self.fileMenu.entryconfig("Save", state="normal") >> self.processFilterSubMenu.entryconfig("Gaussian Filter", >> state="normal") >> self.processFilterSubMenu.entryconfig("Median Filter", >> state="normal") >> self.segmentationSubMenu.entryconfig("Watershed", >> state="normal") >> self.segmentationSubMenu.entryconfig("Random walker", >> state="normal") >> self.edgeDetectionSubMenu.entryconfig("Sobel", >> state="normal") >> self.edgeDetectionSubMenu.entryconfig("Laplacian", >> state="normal") >> self.edgeDetectionSubMenu.entryconfig("Canny", >> state="normal") self.colorMapSubMenu.entryconfig("None", >> state="normal") >> self.colorMapSubMenu.entryconfig("Plasma", state="normal") >> self.colorMapSubMenu.entryconfig("Inferno", state="normal") >> self.colorMapSubMenu.entryconfig("Viridis", state="normal") >> >> saveButton = tk.Button(self, text="Save", >> command=self.save) saveButton.grid(row=7, column=10) >> self.actual_name = self.original_path[self.original_pat- >> h.rfind("/"):self.original_path.rfind(".")] #creacio >> arxiu temporal de la imatge que hem obert >> self.target_path = self.original_path[0:self.original_p- >> ath.rfind(".")]+"imatge."+self.original_path[self.origi- >> nal_path.rfind(".")+1:] shutil.copy2(self.original_path, >> self.target_path) #copia l'arxiu de la ruta original >> #os.popen('attrib +h ' + self.target_path) >> self.originalImg = Image.open(self.original_path) #obrir >> imatge original self.originalImg.thumbnail(App.size, >> Image.ANTIALIAS) #thumbnail-> aplica mida imatge >> escalada a la finestra App.size originalImgCanvas = >> tk.Canvas(self, width= 500, height=380) # aplica la mida >> especificada a la imatge original >> originalImgCanvas.grid(row=3, column=2, columnspan=6) # >> la posiciona dins del grid a la fila 3 i la columna 2, >> abasta 6 columnes tkOriginalImg = >> ImageTk.PhotoImage(self.originalImg) # mostra la imatge >> original self.originalImg.image = tkOriginalImg # >> associa la imatge original a la imatge dins la llibreria >> tkinter originalImgCanvas.create_image(100,100,image=tk- >> OriginalImg, anchor=tk.NW, tags="IMG") # crea la imatge >> anterior amb amplada nord-oest dins del widget de Canvas >> que disposa d'estructures grafiques >> >> self.targetImg = Image.open(self.target_path)# obrir >> imatge a procesar self.targetImg.thumbnail(App.size, >> Image.ANTIALIAS) #thumbnail-> aplica mida imatge >> escalada a la finestra App.size self.targetImgCanvas = >> tk.Canvas(self, width= 500, height=380) >> self.targetImgCanvas.grid(row=3, column=8, columnspan=6) >> self.tkTargetImg = ImageTk.PhotoImage(self.targetImg) >> self.targetImg.image = self.tkTargetImg self.targetImgC- >> anvas.create_image(100,100,image=self.tkTargetImg, >> anchor=tk.NW) >> # source histogram >> #originalCvImg = cv2.imread(self.original_path) >> #plt.figure(figsize=(2,2)) #color = ('b','g','r') #for >> channel,col in enumerate(color): >> # histr = cv2.calcHist([originalCvImg],[channel],Non- >> # e,[256],[0,256]) plt.plot(histr,color = col) >> # plt.xlim([0,256]) if( col == 'b'): >> # originalB=plt.imshow(histr).figure elif( col == >> # 'g'): originalG=plt.imshow(histr).figure else: >> # originalR=plt.imshow(histr).figure >> #self.NewCanvas = tk.Canvas(self, width= 30, height=50) >> #self.canvas = FigureCanvasTkAgg(originalR, >> master=self.NewCanvas) #self.NewCanvas.grid(row=4, >> column=0) #self.canvas.show() >> #self.canvas.get_tk_widget().grid(row=0, column=0) >> >> # target histogram >> #targetCvImg = cv2.imread(self.target_path) >> #plt.figure(figsize=(2,2)) #color = ('b','g','r') #for >> channel,col in enumerate(color): >> # histr = cv2.calcHist([targetCvImg],[channel],None,[- >> # 256],[0,256]) plt.plot(histr,color = col) >> # plt.xlim([0,256]) if( col == 'b'): >> # targetB=plt.imshow(histr).figure elif( col == 'g'): >> # targetG=plt.imshow(histr).figure else: >> # targetR=plt.imshow(histr).figure >> #self.NewTargetCanvas = tk.Canvas(self, width= 30, >> height=50) #self.canvasTarget = >> FigureCanvasTkAgg(targetR, master=self.NewTargetCanvas) >> #self.NewTargetCanvas.grid(row=4, column=1) >> #self.canvasTarget.show() >> #self.canvasTarget.get_tk_widget().grid(row=0, column=0) >> # to have only odd value in scale >> def fix(self, xy, n): #no entenc que fa aquesta funcio! >> global past n = int(n) if not n % 2: if xy=="sx": >> scale = self.gaussianSigmaXScale elif xy=="sy": >> scale = self.gaussianSigmaYScale elif xy=="median": >> scale = self.medianSizeScale else: scale = >> self.kernelSizeScale scale.set(n+1 if n > self.past else >> n-1) self.past = scale.get() >> # funcio per guardar imatges procesades >> def save(self): if tkMessageBox.askokcancel("Save", "Do you >> want to save?"): os.remove(self.original_path)# esborra >> arxiu original de la ruta de desti os.popen('attrib -h -s >> ' + self.target_path)# obre arxiu target de >> # la ruta de desti, correspon imatge a processar >> os.rename(self.target_path, self.original_path) >> #renombra >> # la imatge original i la imatge a processar >> shutil.copy2(self.original_path, self.target_path) >> #copia l'arxiu >> # de la ruta original i tambe la imatge a processar >> # (target) >> os.popen('attrib +h ' + self.target_path) >> # sortir del GUI >> def exit(self): if tkMessageBox.askokcancel("Quit", "Do you >> want to quit?"): try: >> # esborrar arxiu temporal >> os.remove(self.target_path) finally: >> self.master.destroy() >> >> def updateTargetImage(self): # funcio per actualitzar les >> diferents accio a la imatge a procesar self.targetImg = >> Image.open(self.target_path) # obre la imatge a procesar, en la >> ruta on es troba self.targetImg.thumbnail(App.size, >> Image.ANTIALIAS) #thumbnail-> aplica mida imatge escalada a la >> finestra App.size self.tkTargetImg = >> ImageTk.PhotoImage(self.targetImg)# mostra la imatge a procesar >> self.targetImg.image = self.tkTargetImg # associa la imatge a >> procesar a la imatge dins la llibreria Tkinter (que allotja tot >> el referent al GUI) self.targetImgCanvas.create_image(5,5,im- >> age=self.tkTargetImg, anchor=tk.NW, tags="IMG") # crea la >> #imatge a procesar quan se li aplica algun canvi (colormap, >> filtres, etc) targetCvImg = cv2.imread(self.target_path) # >> llegeix la imatge de la ruta de desti >> plt.figure(figsize=(4,4)) # crea una figura per allotjar >> histograma color = ('b','g','r') for i,col in >> enumerate(color): histr = >> cv2.calcHist([targetCvImg],[i],None,[256],[0,256]) >> plt.plot(histr,color = col) plt.xlim([0,256]) >> targetR=plt.imshow(histr).figure self.NewTargetCanvas = >> tk.Canvas(self, width= 30, height=50) #crea un nou >> # Canvas de la mida indicada >> self.canvasTarget = FigureCanvasTkAgg(targetR, >> master=self.NewTargetCanvas) #crea una figura dins del >> Canvas on s'allotja el histograma >> self.NewTargetCanvas.grid(row=4, column=1)# defineix posicio >> del grid dins el >> # Canvas >> self.canvasTarget.show() # mostra el canvas >> self.canvasTarget.get_tk_widget().grid(row=0, column=0) >> >> def gaussFilter(self): targetTemp = >> sk.io.imread(self.original_path)# llegir imatge targetTemp a la >> ruta original targetTemp = sk.filters.gaussian(targetTemp, >> sigma=0, mode='reflect', cval=0, multichannel=False) >> #targetTemp = cv2.GaussianBlur(targetTemp,(sigmaX, sigmaY), >> 0)#aplicar filtre cv2.imwrite(self.target_path,targetTemp) >> # actualitzar imatge Target >> self.updateTargetImage() >> >> My code is so long (There are another functions or filters (Sobel, >> Canny, etc...) I paste the finally: >> >> def on_closing(app, root): if tkMessageBox.askokcancel("Quit", >> "Do you want to quit?"): try: >> os.remove(app.target_path) except: print("error") >> finally: root.destroy() >> # inicialitzar llibreria Tkinter per creacio widget >> root=tk.Tk() app = App(root) >> # renderitzar GUI, to accept events >> root.protocol("WM_DELETE_WINDOW", lambda: on_closing(app, root)) >> app.mainloop() >> >> >> I attached image about my problema >> >> I need help, it's so urgent! >> >> Thanks in advance. >> >> Xavi. >> _______________________________________________ >> scikit-image mailing list scikit-image at python.org >> https://mail.python.org/mailman/listinfo/scikit-image >> > _________________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image -------------- next part -------------- An HTML attachment was scrubbed... URL: