StevenVB12 / patternize

An R package for quantifying color pattern variation
31 stars 8 forks source link

error using patLanK (Error in rowSums(x) : 'x' must be an array of at least two dimensions) #32

Open diekei opened 2 years ago

diekei commented 2 years ago

Hello Steven,

I encountered a problem when trying to extract the pattern using patLanK. The code runs until all samples were added to array, but when it 'starts centers of first image:' it produces this error: Error in rowSums(x) : 'x' must be an array of at least two dimensions

Any help to solve this issue will be greatly appreciated! Thank you!

Best wishes, Arif

patLanK.zip

StevenVB12 commented 2 years ago

Hi Arif,

A couple of things to check.

If none of these solve the problem, please share me 2 of your images with landmarks and your code for me to check.

Best,

Steven

From: Arif Maulana @.> Sent: Monday, June 6, 2022 9:46 AM To: StevenVB12/patternize @.> Cc: Subscribed @.***> Subject: [StevenVB12/patternize] error using patLanK (Error in rowSums(x) : 'x' must be an array of at least two dimensions) (Issue #32)

Hello Steven,

I encountered a problem when trying to extract the pattern using patLanK. The code runs until all samples were added to array, but when it 'starts centers of first image:' it produces this error: Error in rowSums(x) : 'x' must be an array of at least two dimensions

Any help to solve this issue will be greatly appreciated! Thank you!

Best wishes, Arif

patLanK.ziphttps://github.com/StevenVB12/patternize/files/8844864/patLanK.zip

— Reply to this email directly, view it on GitHubhttps://github.com/StevenVB12/patternize/issues/32, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABQOC4ZZ5OWUVIJDHCWQQK3VNX6IVANCNFSM5X7NRK7A. You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>

diekei commented 2 years ago

Hi Steven,

Thanks a lot for the swift response! Yes, all have the same landmarks, and all in .jpg format. I tried to remove the decimal but it does not help also.

Please find attached the code and the sample of necessary files (patLanK.zip). Many thanks! patLanK.zip

Best wishes, Arif

StevenVB12 commented 2 years ago

Hi Arif,

This fixes it (target should be landmarks and used as transformRef):

target <- landmarkList[['H212']]

rasterList <- patLanK(imageList, landmarkList, k = 3, resampleFactor = 5, crop = TRUE, cropOffset = c(0, 0, 0, 0), res = 300, transformRef = target, transformType = 'tps', removebg = 100, removebgColOffset = 0.1, adjustCoords = FALSE, plot = TRUE, focal = FALSE)

I’d also like to share with you Hannah Weller’s helpful addition that works much better than k-means clustering:

https://hiweller.rbind.io/post/recolorize-patternize-workflow/

Also, out of curiosity, what insect am I looking at?

Best,

Steven From: Arif Maulana @.> Sent: Monday, June 6, 2022 10:31 AM To: StevenVB12/patternize @.> Cc: Steven M. Van Belleghem @.>; Comment @.> Subject: Re: [StevenVB12/patternize] error using patLanK (Error in rowSums(x) : 'x' must be an array of at least two dimensions) (Issue #32)

Hi Steven,

Thanks a lot for the swift response! Yes, all have the same landmarks, and all in .jpg format. I tried to remove the decimal but it does not help also.

Please find attached the code and the sample of necessary files (patLanK.zip). Many thanks! patLanK.ziphttps://github.com/StevenVB12/patternize/files/8845122/patLanK.zip

Best wishes, Arif

— Reply to this email directly, view it on GitHubhttps://github.com/StevenVB12/patternize/issues/32#issuecomment-1147514642, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABQOC46JXI5I5CV33F4NPSTVNYDRVANCNFSM5X7NRK7A. You are receiving this because you commented.Message ID: @.**@.>>

diekei commented 2 years ago

Hi Steven!

Thanks a lot for your help! very much appreciated! I already implemented it on my code and it works! Thanks again.

I’d also like to share with you Hannah Weller’s helpful addition that works

much better than k-means clustering:

Excellent! I just came across it yesterday and thought it to be a cool development of patternize, however I haven't read it yet. Now that you mention it, I just read it and to my surprise it answers exactly what I was looking for. Having a standardised k-means cluster for all images is extremely helpful and much more makes sense. I'll try the code to my images and read your preprint article.

Also, out of curiosity, what insect am I looking at?

These are sample images of an abdomen (ventral part) from a species of phytophagous ladybird beetle (Coccinellidae: Epilachnini: Henosepilachna diekei) from Indonesia (widely spread in SE Asia). They consist of several specialist populations and interestingly had distinct elytral markings and the amount of melanisation on the other body part. The 6 sample images, represents two of that population and their hybrids (2 for each). We can talk more if you're interested :) they're (insects generally) are amazing..

patrRegRGB and patLanW works perfectly for the elytral markings, but the abdomen is a bit tricky... I tried to use patRegK (failed) and patLanK (acceptable), still looking for the best method before proceeding with the complete samples, and recolorize-patternize workflow seems promising!

Thanks for developing all of these, fingers crossed for your preprint, looking forward to the published version! Have a nice day!

Best wishes, Arif

Arif Maulana Erasmus Mundus Master Programme in Evolutionary Biology (MEME) Ludwig Maximilian University of Munich - Munich Graduate School for Evolution, Ecology and Systematics

On Tue, Jun 7, 2022 at 4:55 PM Steven M. Van Belleghem < @.***> wrote:

Hi Arif,

This fixes it (target should be landmarks and used as transformRef):

target <- landmarkList[['H212']]

rasterList <- patLanK(imageList, landmarkList, k = 3, resampleFactor = 5, crop = TRUE, cropOffset = c(0, 0, 0, 0), res = 300, transformRef = target, transformType = 'tps', removebg = 100, removebgColOffset = 0.1, adjustCoords = FALSE, plot = TRUE, focal = FALSE)

I’d also like to share with you Hannah Weller’s helpful addition that works much better than k-means clustering:

https://hiweller.rbind.io/post/recolorize-patternize-workflow/

Also, out of curiosity, what insect am I looking at?

Best,

Steven From: Arif Maulana @.> Sent: Monday, June 6, 2022 10:31 AM To: StevenVB12/patternize @.> Cc: Steven M. Van Belleghem @.>; Comment @.> Subject: Re: [StevenVB12/patternize] error using patLanK (Error in rowSums(x) : 'x' must be an array of at least two dimensions) (Issue #32)

Hi Steven,

Thanks a lot for the swift response! Yes, all have the same landmarks, and all in .jpg format. I tried to remove the decimal but it does not help also.

Please find attached the code and the sample of necessary files (patLanK.zip). Many thanks! patLanK.zip< https://github.com/StevenVB12/patternize/files/8845122/patLanK.zip>

Best wishes, Arif

— Reply to this email directly, view it on GitHub< https://github.com/StevenVB12/patternize/issues/32#issuecomment-1147514642>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/ABQOC46JXI5I5CV33F4NPSTVNYDRVANCNFSM5X7NRK7A>.

You are receiving this because you commented.Message ID: @.**@.>>

— Reply to this email directly, view it on GitHub https://github.com/StevenVB12/patternize/issues/32#issuecomment-1148786700, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKTOS4JLRRXRS5Z6VDFS3LVN5PGZANCNFSM5X7NRK7A . You are receiving this because you authored the thread.Message ID: @.***>

StevenVB12 commented 2 years ago

Cool! I would not have guessed these were parts of ladybirds.

Thanks for the kind words. Feel free to share us any of your progress :)

Best,

Steven

-------- Original message -------- From: Arif Maulana @.> Date: 6/7/22 6:08 PM (GMT-04:00) To: StevenVB12/patternize @.> Cc: "Steven M. Van Belleghem" @.>, Comment @.> Subject: Re: [StevenVB12/patternize] error using patLanK (Error in rowSums(x) : 'x' must be an array of at least two dimensions) (Issue #32)

Hi Steven!

Thanks a lot for your help! very much appreciated! I already implemented it on my code and it works! Thanks again.

I’d also like to share with you Hannah Weller’s helpful addition that works

much better than k-means clustering:

Excellent! I just came across it yesterday and thought it to be a cool development of patternize, however I haven't read it yet. Now that you mention it, I just read it and to my surprise it answers exactly what I was looking for. Having a standardised k-means cluster for all images is extremely helpful and much more makes sense. I'll try the code to my images and read your preprint article.

Also, out of curiosity, what insect am I looking at?

These are sample images of an abdomen (ventral part) from a species of phytophagous ladybird beetle (Coccinellidae: Epilachnini: Henosepilachna diekei) from Indonesia (widely spread in SE Asia). They consist of several specialist populations and interestingly had distinct elytral markings and the amount of melanisation on the other body part. The 6 sample images, represents two of that population and their hybrids (2 for each). We can talk more if you're interested :) they're (insects generally) are amazing..

patrRegRGB and patLanW works perfectly for the elytral markings, but the abdomen is a bit tricky... I tried to use patRegK (failed) and patLanK (acceptable), still looking for the best method before proceeding with the complete samples, and recolorize-patternize workflow seems promising!

Thanks for developing all of these, fingers crossed for your preprint, looking forward to the published version! Have a nice day!

Best wishes, Arif

Arif Maulana Erasmus Mundus Master Programme in Evolutionary Biology (MEME) Ludwig Maximilian University of Munich - Munich Graduate School for Evolution, Ecology and Systematics

On Tue, Jun 7, 2022 at 4:55 PM Steven M. Van Belleghem < @.***> wrote:

Hi Arif,

This fixes it (target should be landmarks and used as transformRef):

target <- landmarkList[['H212']]

rasterList <- patLanK(imageList, landmarkList, k = 3, resampleFactor = 5, crop = TRUE, cropOffset = c(0, 0, 0, 0), res = 300, transformRef = target, transformType = 'tps', removebg = 100, removebgColOffset = 0.1, adjustCoords = FALSE, plot = TRUE, focal = FALSE)

I’d also like to share with you Hannah Weller’s helpful addition that works much better than k-means clustering:

https://hiweller.rbind.io/post/recolorize-patternize-workflow/

Also, out of curiosity, what insect am I looking at?

Best,

Steven From: Arif Maulana @.> Sent: Monday, June 6, 2022 10:31 AM To: StevenVB12/patternize @.> Cc: Steven M. Van Belleghem @.>; Comment @.> Subject: Re: [StevenVB12/patternize] error using patLanK (Error in rowSums(x) : 'x' must be an array of at least two dimensions) (Issue #32)

Hi Steven,

Thanks a lot for the swift response! Yes, all have the same landmarks, and all in .jpg format. I tried to remove the decimal but it does not help also.

Please find attached the code and the sample of necessary files (patLanK.zip). Many thanks! patLanK.zip< https://github.com/StevenVB12/patternize/files/8845122/patLanK.zip>

Best wishes, Arif

— Reply to this email directly, view it on GitHub< https://github.com/StevenVB12/patternize/issues/32#issuecomment-1147514642>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/ABQOC46JXI5I5CV33F4NPSTVNYDRVANCNFSM5X7NRK7A>.

You are receiving this because you commented.Message ID: @.**@.>>

— Reply to this email directly, view it on GitHub https://github.com/StevenVB12/patternize/issues/32#issuecomment-1148786700, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKTOS4JLRRXRS5Z6VDFS3LVN5PGZANCNFSM5X7NRK7A . You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHubhttps://github.com/StevenVB12/patternize/issues/32#issuecomment-1149221698, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABQOC43OV4HCQGQOXEVLDSTVN7B4FANCNFSM5X7NRK7A. You are receiving this because you commented.Message ID: @.***>