Open rdotsch opened 8 years ago
More to-dos:
Re: default off. I think it's better to default to the 'quick' method (vectorize ci -> blur -> calculate z-scores using scale()). That one's very efficient.
It’s fast, but it doesn’t yield correct results. We’ll discuss it face to face.
On 26 Oct 2016, at 18:07, aucuparia notifications@github.com wrote:
Re: default off. I think it's better to default to the 'quick' method (vectorize ci -> blur -> calculate z-scores using scale()). That one's very efficient.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/HSWebteam/rcicr/issues/5#issuecomment-256397512, or mute the thread https://github.com/notifications/unsubscribe-auth/ADqoTGhdn_8kgqFml6r5grlrGhALUWF8ks5q33rMgaJpZM4KDpJb.
I know, but perhaps it's useful for a first impression. Or perhaps that'll just confuse people. We'll discuss.
It will be confusing and I want to protect users who don't RTFM. There is another consideration, and that is that we want the default behaviour to be identical to previous versions for backwards compatibility.
More necessary to-do's:
We'll discuss all of this face to face.
raster::plot accepts custom colour palettes with the col argument (see ?raster::plot). We could explicitly add that argument to generateZmap, but I think it's sufficient to just mention it in Details or as an example in the description of the ... argument. I've mentioned it in Details for now.
generateCI()
customisable, as we do with ci file name (perhaps reuse the already existing filename
parameter)Great work on generateZmap()
so far! I've played around with it a bit.
generateZmap()
. Is that correct? YesvisualizeZmap()
, because the actual z-map is generated in generateCI()
. Changed to plotZmapsaveaspng
part for the CI and create a separate visualizeCI()
function, that gives the user more flexibility in visualisation options, including perhaps decorations.col=rainbow(100,alpha=.5, start=0, end=2/6)
as default? Default set to viridis(100)
I am going to open up a separate issue for the cluster tests. Another todo for the z-maps visualization:
Re smoothing: No, smoothing is in the Z-map part of generateCI. I think we should move the smoothing to visualizeZmap instead, but this can only be done when the smoothing is applied after calculating the Z-map. I'm fairly sure that's the way to go though, so we'll move it there eventually.
Re visualizeZmap: Agree, with the possible alternative of plotZmap. That's short, but I'm not sure if English allows us to call Z-maps plots.
Re visualizeCI: Could be useful, yes. Let's open another issue for that.
Re default colors: Your suggestion looks like a sane default to me, but let's consider using viridis. It's the coolest colour palette on the block. See https://cran.r-project.org/web/packages/viridis/vignettes/intro-to-viridis.html and this talk: A Better Default Colormap for Matplotlib
Re smoothing: I think there are two levels of smoothing. The Random Field Theory approach assumes smoothing to happen before stats like z and clusters are computed. We have to think that through at a later stage, once I get RFT working.
Re: plotZmap is better, indeed.
Re default colors: fine by me!
Filename can now be specified in plotZmap using the filename
parameter. generateCI passes the value of baseimage
to as the filename to plotZmap.
Proper importing and checking of the mask has been implemented as well. What remains to be done is the application of the Z-map.
A question: importing and applying of the mask is currently part of plotZMap. This is not a problem if we calculate the Z-map using our own method, but if we use quick
(for example), the Z-scores per pixel are not independent any more. We either need to ensure that we don't implement Z-map methods in which Z-scores are dependent on other/all pixels, or we need to move the masking to generateCI.
Another question: we could re-use the mask importing code by putting it in a function. That way we can call importMask in generateCI as well as in plotZmap. On the other hand, this could be a case of unnecessary/unwanted code fragmentation and complexity. Your thoughts?
Re: function to import mask -- Yes, I am all for removing redundancy and put it in a function. I think it will reduce complexity.
Re: when to implement masking -- I am not sure I fully get your point.
generateCI
now fails for me where it worked before this change.
Command:
s1.c0 <- generateCI(stimuli = study1.c0$ID, responses = study1.c0$response, participants = study1.c0$subject, baseimage = 'mnes', rdata = 'study1.Rdata', zmap = TRUE, zmapmethod = 't.test', saveaspng = TRUE, filename = 'group_ci_condition_0.png')
Result:
starting worker pid=5466 on localhost:11826 at 16:19:59.008 starting worker pid=5474 on localhost:11826 at 16:19:59.293 starting worker pid=5482 on localhost:11826 at 16:19:59.576 starting worker pid=5490 on localhost:11826 at 16:19:59.852 Loading required package: rcicr Loading required package: rcicr Loading required package: rcicr loaded rcicr and set parent environment Loading required package: rcicr loaded rcicr and set parent environment loaded rcicr and set parent environment loaded rcicr and set parent environment |==============================================================| 100% Error in plotZmap(zmap = zmap, bgimage = combined, filename = baseimage, : argument "mask" is missing, with no default
The problem seems to be that I don't/can't specify a mask as argument for generateCI
to pass onto plotZmap
. But here I want default behaviour without a mask at all.
The solution is to just not call plotZmap()
from generateCI()
at the very end. The user should do this themselves after calling generateCI()
right?
I commented out the plotZmap()
call from generateCI()
for the time being in this latest commit. We can discuss how we want it to work in this thread and them always reinstate that line if we want to.
The mask argument of plotZmap indeed had no default value. This shouldn't have been a problem, because generateCI doesn't generate the Z-map by default, but there was an error there as well. Both are fixed now, so I've uncommented the call to plotZmap.
We should implement the approach to z-mapping, using the new masking functionality: take pixels that are masked away assuming these have no signal, then extract the distribution of those pixels from all selected stimuli across trials. Then z-score the pixels inside the mask based on this distribution.
As described in: Chauvin, A., Worsley, K. J., Schyns, P. G., Arguin, M., & Gosselin, F. (2005). Accurate statistical tests for smooth classification images. Journal of Vision, 5(9), 659–667. https://doi.org/10.1167/5.9.1
"However, if the number of trials is greater than 200 as is usually the case with classification images the transformation can be approximated as follows: where the mean and standard deviation are estimated directly from the data, preferably from signal-less regions of the classification images (e.g., regions corresponding to a homogeneous background)." from Chauvin et al. (2005).
20 has a proof-of-concept.
To-do: