diff --git a/.Rbuildignore b/.Rbuildignore index 97f64bf..381d272 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,3 +1,4 @@ +^README\.Rmd$ ^docs$ ^_pkgdown\.yml$ ^.*\.Rproj$ diff --git a/.gitignore b/.gitignore index ea775e3..d92749c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ qntmap.Rproj vignettes/center_add\.csv vignettes/centers0\.csv + +vignettes/\.build\.timestamp diff --git a/DESCRIPTION b/DESCRIPTION index 8122ee1..3aef397 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: qntmap Type: Package -Title: Enhance quantitative analysis of EPMA data -Version: 0.2.2 +Title: Enhance quantitative analysis of EPMA map +Version: 0.3.0 Authors@R: c( person(given = 'YASUMOTO Atsushi', role = c('aut', 'cph', 'cre'), email = 'atusy.7+qntmap@gmail.com'), person(given = 'YOSHIDA Kenta', role = c('ctb')), @@ -17,16 +17,17 @@ Description: A main function of this packages is License: MIT + file LICENSE Encoding: UTF-8 LazyData: true -RoxygenNote: 6.1.0 +RoxygenNote: 6.1.1 Depends: R(>= 3.1.2) Imports: curl, data.table, dplyr, - ggplot2, + DT, easycsv, - imager, + ggplot2, + htmltools, + knitr, matrixStats, - plotly, pipeR, PoiClaClu, png, @@ -35,6 +36,7 @@ Imports: curl, scales, stringr, shiny, + shinyWidgets, tibble, tidyr, utils @@ -56,15 +58,13 @@ Collate: 'find_centers_kpp.R' 'group_cluster.R' 'mean.R' + 'plot-shiny.R' 'plot.R' - 'plot_shiny.R' - 'plotly.R' + 'plot_gg.R' 'print.R' 'qntmap.R' 'quantify.R' 'read_cnd.R' - 'read_map_beam.R' - 'read_map_pos.R' 'read_qnt.R' 'read_qnt_elemw.R' 'read_xmap.R' @@ -78,6 +78,7 @@ Collate: Roxygen: list(markdown = TRUE) Suggests: knitr, + pkgdown, rmarkdown, testthat VignetteBuilder: knitr diff --git a/NAMESPACE b/NAMESPACE index 8d26cf8..941c324 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,6 +2,8 @@ S3method(mean,qntmap) S3method(pick,qm_xmap) +S3method(plot,qm_cluster) +S3method(plot,qm_raster) S3method(plot,qm_xmap) S3method(plot,qntmap) S3method(print,qntmap) @@ -30,7 +32,10 @@ export(read_xmap) export(save4qm) export(segment) export(tidy_epma) -import(shiny) +importFrom(DT,dataTableOutput) +importFrom(DT,datatable) +importFrom(DT,formatRound) +importFrom(DT,renderDT) importFrom(PoiClaClu,Classify) importFrom(data.table,fread) importFrom(data.table,fwrite) @@ -38,6 +43,7 @@ importFrom(dplyr,arrange) importFrom(dplyr,bind_cols) importFrom(dplyr,bind_rows) importFrom(dplyr,distinct) +importFrom(dplyr,everything) importFrom(dplyr,filter) importFrom(dplyr,group_by) importFrom(dplyr,left_join) @@ -49,20 +55,25 @@ importFrom(dplyr,right_join) importFrom(dplyr,select) importFrom(dplyr,summarise) importFrom(dplyr,summarize) +importFrom(dplyr,summarize_if) importFrom(dplyr,transmute) importFrom(dplyr,transmute_at) importFrom(dplyr,ungroup) importFrom(easycsv,choose_dir) importFrom(ggplot2,aes) -importFrom(ggplot2,aes_string) +importFrom(ggplot2,coord_cartesian) importFrom(ggplot2,coord_fixed) importFrom(ggplot2,element_blank) importFrom(ggplot2,element_rect) -importFrom(ggplot2,geom_col) +importFrom(ggplot2,geom_bar) +importFrom(ggplot2,geom_histogram) importFrom(ggplot2,geom_raster) importFrom(ggplot2,ggplot) -importFrom(ggplot2,ggtitle) -importFrom(ggplot2,scale_fill_gradientn) +importFrom(ggplot2,guide_colorbar) +importFrom(ggplot2,guide_legend) +importFrom(ggplot2,guides) +importFrom(ggplot2,scale_fill_gradient) +importFrom(ggplot2,scale_fill_manual) importFrom(ggplot2,scale_fill_viridis_c) importFrom(ggplot2,scale_y_reverse) importFrom(ggplot2,theme) @@ -70,34 +81,54 @@ importFrom(ggplot2,theme_classic) importFrom(grDevices,col2rgb) importFrom(grDevices,dev.copy) importFrom(grDevices,dev.off) +importFrom(grDevices,nclass.FD) importFrom(grDevices,png) importFrom(grDevices,rgb) -importFrom(graphics,hist) importFrom(graphics,pie) importFrom(graphics,plot) -importFrom(imager,load.image) +importFrom(grid,unit) +importFrom(htmltools,br) +importFrom(htmltools,tags) +importFrom(knitr,kable) importFrom(matrixStats,rowMaxs) importFrom(matrixStats,weightedMedian) importFrom(pipeR,"%>>%") importFrom(pipeR,pipeline) -importFrom(plotly,event_data) -importFrom(plotly,ggplotly) -importFrom(plotly,layout) -importFrom(plotly,plot_ly) -importFrom(plotly,plotlyOutput) -importFrom(plotly,renderPlotly) +importFrom(png,readPNG) importFrom(png,writePNG) importFrom(purrr,map) importFrom(purrr,map2) importFrom(purrr,map2_dbl) importFrom(purrr,map_at) importFrom(purrr,map_dbl) +importFrom(purrr,map_if) importFrom(purrr,map_int) importFrom(purrr,pmap) importFrom(purrr,walk2) -importFrom(scales,gradient_n_pal) +importFrom(rlang,sym) importFrom(scales,squish) -importFrom(scales,viridis_pal) +importFrom(shiny,brushOpts) +importFrom(shiny,checkboxInput) +importFrom(shiny,fluidPage) +importFrom(shiny,hoverOpts) +importFrom(shiny,htmlOutput) +importFrom(shiny,mainPanel) +importFrom(shiny,numericInput) +importFrom(shiny,observeEvent) +importFrom(shiny,plotOutput) +importFrom(shiny,reactive) +importFrom(shiny,reactiveValues) +importFrom(shiny,renderPlot) +importFrom(shiny,renderPrint) +importFrom(shiny,renderUI) +importFrom(shiny,req) +importFrom(shiny,selectInput) +importFrom(shiny,shinyApp) +importFrom(shiny,sidebarLayout) +importFrom(shiny,sidebarPanel) +importFrom(shiny,splitLayout) +importFrom(shiny,uiOutput) +importFrom(shinyWidgets,radioGroupButtons) importFrom(stats,coef) importFrom(stats,lm) importFrom(stats,lsfit) diff --git a/NEWS.md b/NEWS.md index ee2f622..9de7b15 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,22 @@ +# qntmap 0.3.0 + +## Major changes + +- `plot()` + - Interactive plot is a combination of shiny, ggplot2, and more. No more using plotly. + - Color control with histogram + - Hover information of pixels + - Zooming + - Moving + - Summarizing data in a table below heatmap + - Double click to keep pixel data + - Box select to keep mean values of data + - Grayscale is supported in addition to viridis. + - Clustering result is supported. +- `segment()` + - Only allows PNG format as an input. + No more JPG nor BMP allowed. + # qntmap 0.2.2 ## Major changes diff --git a/README.Rmd b/README.Rmd index 893330b..b5d8037 100644 --- a/README.Rmd +++ b/README.Rmd @@ -1,46 +1,41 @@ --- -title: "QntMap" -output: - md_document: - variant: markdown_github +title: Enhance quantitative analysis of EPMA maps with QntMap +output: github_document --- ```{r setup, include=FALSE} -knitr::opts_chunk$set(echo = TRUE) +knitr::opts_chunk$set(echo = TRUE, eval = FALSE) +library(knitr) ``` # Overview -This package provides functions to convert element characteristic X-ray intensity maps into element mass concentration maps. -Current version supports data from JEOL-style electron probe microanalyer (EPMA). -For conversion, you need to run spot analysis before mapping analysis. -See "How to" section for usage and [Yasumoto et al. (2018)](https://doi.org/10.2138/am-2018-6323CCBY) for implementations. +This package generates mass concentration maps and phase distribution maps based on X-ray mapping data and spot analysis data from EPMA. -# Installation +See "[How to]" for a usage and [Yasumoto et al. (2018)](https://doi.org/10.2138/am-2018-6323CCBY) for implementations. -Install devtools package if you haven't. +Current version supports data from JEOL-style EPMA. -```{r devtools, eval = FALSE} -install.packages("devtools") -``` +# Installation -Then, run following code. +Copy & paste a following command to R. -```{r qntmap, eval = FALSE} -devtools::install_github("atusy/qntmap") +```{r install} +source("https://install-github.me/atusy/qntmap") ``` # How to -1. Export data from EPMA analysis. -1. Run QntMap +1. [EPMA analysis] (spot before map) +1. [Export data] from EPMA to PC +1. [Run QntMap on R] for data processing. -Read below for details. +Details below. ## EPMA analysis -QntMap handles matrix effect by preparing internal standards based on spot analysis. - +Conversion is performed by utilizing spot analysis data as internal standards. +Thus, [spot analysis][Spot analysis] must be done prior to [mapping][Mapping]. ### Spot analysis @@ -51,31 +46,21 @@ QntMap handles matrix effect by preparing internal standards based on spot analy - **20 spots per phase** in the area to be mapped (the more is better). - It is better but not necessary to quantify grains larger than mapping probe diameter. - Make sure at least **20 spots per element** are analyzing grains larger than mapping probe diameter. -- Commenting analysis - - Give same comments on the same phase with the similar compositions. Do not number them. - - e.g., quartz, plagioclase, ... - - Otherwise, comment them with different name. This is important treatment for phase identification and handling matrix effect. - - e.g., garnet-core, garnet-rim - - If you give comments containing underscore such as "garnet_core" and "garnet_rim", then they are treated as if different phases in phase identification, but are treated as if their matrix effect are approximately same. - - Alternatively, give comments manually by external file. - -Spot quantitative analytical conditions in your lab. - -### Mapping analysis +- Identify phases in comment + - Give same comments on the same phase with the similar compositions. + - e.g., quartz, plagioclase, garnet-core, garnet-rim, ... + - An alternative is to use external file later. + +### Mapping - Analytical conditions - - Acceralating voltage should be same as one applied in spot analysis. - - Probe diameter should be larger than spot analysis. The larger saves more time, but decreases spatial resolutions. + - Acceralating voltage must be same as that in spot analysis. + - Probe diameter should be larger than that in spot analysis. - Probe current is recommended to be 100 nA following Lanari et al. (2014). - Dwell time is recommended to be 0.1 - 0.3 sec following Lanari et al. (2014). - - Note that increasing probe current accepts decreasing dwell time, but probe current must not be too high to saturate X-ray detectors. If you prefer high probe current in some reason, consider changing dispersive crystals from those chosen in spot analysis. - - e.g., chose PET instead of TAP for Si - ### Example of analytical conditions -Yasumoto et al. (submitted) - | | Spot | Map | Comment | |:--------------------|------:|--------:|:--------------------------------| |Acceralating Voltate | 15 kV | 15 kV | Must be same in spot and map | @@ -85,25 +70,94 @@ Yasumoto et al. (submitted) |Background dwell | 5 sec| NA | No need to analyze in map | -## Data processing with QntMap package on R +## Export data {#Export} + +1. **ASCII conert** mapping data into matrix format, + and save the result in the directory + where raw data is stored (e.g., `.map/1`). +1. Export whole directory of analysis containing + `.map` directory and `.qnt` directory + +### File structure + +A minimal example. +See links for descrptions. +`*` is a wild card. + +- .map/\*/ + - \*_map.txt + - \*.cnd +- .qnt/ + - [.cnd/elemw.cnd](#elemwcnd) + - [bgm.qnt](#bgmqnt-bgpqnt-pkintqnt-netqnt) + - [bgp.qnt](#bgmqnt-bgpqnt-pkintqnt-netqnt) + - [elem.qnt](#elemqnt-elintqnt) + - [elint.qnt](#elemqnt-elintqnt) + - [mes.qnt](#mesqnt) + - [net.qnt](#bgmqnt-bgpqnt-pkintqnt-netqnt) + - [peak.qnt](#peakqnt) + - [stg.qnt](#stgqnt) + - [wt.qnt](#wtqnt) + +#### elemw.cnd + +includes dwell time for peak and background, +relative positions of backgrounds. + +In some case, this file is incomplete or missing, and needs to be prepared manually (e.g., https://gist.github.com/atusy/f1577b67b8874c9e915941c0725d0e22). -### Quantification +#### bgm.qnt, bgp.qnt, pkint.qnt, net.qnt -By running following code, you'll see that phase identification result in 'clustering' directory and mass concentration data as csv files in 'qntmap' directory both under the directory contaning mapping data. +include +background (minus and plus), peak, and net intensities of each analysis. +In some environemts, `pkint.qnt` is missing, but is complemented within QntMap. -#### Interactive mode +#### elem.qnt and elint.qnt + +include name of elements +data correction ("elem.qnt"; oxide or metal in ZAF), +counting intensities ("elint.qnt"). + +#### mes.qnt + +includes probe current of each analysis. + +#### peak.qnt + +includes positions of peak intensities of each element of each analysis. + +#### stg.qnt + +includes coordinates and comments of each analysis. + +#### wt.qnt + +includes mass concentrations of each analysis. + +## Run QntMap on R + +For data processing + +### Interactive mode Follow instructions shown by running the following code. -```{r eval = FALSE} +```{r interactive} library(qntmap) qntmap() ``` +As a result, phase identification result is saved in "`clustering`" directory and mass concentration data as csv files in "`qntmap`" directory both under the directory contaning mapping data. + +Note that interactive mode has limited functions. +Use [manual mode][Manual mode] for full functionality. + +### Manual mode -#### Manual mode for experts (example) +A work-flow with example dataset is available at +https://atusy.github.io/qntmap/articles/basic.html . -```{r eval = FALSE} +```{r manual} library(qntmap) # Required parameters @@ -140,21 +194,21 @@ qnt <- read_qnt(wd = dir_qnt, phase_list = phase_list, renew = TRUE) # Determine initial cluster centers centers <- find_centers(xmap = xmap, qnt = qnt, fine_phase = fine_phase) ## Check 'centers0.csv' under the `wd` and modify on demand. -## if modified, assign content of the modified csv file by running +## If modified, assign content of the modified csv file by running ## centers <- data.table::fread('path to the modified csv file') # Phase identification -# assign group_cluster = TRUE if you want to integrate same phases subgrouped by suffix after '_' +# Assign group_cluster = TRUE if you want to integrate same phases subgrouped by suffix after '_' # (e.g., garnet_a and garnet_b are integrated to garnet if TRUE) cls <- cluster_xmap(xmap = xmap, centers = centers, group_cluster = FALSE) -# quantify X-ray maps +# Quantify X-ray maps qmap <- quantify( xmap = xmap, qnt = qnt, cluster = cls, fine_phase = fine_phase ) ## Resulting files are saved in `qntmap` directory` under `dir_map`. -# summarize result +# Summarize result summary(qmap) ## This shows minimum, lower quantile, median, mean, upper quantile, and maximum values of variables. ``` diff --git a/README.md b/README.md index 446d913..d568b6a 100644 --- a/README.md +++ b/README.md @@ -1,110 +1,144 @@ -Overview -======== +Enhance quantitative analysis of EPMA maps with QntMap +================ -This package provides functions to convert element characteristic X-ray -intensity maps into element mass concentration maps. -Current version supports data from JEOL-style electron probe -microanalyer (EPMA). -For conversion, you need to run spot analysis before mapping analysis. -See “How to” section for usage and Yasumoto et al. (submitted) for -implementations. +# Overview -Installation -============ +This package generates mass concentration maps and phase distribution +maps based on X-ray mapping data and spot analysis data from EPMA. -Install devtools package if you haven’t. +See “[How to](#how-to)” for a usage and [Yasumoto et al. +(2018)](https://doi.org/10.2138/am-2018-6323CCBY) for implementations. -``` r -install.packages("devtools") -``` +Current version supports data from JEOL-style EPMA. + +# Installation -Then, run following code. +Copy & paste a following command to R. ``` r -devtools::install_github("atusy/qntmap") +source("https://install-github.me/atusy/qntmap") ``` -How to -====== +# How to -1. Export data from EPMA analysis. -2. Run QntMap +1. [EPMA analysis](#epma-analysis) (spot before map) +2. [Export data](#Export) from EPMA to PC +3. [Run QntMap on R](#run-qntmap-on-r) for data processing. -Read below for details. +Details below. -EPMA analysis -------------- +## EPMA analysis -QntMap handles matrix effect by preparing internal standards based on -spot analysis. +Conversion is performed by utilizing spot analysis data as internal +standards. Thus, [spot analysis](#spot-analysis) must be done prior to +[mapping](#mapping). ### Spot analysis -- Analytical conditions - - Same as those conventionally applied in your lab. - - Use wavelength-dispersive X-ray spectrometer -- Spots to be analyzed - - **20 spots per phase** in the area to be mapped (the more is + - Analytical conditions + - Same as those conventionally applied in your lab. + - Use wavelength-dispersive X-ray spectrometer + - Spots to be analyzed + - **20 spots per phase** in the area to be mapped (the more is better). - - It is better but not necessary to quantify grains larger than + - It is better but not necessary to quantify grains larger than mapping probe diameter. - - Make sure at least **20 spots per element** are analyzing grains + - Make sure at least **20 spots per element** are analyzing grains larger than mapping probe diameter. -- Commenting analysis - - Give same comments on the same phase with the similar - compositions. Do not number them. - - e.g., quartz, plagioclase, … - - Otherwise, comment them with different name. This is important - treatment for phase identification and handling matrix effect. - - e.g., garnet-core, garnet-rim - - If you give comments containing underscore such as - “garnet\_core” and “garnet\_rim”, then they are treated as if - different phases in phase identification, but are treated as if - their matrix effect are approximately same. - - Alternatively, give comments manually by external file. - -Spot quantitative analytical conditions in your lab. - -### Mapping analysis - -- Analytical conditions - - Acceralating voltage should be same as one applied in spot - analysis. - - Probe diameter should be larger than spot analysis. The larger - saves more time, but decreases spatial resolutions. - - Probe current is recommended to be 100 nA following Lanari et + - Identify phases in comment + - Give same comments on the same phase with the similar + compositions. + - e.g., quartz, plagioclase, garnet-core, garnet-rim, … + - An alternative is to use external file later. + +### Mapping + + - Analytical conditions + - Acceralating voltage must be same as that in spot analysis. + - Probe diameter should be larger than that in spot analysis. + - Probe current is recommended to be 100 nA following Lanari et al. (2014). - - Dwell time is recommended to be 0.1 - 0.3 sec following Lanari - et al. (2014). - - Note that increasing probe current accepts decreasing dwell - time, but probe current must not be too high to saturate X-ray - detectors. If you prefer high probe current in some reason, - consider changing dispersive crystals from those chosen in spot - analysis. - - e.g., chose PET instead of TAP for Si + - Dwell time is recommended to be 0.1 - 0.3 sec following Lanari + et al. +(2014). ### Example of analytical conditions -Yasumoto et al. (submitted) +| | Spot | Map | Comment | +| :------------------- | -----: | -------: | :------------------------------- | +| Acceralating Voltate | 15 kV | 15 kV | Must be same in spot and map | +| Probe diameter | 3 μm | 20 μm | Must be smaller in spot than map | +| Probe current | 10 nA | 100 nA | | +| Peak dwell | 10 sec | 120 msec | | +| Background dwell | 5 sec | NA | No need to analyze in map | + +## Export data + +1. **ASCII conert** mapping data into matrix format, and save the + result in the directory where raw data is stored (e.g., `.map/1`). +2. Export whole directory of analysis containing `.map` directory and + `.qnt` directory + +### File structure + +A minimal example. See links for descrptions. `*` is a wild card. + + - .map/\*/ + - \*\_map.txt + - \*.cnd + - .qnt/ + - [.cnd/elemw.cnd](#elemwcnd) + - [bgm.qnt](#bgmqnt-bgpqnt-pkintqnt-netqnt) + - [bgp.qnt](#bgmqnt-bgpqnt-pkintqnt-netqnt) + - [elem.qnt](#elemqnt-elintqnt) + - [elint.qnt](#elemqnt-elintqnt) + - [mes.qnt](#mesqnt) + - [net.qnt](#bgmqnt-bgpqnt-pkintqnt-netqnt) + - [peak.qnt](#peakqnt) + - [stg.qnt](#stgqnt) + - [wt.qnt](#wtqnt) + +#### elemw.cnd + +includes dwell time for peak and background, relative positions of +backgrounds. + +In some case, this file is incomplete or missing, and needs to be +prepared manually (e.g., +). + +#### bgm.qnt, bgp.qnt, pkint.qnt, net.qnt -| | Spot| Map| Comment | -|:---------------------|-------:|---------:|:---------------------------------| -| Acceralating Voltate | 15 kV| 15 kV| Must be same in spot and map | -| Probe diameter | 3 μm| 20 μm| Must be smaller in spot than map | -| Probe current | 10 nA| 100 nA| | -| Peak dwell | 10 sec| 120 msec| | -| Background dwell | 5 sec| NA| No need to analyze in map | +include background (minus and plus), peak, and net intensities of each +analysis. In some environemts, `pkint.qnt` is missing, but is +complemented within QntMap. -Data processing with QntMap package on R ----------------------------------------- +#### elem.qnt and elint.qnt -### Quantification +include name of elements data correction (“elem.qnt”; oxide or metal in +ZAF), counting intensities (“elint.qnt”). -By running following code, you’ll see that phase identification result -in ‘clustering’ directory and mass concentration data as csv files in -‘qntmap’ directory both under the directory contaning mapping data. +#### mes.qnt -#### Interactive mode +includes probe current of each analysis. + +#### peak.qnt + +includes positions of peak intensities of each element of each analysis. + +#### stg.qnt + +includes coordinates and comments of each analysis. + +#### wt.qnt + +includes mass concentrations of each analysis. + +## Run QntMap on R + +For data processing + +### Interactive mode Follow instructions shown by running the following code. @@ -113,7 +147,17 @@ library(qntmap) qntmap() ``` -#### Manual mode for experts (example) +As a result, phase identification result is saved in “`clustering`” +directory and mass concentration data as csv files in “`qntmap`” +directory both under the directory contaning mapping data. + +Note that interactive mode has limited functions. Use [manual +mode](#manual-mode) for full functionality. + +### Manual mode + +A work-flow with example dataset is available at + . ``` r library(qntmap) @@ -152,21 +196,21 @@ qnt <- read_qnt(wd = dir_qnt, phase_list = phase_list, renew = TRUE) # Determine initial cluster centers centers <- find_centers(xmap = xmap, qnt = qnt, fine_phase = fine_phase) ## Check 'centers0.csv' under the `wd` and modify on demand. -## if modified, assign content of the modified csv file by running +## If modified, assign content of the modified csv file by running ## centers <- data.table::fread('path to the modified csv file') # Phase identification -# assign group_cluster = TRUE if you want to integrate same phases subgrouped by suffix after '_' +# Assign group_cluster = TRUE if you want to integrate same phases subgrouped by suffix after '_' # (e.g., garnet_a and garnet_b are integrated to garnet if TRUE) cls <- cluster_xmap(xmap = xmap, centers = centers, group_cluster = FALSE) -# quantify X-ray maps +# Quantify X-ray maps qmap <- quantify( xmap = xmap, qnt = qnt, cluster = cls, fine_phase = fine_phase ) ## Resulting files are saved in `qntmap` directory` under `dir_map`. -# summarize result +# Summarize result summary(qmap) ## This shows minimum, lower quantile, median, mean, upper quantile, and maximum values of variables. ``` diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index f18e4c2..20869d2 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -61,7 +61,7 @@ qntmap - 0.2.2 + 0.3.0 diff --git a/docs/articles/add_phase.html b/docs/articles/add_phase.html index 7004172..c30ca86 100644 --- a/docs/articles/add_phase.html +++ b/docs/articles/add_phase.html @@ -31,7 +31,7 @@ qntmap - 0.2.2 + 0.3.0 @@ -81,15 +81,13 @@ - - -
+
@@ -81,15 +81,13 @@ - - -
+

@@ -159,10 +158,11 @@

Plot X-ray map data as heatmap

-

Plots are by default interactive. Specify ‘Si’ instead of ‘Mg’ to see Si map. Specify interactive = FALSE if necessary.

-
plot(xmap, 'Mg', interactive = TRUE)
-
- +

Plots are by default interactive with webui. Selection of elements can be done on webui.

+ +

diff --git a/docs/articles/basic_files/figure-html/unnamed-chunk-15-1.png b/docs/articles/basic_files/figure-html/unnamed-chunk-15-1.png index 138d1cb..6e43745 100644 Binary files a/docs/articles/basic_files/figure-html/unnamed-chunk-15-1.png and b/docs/articles/basic_files/figure-html/unnamed-chunk-15-1.png differ diff --git a/docs/articles/basic_files/figure-html/unnamed-chunk-7-1.png b/docs/articles/basic_files/figure-html/unnamed-chunk-7-1.png index 2148b1e..d86c232 100644 Binary files a/docs/articles/basic_files/figure-html/unnamed-chunk-7-1.png and b/docs/articles/basic_files/figure-html/unnamed-chunk-7-1.png differ diff --git a/docs/articles/basic_files/figure-html/unnamed-chunk-8-1.png b/docs/articles/basic_files/figure-html/unnamed-chunk-8-1.png new file mode 100644 index 0000000..268fa80 Binary files /dev/null and b/docs/articles/basic_files/figure-html/unnamed-chunk-8-1.png differ diff --git a/docs/articles/index.html b/docs/articles/index.html index d80bc3a..85a977a 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -61,7 +61,7 @@ qntmap - 0.2.2 + 0.3.0

diff --git a/docs/authors.html b/docs/authors.html index 71ef1af..c7e7bd1 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -61,7 +61,7 @@ qntmap - 0.2.2 + 0.3.0

diff --git a/docs/index.html b/docs/index.html index be3cbe6..5509c0c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -5,12 +5,12 @@ -Enhance quantitative analysis of EPMA data • qntmap +Enhance quantitative analysis of EPMA map • qntmap - + @@ -33,7 +33,7 @@ qntmap - 0.2.2 + 0.3.0
@@ -92,31 +92,32 @@
-

This package provides functions to convert element characteristic X-ray intensity maps into element mass concentration maps.
-Current version supports data from JEOL-style electron probe microanalyer (EPMA).
-For conversion, you need to run spot analysis before mapping analysis.
-See “How to” section for usage and Yasumoto et al. (2018) for implementations.

+

This package generates mass concentration maps and phase distribution maps based on X-ray mapping data and spot analysis data from EPMA.

+

See “How to” for a usage and Yasumoto et al. (2018) for implementations.

+

Current version supports data from JEOL-style EPMA.

Installation

-

Install devtools package if you haven’t.

- -

Then, run following code.

-
devtools::install_github("atusy/qntmap")
+

Copy & paste a following command to R.

+

How to

    -
  1. Export data from EPMA analysis.
  2. -
  3. Run QntMap
  4. +
  5. +EPMA analysis (spot before map)
  6. +
  7. +Export data from EPMA to PC
  8. +
  9. +Run QntMap on R for data processing.
-

Read below for details.

+

Details below.

EPMA analysis

-

QntMap handles matrix effect by preparing internal standards based on spot analysis.

+

Conversion is performed by utilizing spot analysis data as internal standards. Thus, spot analysis must be done prior to mapping.

Spot analysis

@@ -135,40 +136,28 @@

  • Make sure at least 20 spots per element are analyzing grains larger than mapping probe diameter.
  • -
  • Commenting analysis +
  • Identify phases in comment
      -
    • Give same comments on the same phase with the similar compositions. Do not number them. -
        -
      • e.g., quartz, plagioclase, …
      • -
      -
    • -
    • Otherwise, comment them with different name. This is important treatment for phase identification and handling matrix effect. +
    • Give same comments on the same phase with the similar compositions.
        -
      • e.g., garnet-core, garnet-rim
      • +
      • e.g., quartz, plagioclase, garnet-core, garnet-rim, …
    • -
    • If you give comments containing underscore such as “garnet_core” and “garnet_rim”, then they are treated as if different phases in phase identification, but are treated as if their matrix effect are approximately same.
    • -
    • Alternatively, give comments manually by external file.
    • +
    • An alternative is to use external file later.
  • -

    Spot quantitative analytical conditions in your lab.

    -
    +

    -Mapping analysis

    +Mapping
    • Analytical conditions
        -
      • Acceralating voltage should be same as one applied in spot analysis.
      • -
      • Probe diameter should be larger than spot analysis. The larger saves more time, but decreases spatial resolutions.
      • +
      • Acceralating voltage must be same as that in spot analysis.
      • +
      • Probe diameter should be larger than that in spot analysis.
      • Probe current is recommended to be 100 nA following Lanari et al. (2014).
      • Dwell time is recommended to be 0.1 - 0.3 sec following Lanari et al. (2014).
      • -
      • Note that increasing probe current accepts decreasing dwell time, but probe current must not be too high to saturate X-ray detectors. If you prefer high probe current in some reason, consider changing dispersive crystals from those chosen in spot analysis. -
          -
        • e.g., chose PET instead of TAP for Si
        • -
        -
    @@ -176,7 +165,6 @@

    Example of analytical conditions

    -

    Yasumoto et al. (submitted)

    @@ -219,77 +207,148 @@

    -
    +

    -Data processing with QntMap package on R

    -
    +Export data +
      +
    1. +ASCII conert mapping data into matrix format, and save the result in the directory where raw data is stored (e.g., .map/1).
    2. +
    3. Export whole directory of analysis containing .map directory and .qnt directory
    4. +
    +

    -Quantification

    -

    By running following code, you’ll see that phase identification result in ‘clustering’ directory and mass concentration data as csv files in ‘qntmap’ directory both under the directory contaning mapping data.

    -
    +File structure +

    A minimal example. See links for descrptions. * is a wild card.

    + +

    -Interactive mode

    -

    Follow instructions shown by running the following code.

    - +elemw.cnd +

    includes dwell time for peak and background, relative positions of backgrounds.

    +

    In some case, this file is incomplete or missing, and needs to be prepared manually (e.g., https://gist.github.com/atusy/f1577b67b8874c9e915941c0725d0e22).

    +
    +
    +

    +bgm.qnt, bgp.qnt, pkint.qnt, net.qnt

    +

    include background (minus and plus), peak, and net intensities of each analysis. In some environemts, pkint.qnt is missing, but is complemented within QntMap.

    +
    +
    +

    +elem.qnt and elint.qnt

    +

    include name of elements data correction (“elem.qnt”; oxide or metal in ZAF), counting intensities (“elint.qnt”).

    +
    +
    +

    +mes.qnt

    +

    includes probe current of each analysis.

    +
    +
    +

    +peak.qnt

    +

    includes positions of peak intensities of each element of each analysis.

    -
    +

    -Manual mode for experts (example)

    -
    library(qntmap)
    -
    -# Required parameters
    -wd <- '.' # path to the working directory
    -dir_map <- '.map/1' # relative/absolute path to the directory containing ascii converted X-ray map files (1_map.txt, 2_map.txt, and so on)"
    -dir_qnt <- '.qnt' # relative/absolute path to the directory containing .qnt files (pkint.qnt, net.qnt, and so on)"
    -
    -
    -# Optional parameters
    -
    -## A character vector to specify phases tend to be smaller than mapping probe diameter
    -fine_phase <- NULL 
    -
    -## A csv file indicating name of the phase of n-th quantitative point analysis.
    -## The file path is absolute or relative to `dir_qnt`.
    -## If NULL, names are assumed to be specified in comments during EPMA analysis.
    -phase_list <- NULL 
    -
    -# Run analysis
    -
    -# Set working directory
    -setwd(wd)
    -
    -# Load mapping data
    -# Change value of DT (dead time in nanoseconds) depending on EPMA.
    -# 1100 ns is a value applied by JEOL JXA-8105.
    -xmap <- read_xmap(wd = dir_map, DT = 1100)
    -
    -# Compile quantitative data
    -qnt <- read_qnt(wd = dir_qnt, phase_list = phase_list, renew = TRUE)
    -## Check 'phase_list0.csv' under 'dir_qnt' to see if name of phases are provided properly.
    -## If not, modify the csv file and specify the path of modified one to `phase_list` in "Optional parameters" section and rerun the above code.
    -
    -# Determine initial cluster centers
    -centers <- find_centers(xmap = xmap, qnt = qnt, fine_phase = fine_phase)
    -## Check 'centers0.csv' under the `wd` and modify on demand.
    -## if modified, assign content of the modified csv file by running
    -## centers <- data.table::fread('path to the modified csv file')
    -
    -# Phase identification
    -# assign group_cluster = TRUE if you want to integrate same phases subgrouped by suffix after '_' 
    -# (e.g., garnet_a and garnet_b are integrated to garnet if TRUE)
    -cls <- cluster_xmap(xmap = xmap, centers = centers, group_cluster = FALSE)
    -
    -# quantify X-ray maps
    -qmap <- quantify(
    -  xmap = xmap, qnt = qnt, cluster = cls, fine_phase = fine_phase
    -)
    -## Resulting files are saved in `qntmap` directory` under `dir_map`.
    -
    -# summarize result
    -summary(qmap)
    -## This shows minimum, lower quantile, median, mean, upper quantile, and maximum values of variables.
    +stg.qnt +

    includes coordinates and comments of each analysis.

    +
    +

    +wt.qnt

    +

    includes mass concentrations of each analysis.

    +
    +
    +
    +
    +

    +Run QntMap on R

    +

    For data processing

    +
    +

    +Interactive mode

    +

    Follow instructions shown by running the following code.

    + +

    As a result, phase identification result is saved in “clustering” directory and mass concentration data as csv files in “qntmap” directory both under the directory contaning mapping data.

    +

    Note that interactive mode has limited functions. Use manual mode for full functionality.

    +
    +
    +

    +Manual mode

    +

    A work-flow with example dataset is available at https://atusy.github.io/qntmap/articles/basic.html .

    +
    library(qntmap)
    +
    +# Required parameters
    +wd <- '.' # path to the working directory
    +dir_map <- '.map/1' # relative/absolute path to the directory containing ascii converted X-ray map files (1_map.txt, 2_map.txt, and so on)"
    +dir_qnt <- '.qnt' # relative/absolute path to the directory containing .qnt files (pkint.qnt, net.qnt, and so on)"
    +
    +
    +# Optional parameters
    +
    +## A character vector to specify phases tend to be smaller than mapping probe diameter
    +fine_phase <- NULL 
    +
    +## A csv file indicating name of the phase of n-th quantitative point analysis.
    +## The file path is absolute or relative to `dir_qnt`.
    +## If NULL, names are assumed to be specified in comments during EPMA analysis.
    +phase_list <- NULL 
    +
    +# Run analysis
    +
    +# Set working directory
    +setwd(wd)
    +
    +# Load mapping data
    +# Change value of DT (dead time in nanoseconds) depending on EPMA.
    +# 1100 ns is a value applied by JEOL JXA-8105.
    +xmap <- read_xmap(wd = dir_map, DT = 1100)
    +
    +# Compile quantitative data
    +qnt <- read_qnt(wd = dir_qnt, phase_list = phase_list, renew = TRUE)
    +## Check 'phase_list0.csv' under 'dir_qnt' to see if name of phases are provided properly.
    +## If not, modify the csv file and specify the path of modified one to `phase_list` in "Optional parameters" section and rerun the above code.
    +
    +# Determine initial cluster centers
    +centers <- find_centers(xmap = xmap, qnt = qnt, fine_phase = fine_phase)
    +## Check 'centers0.csv' under the `wd` and modify on demand.
    +## If modified, assign content of the modified csv file by running
    +## centers <- data.table::fread('path to the modified csv file')
    +
    +# Phase identification
    +# Assign group_cluster = TRUE if you want to integrate same phases subgrouped by suffix after '_' 
    +# (e.g., garnet_a and garnet_b are integrated to garnet if TRUE)
    +cls <- cluster_xmap(xmap = xmap, centers = centers, group_cluster = FALSE)
    +
    +# Quantify X-ray maps
    +qmap <- quantify(
    +  xmap = xmap, qnt = qnt, cluster = cls, fine_phase = fine_phase
    +)
    +## Resulting files are saved in `qntmap` directory` under `dir_map`.
    +
    +# Summarize result
    +summary(qmap)
    +## This shows minimum, lower quantile, median, mean, upper quantile, and maximum values of variables.
    diff --git a/docs/news/index.html b/docs/news/index.html index 60bc36a..7bf6bf6 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -61,7 +61,7 @@ qntmap - 0.2.2 + 0.3.0
    @@ -119,12 +119,49 @@

    Changelog

    Source: NEWS.md
    -
    +

    -qntmap 0.2.2

    +qntmap 0.3.0

    Major changes

    +
      +
    • +plot() +
        +
      • Interactive plot is a combination of shiny, ggplot2, and more. No more using plotly. +
          +
        • Color control with histogram
        • +
        • Hover information of pixels
        • +
        • Zooming
        • +
        • Moving
        • +
        • Summarizing data in a table below heatmap +
            +
          • Double click to keep pixel data
          • +
          • Box select to keep mean values of data
          • +
          +
        • +
        +
      • +
      • Grayscale is supported in addition to viridis.
      • +
      • Clustering result is supported.
      • +
      +
    • +
    • +segment() +
        +
      • Only allows PNG format as an input. No more JPG nor BMP allowed.
      • +
      +
    • +
    +
    +
    +
    +

    +qntmap 0.2.2

    +
    +

    +Major changes

    New features

    @@ -216,9 +253,9 @@

  • The above change cause read_qnt to save its result (qnt.RDS) and semi-product (phase_list0.csv) in the directory containing .qnt files unlike qnt_load saved them under the working directory.
  • -
    +

    -Major changes

    +Major changes
    • Monster functions are separated into smaller functions.
        @@ -315,6 +352,7 @@

        Contents

        @@ -138,11 +138,16 @@

        Arg centers -

        c-by-p matrix returned by find_centers() or by manually; c clusters and p features. Used to guess initial centers (or centroids) of clusters. A value returned by , typically data.frame or matrix, indicating initial guess centers (or centroids) or clusters. See find_centers().

        +

        c-by-p matrix returned by find_centers() or by manually; +c clusters and p features. +Used to guess initial centers (or centroids) of clusters. +A value returned by , typically data.frame or matrix, +indicating initial guess centers (or centroids) or clusters. +See find_centers().

        xmap -

        an qm_xmap class object generated by `read_xmap()``

        +

        an qm_xmap class object generated by read_xmap()

        x @@ -177,8 +182,7 @@

        Arg

        See also

        - +

        Examples

        diff --git a/docs/reference/cluster.html b/docs/reference/cluster.html index bae596d..2c78311 100644 --- a/docs/reference/cluster.html +++ b/docs/reference/cluster.html @@ -6,7 +6,7 @@ -Poisson distribution based custering based on <code>PoiClaClu:Classify()</code> — cluster • qntmap +Poisson distribution based custering based on <code><a href='http://www.rdocumentation.org/packages/PoiClaClu/topics/Classify'>PoiClaClu::Classify()</a></code> — cluster • qntmap @@ -32,9 +32,9 @@ - + - + @@ -64,7 +64,7 @@ qntmap - 0.2.2 + 0.3.0
    @@ -118,14 +118,14 @@
    -

    Poisson distribution based custering based on PoiClaClu:Classify()

    +

    Poisson distribution based custering based on PoiClaClu::Classify()

    @@ -141,7 +141,12 @@

    Arg centers -

    c-by-p matrix returned by find_centers() or by manually; c clusters and p features. Used to guess initial centers (or centroids) of clusters. A value returned by , typically data.frame or matrix, indicating initial guess centers (or centroids) or clusters. See find_centers().

    +

    c-by-p matrix returned by find_centers() or by manually; +c clusters and p features. +Used to guess initial centers (or centroids) of clusters. +A value returned by , typically data.frame or matrix, +indicating initial guess centers (or centroids) or clusters. +See find_centers().

    xte @@ -221,7 +226,7 @@

    R

    See also

    - +
    diff --git a/docs/reference/cluster_xmap.html b/docs/reference/cluster_xmap.html index 19f5f26..357f604 100644 --- a/docs/reference/cluster_xmap.html +++ b/docs/reference/cluster_xmap.html @@ -64,7 +64,7 @@ qntmap - 0.2.2 + 0.3.0
    @@ -137,15 +137,21 @@

    Arg xmap -

    a qm_xmap class object returned by read_xmap

    +

    a qm_xmap class object returned by read_xmap()

    centers -

    c-by-p matrix returned by find_centers() or by manually; c clusters and p features. Used to guess initial centers (or centroids) of clusters. A value returned by , typically data.frame or matrix, indicating initial guess centers (or centroids) or clusters. See find_centers().

    +

    c-by-p matrix returned by find_centers() or by manually; +c clusters and p features. +Used to guess initial centers (or centroids) of clusters. +A value returned by , typically data.frame or matrix, +indicating initial guess centers (or centroids) or clusters. +See find_centers().

    elements -

    A character vector indicating which elements to be utilized in cluster analysis. NULL, in default, selects as much elements as possible are utilized in cluster analysis.

    +

    A character vector to chose elements to be utilized in cluster analysis. +NULL (default) selects as much elements as possible.

    saving @@ -153,7 +159,9 @@

    Arg group_cluster -

    TRUE (default) or FALSE to integrate same phase subgrouped using suffix. For example, when there are clusters named as Pl_NaRich and Pl_NaPoor, they are grouped as Pl.

    +

    FALSE (default) or TRUE to integrate same phase subgrouped using suffix. +For example, +clusters named "Pl_NaRich" and "Pl_NaPoor" are integrated to "Pl" cluster .

    diff --git a/docs/reference/find_centers.html b/docs/reference/find_centers.html index 28302e6..0001685 100644 --- a/docs/reference/find_centers.html +++ b/docs/reference/find_centers.html @@ -6,7 +6,7 @@ -Initialize centroids for <code>cluster_xmap()</code> — find_centers • qntmap +Initialize centroids for <code><a href='cluster_xmap.html'>cluster_xmap()</a></code> — find_centers • qntmap @@ -32,7 +32,7 @@ - + @@ -64,7 +64,7 @@ qntmap - 0.2.2 + 0.3.0

    @@ -118,7 +118,7 @@
    @@ -136,15 +136,16 @@

    Arg xmap -

    an qm_xmap class object generated by `read_xmap()``

    +

    an qm_xmap class object generated by read_xmap()

    qnt -

    an qm_qnt class object generated by `read_qnt()``

    +

    an qm_qnt class object generated by read_qnt()`

    fine_phase -

    A character vector to specify fine grained phases which tend to comprise multi-phase pixels e.g., c('Pl', 'Amp')

    +

    A character vector to specify fine grained phases +which tend to comprise multi-phase pixels e.g., c('Pl', 'Amp')

    saveas diff --git a/docs/reference/find_centers_kpp.html b/docs/reference/find_centers_kpp.html index 8b7bcbe..22df15f 100644 --- a/docs/reference/find_centers_kpp.html +++ b/docs/reference/find_centers_kpp.html @@ -64,7 +64,7 @@ qntmap - 0.2.2 + 0.3.0

    @@ -136,7 +136,8 @@

    Arg x -

    An object which can be coerced to matrix, typically matrix itself or data.frame.

    +

    An object which can be coerced to matrix, +typically matrix itself or data.frame.

    k diff --git a/docs/reference/group_cluster.html b/docs/reference/group_cluster.html index 4ecb233..45119aa 100644 --- a/docs/reference/group_cluster.html +++ b/docs/reference/group_cluster.html @@ -65,7 +65,7 @@ qntmap - 0.2.2 + 0.3.0

    @@ -138,7 +138,7 @@

    Arg x -

    qm_cluster class object returned by qltmap_cls_pois().

    +

    qm_cluster class object returned by cluster_xmap().

    saving diff --git a/docs/reference/index.html b/docs/reference/index.html index 54e1110..73fbcdb 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -61,7 +61,7 @@ qntmap - 0.2.2 + 0.3.0

    @@ -144,7 +144,7 @@

    cluster()

    -

    Poisson distribution based custering based on PoiClaClu:Classify()

    +

    Poisson distribution based custering based on PoiClaClu::Classify()

    @@ -184,7 +184,7 @@

    plot(<qm_xmap>) plot(<qntmap>)

    +

    plot(<qm_raster>) plot(<qm_xmap>) plot(<qntmap>) plot(<qm_cluster>)

    Plot methods for qntmap package

    @@ -198,7 +198,7 @@

    qltmap_cls_centers()

    -

    (Deprecated) Use find_centers

    +

    (DEPRECATED) Use find_centers

    @@ -210,25 +210,25 @@

    qntmap()

    -

    interactively quantify X-ray maps

    +

    Interactively quantify X-ray maps

    qntmap_cls_pois()

    -

    (Deprecated) Use cluster_xmap()

    +

    (DEPRECATED) Use cluster_xmap()

    qntmap_quantify()

    -

    (Deprecated) Use quantify.

    +

    (DEPRECATED) Use quantify.

    quantify()

    -

    quantify qualtitative mapping data

    +

    Quantify X-ray maps

    diff --git a/docs/reference/mean.html b/docs/reference/mean.html index e2e7730..bc27445 100644 --- a/docs/reference/mean.html +++ b/docs/reference/mean.html @@ -35,7 +35,7 @@ +See base::mean() for general use of mean()." /> @@ -65,7 +65,7 @@ qntmap - 0.2.2 + 0.3.0

    @@ -127,7 +127,7 @@

    Arithmetric mean for qntmap package

    S3 methods for the arithmetric mean. -See base::mean() for general use of plot.

    +See base::mean() for general use of mean().

    @@ -160,10 +160,7 @@

    See also

    - +

    Examples

    diff --git a/docs/reference/pick.html b/docs/reference/pick.html index 559616f..6c57757 100644 --- a/docs/reference/pick.html +++ b/docs/reference/pick.html @@ -64,7 +64,7 @@ qntmap - 0.2.2 + 0.3.0
    diff --git a/docs/reference/plot-1.png b/docs/reference/plot-1.png new file mode 100644 index 0000000..a940869 Binary files /dev/null and b/docs/reference/plot-1.png differ diff --git a/docs/reference/plot-2.png b/docs/reference/plot-2.png new file mode 100644 index 0000000..49c4161 Binary files /dev/null and b/docs/reference/plot-2.png differ diff --git a/docs/reference/plot-3.png b/docs/reference/plot-3.png new file mode 100644 index 0000000..bb2eb2a Binary files /dev/null and b/docs/reference/plot-3.png differ diff --git a/docs/reference/plot-4.png b/docs/reference/plot-4.png new file mode 100644 index 0000000..7f435cd Binary files /dev/null and b/docs/reference/plot-4.png differ diff --git a/docs/reference/plot.html b/docs/reference/plot.html index 6f9548d..4e4aefd 100644 --- a/docs/reference/plot.html +++ b/docs/reference/plot.html @@ -66,7 +66,7 @@ qntmap - 0.2.2 + 0.3.0
    @@ -133,13 +133,18 @@

    Plot methods for qntmap package

    -
    # S3 method for qm_xmap
    +    
    # S3 method for qm_raster
     plot(x, y = setdiff(names(x), c("x", "y"))[1],
    -  legend_fill = y, interactive = TRUE, ..., shiny = FALSE)
    +  colors = c("viridis", "gray"), interactive = TRUE, ...)
    +
    +# S3 method for qm_xmap
    +plot(x, y = setdiff(names(x), c("x", "y"))[1], ...)
     
     # S3 method for qntmap
    -plot(x, y = setdiff(names(x), c("x", "y"))[1],
    -  legend_fill = y, interactive = TRUE, ..., shiny = FALSE)
    +plot(x, y = setdiff(names(x), c("x", "y"))[1], ...) + +# S3 method for qm_cluster +plot(x, y = NULL, ...)

    Arguments

    @@ -154,23 +159,18 @@

    Arg

    - - + + - + - - - -

    A string specifying a component of x to determine colors to fill the map.

    legend_fill

    A string to specify legend name for fill. -Default value is taken from y.

    colors

    A color pallete to use. Either "viridis" (default) or "gray".

    interactive

    TRUE returns plotly object (default), and -FALSE returns ggplot object.

    TRUE (default) produces plots with shiny WebUI, and +FALSE produces plots with ggplot2::ggplot().

    ...

    ignored

    shiny

    See plots using Shiny (default: FALSE)

    See also

    @@ -179,15 +179,27 @@

    See a

    Examples

    -
    # qm_xmap class object +
    # qm_raster class object +d <- data.frame(x = sample.int(5), y = sample.int(5), fill = runif(5)) +class(d) <- c('qm_raster', class(d)) +plot(d, 'fill', interactive = FALSE)
    +# qm_xmap class object xm <- list(A = as.data.frame(matrix(runif(25), 5))) class(xm) <- c('qm_xmap', 'list') -plot(xm) - +plot(xm, interactive = FALSE)
    # qntmap class object qm <- list(A = list(wt = as.data.frame(matrix(runif(25), 5)))) class(qm) <- c( 'qntmap', 'list') -plot(qm)
    +plot(qm, interactive = FALSE)
    +# qm_cluster class object +cls <- list( + ytehat = sample.int(3, 9, replace = TRUE), + dims = c(3, 3) +) +names(cls$ytehat) <- letters[cls$ytehat] +class(cls) <- "qm_cluster" +plot(cls, interactive = FALSE)
    +
    diff --git a/docs/reference/qltmap_cls_centers.html b/docs/reference/qltmap_cls_centers.html index 762214a..315def3 100644 --- a/docs/reference/qltmap_cls_centers.html +++ b/docs/reference/qltmap_cls_centers.html @@ -6,7 +6,7 @@ -(Deprecated) Use find_centers — qltmap_cls_centers • qntmap +(DEPRECATED) Use find_centers — qltmap_cls_centers • qntmap @@ -32,9 +32,9 @@ - + - + @@ -64,7 +64,7 @@ qntmap - 0.2.2 + 0.3.0
    @@ -118,14 +118,14 @@
    -

    (Deprecated) Use find_centers

    +

    (DEPRECATED) Use find_centers

    diff --git a/docs/reference/qltmap_load.html b/docs/reference/qltmap_load.html index 7552b6f..f5f54fa 100644 --- a/docs/reference/qltmap_load.html +++ b/docs/reference/qltmap_load.html @@ -64,7 +64,7 @@ qntmap - 0.2.2 + 0.3.0
    diff --git a/docs/reference/qntmap.html b/docs/reference/qntmap.html index e3b075a..8049c1a 100644 --- a/docs/reference/qntmap.html +++ b/docs/reference/qntmap.html @@ -6,7 +6,7 @@ -interactively quantify X-ray maps — qntmap • qntmap +Interactively quantify X-ray maps — qntmap • qntmap @@ -32,9 +32,9 @@ - + - + @@ -64,7 +64,7 @@ qntmap - 0.2.2 + 0.3.0
    @@ -118,14 +118,14 @@
    -

    interactively quantify X-ray maps

    +

    Interactively quantify X-ray maps

    diff --git a/docs/reference/qntmap_cls_pois.html b/docs/reference/qntmap_cls_pois.html index e865080..a1704f9 100644 --- a/docs/reference/qntmap_cls_pois.html +++ b/docs/reference/qntmap_cls_pois.html @@ -6,7 +6,7 @@ -(Deprecated) Use <code>cluster_xmap()</code> — qntmap_cls_pois • qntmap +(DEPRECATED) Use <code>cluster_xmap()</code> — qntmap_cls_pois • qntmap @@ -32,9 +32,9 @@ - + - + @@ -64,7 +64,7 @@ qntmap - 0.2.2 + 0.3.0
    @@ -118,14 +118,14 @@
    -

    (Deprecated) Use cluster_xmap()

    +

    (DEPRECATED) Use cluster_xmap()

    @@ -145,7 +145,8 @@

    Arg elements -

    A character vector indicating which elements to be utilized in cluster analysis. NULL, in default, selects as much elements as possible are utilized in cluster analysis.

    +

    A character vector to chose elements to be utilized in cluster analysis. +NULL (default) selects as much elements as possible.

    wd diff --git a/docs/reference/qntmap_quantify.html b/docs/reference/qntmap_quantify.html index 44490fb..073e072 100644 --- a/docs/reference/qntmap_quantify.html +++ b/docs/reference/qntmap_quantify.html @@ -6,7 +6,7 @@ -(Deprecated) Use quantify. — qntmap_quantify • qntmap +(DEPRECATED) Use quantify. — qntmap_quantify • qntmap @@ -32,9 +32,9 @@ - + - + @@ -64,7 +64,7 @@ qntmap - 0.2.2 + 0.3.0

    @@ -118,14 +118,14 @@
    -

    (Deprecated) Use quantify.

    +

    (DEPRECATED) Use quantify.

    @@ -151,15 +151,18 @@

    Arg maps_x -

    A x-axis size of maps comprising guide net map (default: NULL).

    +

    Sizes of maps along x- and y-axes comprising guide net map. +(default: NULL).

    maps_y -

    A y-axis size of maps comprising guide net map (default: NULL).

    +

    Sizes of maps along x- and y-axes comprising guide net map. +(default: NULL).

    fine_phase -

    A character vector to specify fine grained phases which tend to comprise multi-phase pixels e.g., c('Pl', 'Amp')

    +

    A character vector to specify fine grained phases +which tend to comprise multi-phase pixels e.g., c('Pl', 'Amp')

    fine_th @@ -175,7 +178,7 @@

    Arg cluster -

    qm_cluster class object returned by cluter_xmap().

    +

    qm_cluster class object returned by cluster_xmap().

    diff --git a/docs/reference/quantify.html b/docs/reference/quantify.html index 6e55a34..7d6645d 100644 --- a/docs/reference/quantify.html +++ b/docs/reference/quantify.html @@ -6,7 +6,7 @@ -quantify qualtitative mapping data — quantify • qntmap +Quantify X-ray maps — quantify • qntmap @@ -32,9 +32,9 @@ - + - + @@ -64,7 +64,7 @@ qntmap - 0.2.2 + 0.3.0

    @@ -118,14 +118,14 @@
    -

    quantify qualtitative mapping data

    +

    Quantify X-ray maps

    @@ -145,19 +145,17 @@

    Arg cluster -

    qm_cluster class object returned by cluter_xmap().

    +

    qm_cluster class object returned by cluster_xmap().

    - maps_x -

    A x-axis size of maps comprising guide net map (default: NULL).

    - - - maps_y -

    A y-axis size of maps comprising guide net map (default: NULL).

    + maps_x, maps_y +

    Sizes of maps along x- and y-axes comprising guide net map. +(default: NULL).

    fine_phase -

    A character vector to specify fine grained phases which tend to comprise multi-phase pixels e.g., c('Pl', 'Amp')

    +

    A character vector to specify fine grained phases +which tend to comprise multi-phase pixels e.g., c('Pl', 'Amp')

    fine_th diff --git a/docs/reference/read_cnd.html b/docs/reference/read_cnd.html index d32ed3f..3d5f725 100644 --- a/docs/reference/read_cnd.html +++ b/docs/reference/read_cnd.html @@ -64,7 +64,7 @@ qntmap - 0.2.2 + 0.3.0

    @@ -165,7 +165,7 @@

    Arg

    .default

    -

    A default method which returns a result of readLines(x) +

    A default method which returns a result of readLines() with additional class according to the content of the file.

    read_cnd.map_cnd

    diff --git a/docs/reference/read_qnt.html b/docs/reference/read_qnt.html index 5eaed4d..cda7aca 100644 --- a/docs/reference/read_qnt.html +++ b/docs/reference/read_qnt.html @@ -64,7 +64,7 @@ qntmap - 0.2.2 + 0.3.0
    diff --git a/docs/reference/read_xmap.html b/docs/reference/read_xmap.html index ae9fb92..f3247b8 100644 --- a/docs/reference/read_xmap.html +++ b/docs/reference/read_xmap.html @@ -64,7 +64,7 @@ qntmap - 0.2.2 + 0.3.0
    diff --git a/docs/reference/save4qm.html b/docs/reference/save4qm.html index 35168cb..babaef2 100644 --- a/docs/reference/save4qm.html +++ b/docs/reference/save4qm.html @@ -64,7 +64,7 @@ qntmap - 0.2.2 + 0.3.0
    @@ -188,7 +188,8 @@

    save4qm.qm_cluster

    -

    A method for qm_cluster class returned by cluster_xmap() or cluster_group(). +

    A method for qm_cluster class returned by +cluster_xmap() or group_cluster(). Object is saved as RDS file and png file. The latter shows distribution of phases among a mapped area.

    diff --git a/docs/reference/segment.html b/docs/reference/segment.html index 4779775..238426d 100644 --- a/docs/reference/segment.html +++ b/docs/reference/segment.html @@ -65,7 +65,7 @@ qntmap - 0.2.2 + 0.3.0
    @@ -141,7 +141,7 @@

    Arg x -

    A path to the image file (PNG, JPEG, and BMP).

    +

    A path to the PNG image file.

    ... @@ -159,20 +159,8 @@

    See a

    Examples

    -
    library(imager)
    #> Loading required package: magrittr
    #> -#> Attaching package: ‘magrittr’
    #> The following objects are masked from ‘package:testthat’: -#> -#> equals, is_less_than, not
    #> -#> Attaching package: ‘imager’
    #> The following object is masked from ‘package:magrittr’: -#> -#> add
    #> The following objects are masked from ‘package:stats’: -#> -#> convolve, spectrum
    #> The following object is masked from ‘package:graphics’: -#> -#> frame
    #> The following object is masked from ‘package:base’: -#> -#> save.image
    x <- system.file('extdata/parrots.png',package='imager') -print(x) # x is a path to the example image file.
    #> [1] "/home/atusy/R/x86_64-pc-linux-gnu-library/3.5/imager/extdata/parrots.png"
    head(segment(x)) # [1] "#747458" "#757559" "#78785C" "#77765B" "#78785C" "#78785C"
    #> [1] "#747458" "#7A775C" "#7E7B5E" "#838163" "#878565" "#8D886B"
    # NOT RUN { +
    x <- system.file("img", "Rlogo.png", package="png") +head(segment(x)) # [1] "#747458" "#757559" "#78785C" "#77765B" "#78785C" "#78785C"
    #> [1] "#00000000" "#00000000" "#00000000" "#00000000" "#00000000" "#00000000"
    # NOT RUN { segment(matrix(1:9, 3, 3)) # This gives error as current version only support a path of a image file as input # }
    diff --git a/docs/reference/summary_methods.html b/docs/reference/summary_methods.html index 6a680d1..69a0747 100644 --- a/docs/reference/summary_methods.html +++ b/docs/reference/summary_methods.html @@ -64,7 +64,7 @@ qntmap - 0.2.2 + 0.3.0
    diff --git a/docs/reference/tidy_epma.html b/docs/reference/tidy_epma.html index 1a52955..e6d32c3 100644 --- a/docs/reference/tidy_epma.html +++ b/docs/reference/tidy_epma.html @@ -64,7 +64,7 @@ qntmap - 0.2.2 + 0.3.0
    diff --git a/man/add_centers.Rd b/man/add_centers.Rd index 5c6583b..306a855 100644 --- a/man/add_centers.Rd +++ b/man/add_centers.Rd @@ -9,9 +9,14 @@ add_centers(centers, xmap, x = NULL, y = NULL, phase = if phase), ..., saveas = "center_add.csv") } \arguments{ -\item{centers}{c-by-p matrix returned by \code{find_centers()} or by manually; c clusters and p features. Used to guess initial centers (or centroids) of clusters. A value returned by , typically \code{data.frame} or \code{matrix}, indicating initial guess centers (or centroids) or clusters. See \code{find_centers()}.} +\item{centers}{c-by-p matrix returned by \code{\link[=find_centers]{find_centers()}} or by manually; +c clusters and p features. +Used to guess initial centers (or centroids) of clusters. +A value returned by , typically \code{\link{data.frame}} or \code{\link{matrix}}, +indicating initial guess centers (or centroids) or clusters. +See \code{\link[=find_centers]{find_centers()}}.} -\item{xmap}{an \code{qm_xmap} class object generated by `read_xmap()``} +\item{xmap}{an \code{qm_xmap} class object generated by \code{\link[=read_xmap]{read_xmap()}}} \item{x}{ A n-by-p training data matrix; n observations and p features. Used to train the @@ -50,7 +55,5 @@ add_centers(centers, xmap, x = 1, y = 2, saveas = FALSE) } \seealso{ -\code{\link[=pick]{pick()}} - -\code{\link[=find_centers]{find_centers()}} +\code{\link[=pick]{pick()}}, \code{\link[=find_centers]{find_centers()}} } diff --git a/man/cluster.Rd b/man/cluster.Rd index ce2b478..5af989a 100644 --- a/man/cluster.Rd +++ b/man/cluster.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/cluster.R \name{cluster} \alias{cluster} -\title{Poisson distribution based custering based on \code{PoiClaClu:Classify()}} +\title{Poisson distribution based custering based on \code{\link[PoiClaClu:Classify]{PoiClaClu::Classify()}}} \usage{ cluster(x, centers, xte = NULL, ...) } @@ -12,7 +12,12 @@ A n-by-p training data matrix; n observations and p features. Used to train the classifier. } -\item{centers}{c-by-p matrix returned by \code{find_centers()} or by manually; c clusters and p features. Used to guess initial centers (or centroids) of clusters. A value returned by , typically \code{data.frame} or \code{matrix}, indicating initial guess centers (or centroids) or clusters. See \code{find_centers()}.} +\item{centers}{c-by-p matrix returned by \code{\link[=find_centers]{find_centers()}} or by manually; +c clusters and p features. +Used to guess initial centers (or centroids) of clusters. +A value returned by , typically \code{\link{data.frame}} or \code{\link{matrix}}, +indicating initial guess centers (or centroids) or clusters. +See \code{\link[=find_centers]{find_centers()}}.} \item{xte}{ A m-by-p data matrix: m test observations and p features. The classifier @@ -94,12 +99,12 @@ xte belongs to class k.} \item{alpha}{Power transformation used (if transform=TRUE).} } \description{ -Poisson distribution based custering based on \code{PoiClaClu:Classify()} +Poisson distribution based custering based on \code{\link[PoiClaClu:Classify]{PoiClaClu::Classify()}} } \references{ D Witten (2011) Classification and clustering of sequencing data using a Poisson model. To appear in Annals of Applied Statistics. } \seealso{ -\link[PoiClaClu]{Classify} +\code{\link[PoiClaClu:Classify]{PoiClaClu::Classify()}}, \code{\link[=find_centers]{find_centers()}} } diff --git a/man/cluster_xmap.Rd b/man/cluster_xmap.Rd index bc533bc..d796c19 100644 --- a/man/cluster_xmap.Rd +++ b/man/cluster_xmap.Rd @@ -8,15 +8,23 @@ cluster_xmap(xmap, centers, elements = intersect(names(xmap), colnames(centers)), saving = TRUE, group_cluster = FALSE) } \arguments{ -\item{xmap}{a \code{qm_xmap} class object returned by \code{read_xmap}} +\item{xmap}{a \code{qm_xmap} class object returned by \code{\link[=read_xmap]{read_xmap()}}} -\item{centers}{c-by-p matrix returned by \code{find_centers()} or by manually; c clusters and p features. Used to guess initial centers (or centroids) of clusters. A value returned by , typically \code{data.frame} or \code{matrix}, indicating initial guess centers (or centroids) or clusters. See \code{find_centers()}.} +\item{centers}{c-by-p matrix returned by \code{\link[=find_centers]{find_centers()}} or by manually; +c clusters and p features. +Used to guess initial centers (or centroids) of clusters. +A value returned by , typically \code{\link{data.frame}} or \code{\link{matrix}}, +indicating initial guess centers (or centroids) or clusters. +See \code{\link[=find_centers]{find_centers()}}.} -\item{elements}{A character vector indicating which elements to be utilized in cluster analysis. \code{NULL}, in default, selects as much elements as possible are utilized in cluster analysis.} +\item{elements}{A character vector to chose elements to be utilized in cluster analysis. +\code{NULL} (default) selects as much elements as possible.} \item{saving}{\code{TRUE} or \code{FALSE} to save result.} -\item{group_cluster}{\code{TRUE} (default) or \code{FALSE} to integrate same phase subgrouped using suffix. For example, when there are clusters named as Pl_NaRich and Pl_NaPoor, they are grouped as Pl.} +\item{group_cluster}{\code{FALSE} (default) or \code{TRUE} to integrate same phase subgrouped using suffix. +For example, +clusters named "Pl_NaRich" and "Pl_NaPoor" are integrated to "Pl" cluster .} } \description{ Cluster mapping data into mineral species diff --git a/man/find_centers.Rd b/man/find_centers.Rd index 60262fd..49fa102 100644 --- a/man/find_centers.Rd +++ b/man/find_centers.Rd @@ -2,19 +2,20 @@ % Please edit documentation in R/find_centers.R \name{find_centers} \alias{find_centers} -\title{Initialize centroids for \code{cluster_xmap()}} +\title{Initialize centroids for \code{\link[=cluster_xmap]{cluster_xmap()}}} \usage{ find_centers(xmap, qnt, fine_phase = NULL, saveas = "centers0.csv") } \arguments{ -\item{xmap}{an \code{qm_xmap} class object generated by `read_xmap()``} +\item{xmap}{an \code{qm_xmap} class object generated by \code{\link[=read_xmap]{read_xmap()}}} -\item{qnt}{an \code{qm_qnt} class object generated by `read_qnt()``} +\item{qnt}{an \code{qm_qnt} class object generated by \code{\link[=read_qnt]{read_qnt()}}`} -\item{fine_phase}{A character vector to specify fine grained phases which tend to comprise multi-phase pixels e.g., c('Pl', 'Amp')} +\item{fine_phase}{A character vector to specify fine grained phases +which tend to comprise multi-phase pixels e.g., c('Pl', 'Amp')} \item{saveas}{File name to save result. FALSE if not saving.} } \description{ -Initialize centroids for \code{cluster_xmap()} +Initialize centroids for \code{\link[=cluster_xmap]{cluster_xmap()}} } diff --git a/man/find_centers_kpp.Rd b/man/find_centers_kpp.Rd index 833b430..aaea268 100644 --- a/man/find_centers_kpp.Rd +++ b/man/find_centers_kpp.Rd @@ -7,7 +7,8 @@ find_centers_kpp(x, k, given = NULL) } \arguments{ -\item{x}{An object which can be coerced to \code{matrix}, typically \code{matrix} itself or \code{data.frame}.} +\item{x}{An object which can be coerced to \code{\link{matrix}}, +typically \code{\link{matrix}} itself or \code{\link{data.frame}}.} \item{k}{A number of clusters.} diff --git a/man/group_cluster.Rd b/man/group_cluster.Rd index 2ef7588..dbe496d 100644 --- a/man/group_cluster.Rd +++ b/man/group_cluster.Rd @@ -7,7 +7,7 @@ group_cluster(x, saving = TRUE, suffix = "_.*") } \arguments{ -\item{x}{\code{qm_cluster} class object returned by \code{qltmap_cls_pois()}.} +\item{x}{\code{qm_cluster} class object returned by \code{\link[=cluster_xmap]{cluster_xmap()}}.} \item{saving}{\code{TRUE} or \code{FALSE} to save result (default: \code{TRUE}).} diff --git a/man/mean.Rd b/man/mean.Rd index be7c6c1..1d0dfa3 100644 --- a/man/mean.Rd +++ b/man/mean.Rd @@ -17,11 +17,11 @@ An index can be created using mask image through \code{\link[=segment]{segment() } \description{ S3 methods for the arithmetric mean. -See \code{\link[base:mean]{base::mean()}} for general use of \code{plot}. +See \code{\link[base:mean]{base::mean()}} for general use of \code{mean()}. } \section{mean.qntmap}{ -returns a \code{data.frame} whose first column lists elements in \code{qntmap} class object. +returns a \code{\link{data.frame}} whose first column lists elements in \code{qntmap} class object. Second to last columns lists \code{mean} values of each elements for each index. } @@ -52,11 +52,5 @@ mean(qm, index = rep(c('L', 'R'), each = 100)) } \seealso{ -\code{\link[base:mean]{base::mean()}} - -\code{\link[=segment]{segment()}} - -\code{\link[=quantify]{quantify()}} - -\code{\link[=qntmap]{qntmap()}} +\code{\link[base:mean]{base::mean()}}, \code{\link[=segment]{segment()}}, \code{\link[=quantify]{quantify()}}, \code{\link[=qntmap]{qntmap()}} } diff --git a/man/plot.Rd b/man/plot.Rd index 5715970..42888ba 100644 --- a/man/plot.Rd +++ b/man/plot.Rd @@ -2,15 +2,20 @@ % Please edit documentation in R/plot.R \name{plot} \alias{plot} +\alias{plot.qm_raster} \alias{plot.qm_xmap} \alias{plot.qntmap} +\alias{plot.qm_cluster} \title{Plot methods for \code{qntmap} package} \usage{ -\method{plot}{qm_xmap}(x, y = setdiff(names(x), c("x", "y"))[1], - legend_fill = y, interactive = TRUE, ..., shiny = FALSE) +\method{plot}{qm_raster}(x, y = setdiff(names(x), c("x", "y"))[1], + colors = c("viridis", "gray"), interactive = TRUE, ...) -\method{plot}{qntmap}(x, y = setdiff(names(x), c("x", "y"))[1], - legend_fill = y, interactive = TRUE, ..., shiny = FALSE) +\method{plot}{qm_xmap}(x, y = setdiff(names(x), c("x", "y"))[1], ...) + +\method{plot}{qntmap}(x, y = setdiff(names(x), c("x", "y"))[1], ...) + +\method{plot}{qm_cluster}(x, y = NULL, ...) } \arguments{ \item{x}{\code{qm_xmap} or \code{qntmap} class objects returned by @@ -18,15 +23,12 @@ \item{y}{A string specifying a component of \code{x} to determine colors to fill the map.} -\item{legend_fill}{A string to specify legend name for fill. -Default value is taken from \code{y}.} +\item{colors}{A color pallete to use. Either "viridis" (default) or "gray".} -\item{interactive}{\code{TRUE} returns \code{plotly} object (default), and -\code{FALSE} returns \code{ggplot} object.} +\item{interactive}{\code{TRUE} (default) produces plots with shiny WebUI, and +\code{FALSE} produces plots with \code{\link[ggplot2:ggplot]{ggplot2::ggplot()}}.} \item{...}{ignored} - -\item{shiny}{See plots using Shiny (default: \code{FALSE})} } \description{ S3 methods to plot object with original classes in \code{qntmap} package. @@ -34,15 +36,29 @@ See \code{\link[graphics:plot]{graphics::plot()}} for general use of \code{plot} Mapping data (\code{qm_xmap} and \code{qm_qntmap} classes) are visualized by heat maps. } \examples{ +# qm_raster class object +d <- data.frame(x = sample.int(5), y = sample.int(5), fill = runif(5)) +class(d) <- c('qm_raster', class(d)) +plot(d, 'fill', interactive = FALSE) + # qm_xmap class object xm <- list(A = as.data.frame(matrix(runif(25), 5))) class(xm) <- c('qm_xmap', 'list') -plot(xm) +plot(xm, interactive = FALSE) # qntmap class object qm <- list(A = list(wt = as.data.frame(matrix(runif(25), 5)))) class(qm) <- c( 'qntmap', 'list') -plot(qm) +plot(qm, interactive = FALSE) + +# qm_cluster class object +cls <- list( + ytehat = sample.int(3, 9, replace = TRUE), + dims = c(3, 3) +) +names(cls$ytehat) <- letters[cls$ytehat] +class(cls) <- "qm_cluster" +plot(cls, interactive = FALSE) } \seealso{ diff --git a/man/print.qntmap.Rd b/man/print.qntmap.Rd index 3570e38..85e011a 100644 --- a/man/print.qntmap.Rd +++ b/man/print.qntmap.Rd @@ -7,7 +7,7 @@ \method{print}{qntmap}(x, summarizing = TRUE, ...) } \arguments{ -\item{x}{\code{qntmap} class object returned by \code{quantify()} or \code{qntmap()}.} +\item{x}{\code{qntmap} class object returned by \code{\link[=quantify]{quantify()}} or \code{\link[=qntmap]{qntmap()}}.} \item{summarizing}{\code{TRUE} or \code{FALSE} to summarize x (default: \code{TRUE}.} diff --git a/man/qltmap_cls_centers.Rd b/man/qltmap_cls_centers.Rd index 0c1e991..4eed6eb 100644 --- a/man/qltmap_cls_centers.Rd +++ b/man/qltmap_cls_centers.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/find_centers.R \name{qltmap_cls_centers} \alias{qltmap_cls_centers} -\title{(Deprecated) Use find_centers} +\title{(DEPRECATED) Use find_centers} \usage{ qltmap_cls_centers(wd = NULL, dir_map, phase_fine = NULL, qnt = read_qnt(paste0(wd, "/.qnt")), qltmap = read_xmap(dir_map), @@ -22,5 +22,5 @@ qltmap_cls_centers(wd = NULL, dir_map, phase_fine = NULL, \item{saving}{file name to save. FALSE if not saving.} } \description{ -(Deprecated) Use find_centers +(DEPRECATED) Use find_centers } diff --git a/man/qntmap.Rd b/man/qntmap.Rd index 8f36aa7..558a352 100644 --- a/man/qntmap.Rd +++ b/man/qntmap.Rd @@ -2,10 +2,10 @@ % Please edit documentation in R/qntmap.R \name{qntmap} \alias{qntmap} -\title{interactively quantify X-ray maps} +\title{Interactively quantify X-ray maps} \usage{ qntmap() } \description{ -interactively quantify X-ray maps +Interactively quantify X-ray maps } diff --git a/man/qntmap_cls_pois.Rd b/man/qntmap_cls_pois.Rd index 846333e..f3990b3 100644 --- a/man/qntmap_cls_pois.Rd +++ b/man/qntmap_cls_pois.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/cluster.R \name{qntmap_cls_pois} \alias{qntmap_cls_pois} -\title{(Deprecated) Use \code{cluster_xmap()}} +\title{(DEPRECATED) Use \code{cluster_xmap()}} \usage{ qntmap_cls_pois(centers_initial, qltmap = NULL, elements = NULL, wd = ".", saving = TRUE, integration = TRUE) @@ -12,7 +12,8 @@ qntmap_cls_pois(centers_initial, qltmap = NULL, elements = NULL, \item{qltmap}{Equivalent to \code{xmap} parameter of \code{cluster_xmap}} -\item{elements}{A character vector indicating which elements to be utilized in cluster analysis. \code{NULL}, in default, selects as much elements as possible are utilized in cluster analysis.} +\item{elements}{A character vector to chose elements to be utilized in cluster analysis. +\code{NULL} (default) selects as much elements as possible.} \item{wd}{Path to the working directory.} @@ -21,5 +22,5 @@ qntmap_cls_pois(centers_initial, qltmap = NULL, elements = NULL, \item{integration}{Equivalent to \code{group_cluster} parameter of \code{cluster_xmap}} } \description{ -(Deprecated) Use \code{cluster_xmap()} +(DEPRECATED) Use \code{cluster_xmap()} } diff --git a/man/qntmap_quantify.Rd b/man/qntmap_quantify.Rd index e75c2bf..19c2dc0 100644 --- a/man/qntmap_quantify.Rd +++ b/man/qntmap_quantify.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/quantify.R \name{qntmap_quantify} \alias{qntmap_quantify} -\title{(Deprecated) Use quantify.} +\title{(DEPRECATED) Use quantify.} \usage{ qntmap_quantify(wd = ".", dir_map, RDS_cluster, maps_x = NULL, maps_y = NULL, fine_phase = NULL, fine_th = 0.9, @@ -16,20 +16,23 @@ qntmap_quantify(wd = ".", dir_map, RDS_cluster, maps_x = NULL, \item{RDS_cluster}{path to the RDS file created by cluster_xmap} -\item{maps_x}{A x-axis size of maps comprising guide net map (default: \code{NULL}).} +\item{maps_x}{Sizes of maps along x- and y-axes comprising guide net map. +(default: \code{NULL}).} -\item{maps_y}{A y-axis size of maps comprising guide net map (default: \code{NULL}).} +\item{maps_y}{Sizes of maps along x- and y-axes comprising guide net map. +(default: \code{NULL}).} -\item{fine_phase}{A character vector to specify fine grained phases which tend to comprise multi-phase pixels e.g., c('Pl', 'Amp')} +\item{fine_phase}{A character vector to specify fine grained phases +which tend to comprise multi-phase pixels e.g., c('Pl', 'Amp')} \item{fine_th}{0.9} -\item{qnt}{\code{qm_qnt} class object returned by \code{read_qnt()}.} +\item{qnt}{\code{qm_qnt} class object returned by \code{\link[=read_qnt]{read_qnt()}}.} \item{qltmap}{qm_xmap class object (xmap param of quantify)} -\item{cluster}{\code{qm_cluster} class object returned by \code{cluter_xmap()}.} +\item{cluster}{\code{qm_cluster} class object returned by \code{\link[=cluster_xmap]{cluster_xmap()}}.} } \description{ -(Deprecated) Use quantify. +(DEPRECATED) Use quantify. } diff --git a/man/quantify.Rd b/man/quantify.Rd index 3d9d7cb..27cbdf8 100644 --- a/man/quantify.Rd +++ b/man/quantify.Rd @@ -2,23 +2,23 @@ % Please edit documentation in R/quantify.R \name{quantify} \alias{quantify} -\title{quantify qualtitative mapping data} +\title{Quantify X-ray maps} \usage{ quantify(xmap, qnt, cluster, maps_x = NULL, maps_y = NULL, fine_phase = NULL, fine_th = 0.9, fixAB = NULL, fixB = NULL) } \arguments{ -\item{xmap}{\code{qm_xmap} class object returned by \code{read_xmap()}.} +\item{xmap}{\code{qm_xmap} class object returned by \code{\link[=read_xmap]{read_xmap()}}.} -\item{qnt}{\code{qm_qnt} class object returned by \code{read_qnt()}.} +\item{qnt}{\code{qm_qnt} class object returned by \code{\link[=read_qnt]{read_qnt()}}.} -\item{cluster}{\code{qm_cluster} class object returned by \code{cluter_xmap()}.} +\item{cluster}{\code{qm_cluster} class object returned by \code{\link[=cluster_xmap]{cluster_xmap()}}.} -\item{maps_x}{A x-axis size of maps comprising guide net map (default: \code{NULL}).} +\item{maps_x, maps_y}{Sizes of maps along x- and y-axes comprising guide net map. +(default: \code{NULL}).} -\item{maps_y}{A y-axis size of maps comprising guide net map (default: \code{NULL}).} - -\item{fine_phase}{A character vector to specify fine grained phases which tend to comprise multi-phase pixels e.g., c('Pl', 'Amp')} +\item{fine_phase}{A character vector to specify fine grained phases +which tend to comprise multi-phase pixels e.g., c('Pl', 'Amp')} \item{fine_th}{0.9} @@ -27,5 +27,5 @@ quantify(xmap, qnt, cluster, maps_x = NULL, maps_y = NULL, \item{fixB}{fix B (default: \code{NULL}).} } \description{ -quantify qualtitative mapping data +Quantify X-ray maps } diff --git a/man/read_cnd.Rd b/man/read_cnd.Rd index f69420c..f805c93 100644 --- a/man/read_cnd.Rd +++ b/man/read_cnd.Rd @@ -30,7 +30,7 @@ read .cnd files } \section{.default}{ -A default method which returns a result of \code{readLines(x)} +A default method which returns a result of \code{\link[=readLines]{readLines()}} with additional class according to the content of the file. } diff --git a/man/save4qm.Rd b/man/save4qm.Rd index 883f625..831f0dd 100644 --- a/man/save4qm.Rd +++ b/man/save4qm.Rd @@ -50,7 +50,8 @@ together with invisible return of \code{x}. \section{\code{save4qm.qm_cluster}}{ -A method for \code{qm_cluster} class returned by \code{cluster_xmap()} or \code{cluster_group()}. +A method for \code{qm_cluster} class returned by +\code{\link[=cluster_xmap]{cluster_xmap()}} or \code{\link[=group_cluster]{group_cluster()}}. Object is saved as RDS file and png file. The latter shows distribution of phases among a mapped area. } diff --git a/man/segment.Rd b/man/segment.Rd index b1d519e..e7dd6af 100644 --- a/man/segment.Rd +++ b/man/segment.Rd @@ -10,7 +10,7 @@ segment(x, ...) \method{segment}{character}(x, ...) } \arguments{ -\item{x}{A path to the image file (PNG, JPEG, and BMP).} +\item{x}{A path to the PNG image file.} \item{...}{ignored} } @@ -22,14 +22,8 @@ Make index to segment mapping area. The obtained index is further utilized in \code{\link[=mean.qntmap]{mean.qntmap()}}. } \examples{ -library(imager) -x <- system.file('extdata/parrots.png',package='imager') -print(x) # x is a path to the example image file. -head(segment(x)) # [1] "#747458" "#757559" "#78785C" "#77765B" "#78785C" "#78785C" -\dontrun{ -segment(matrix(1:9, 3, 3)) -# This gives error as current version only support a path of a image file as input -} +x <- system.file("img", "Rlogo.png", package="png") +head(segment(x)) } \seealso{ diff --git a/qntmap.Rproj b/qntmap.Rproj index 8e79743..1a347ab 100644 --- a/qntmap.Rproj +++ b/qntmap.Rproj @@ -2,7 +2,7 @@ Version: 1.0 RestoreWorkspace: No SaveWorkspace: No -AlwaysSaveHistory: Default +AlwaysSaveHistory: No EnableCodeIndexing: Yes UseSpacesForTab: Yes diff --git a/vignettes/add_phase.R b/vignettes/add_phase.R index 45f9de0..fa8d12d 100644 --- a/vignettes/add_phase.R +++ b/vignettes/add_phase.R @@ -65,7 +65,7 @@ centers <- find_centers(xmap, qnt) centers ## ------------------------------------------------------------------------ -plot(xmap, 'Si', interactive = TRUE) +plot(xmap, 'Si', interactive = FALSE) ## ------------------------------------------------------------------------ centers <- add_centers(centers = centers, xmap = xmap, x = 18, y = 28, p = 'Qtz') diff --git a/vignettes/add_phase.html b/vignettes/add_phase.html index 96e91b7..243ff92 100644 --- a/vignettes/add_phase.html +++ b/vignettes/add_phase.html @@ -12,1810 +12,10 @@ - + Add phases after EPMA analysis - - - - - - - - @@ -2080,7 +280,7 @@

    Add phases after EPMA analysis

    YASUMOTO Atsushi

    -

    2018-11-01

    +

    2018-11-29

    @@ -2156,7 +356,7 @@

    Modify data

    #> #> Ol #> 20
    -

    +

    @@ -2174,9 +374,8 @@

    Initialize cluster centers

    Compare the initial centroids with X-ray map plotted with heatmap

    - -
    - + +

    In this case, an analysist will notice there is something other than olivine. Let’s mouse over the interactive map and one will see one of the coordinates of quartz (e.g., x = 18, y = 28). Keep it in your note.

    diff --git a/vignettes/basic.R b/vignettes/basic.R index cb62439..77c9413 100644 --- a/vignettes/basic.R +++ b/vignettes/basic.R @@ -54,8 +54,8 @@ plot(xmap, 'Si', interactive = FALSE) + data = epma, inherit.aes = FALSE ) -## ------------------------------------------------------------------------ -plot(xmap, 'Mg', interactive = TRUE) +## ---- echo = FALSE------------------------------------------------------- +plot(xmap, 'Mg', interactive = FALSE) ## ------------------------------------------------------------------------ centers <- find_centers(xmap, qnt) diff --git a/vignettes/basic.html b/vignettes/basic.html index c4a9dd7..eb39ae8 100644 --- a/vignettes/basic.html +++ b/vignettes/basic.html @@ -12,1810 +12,10 @@ - + Basic usage - - - - - - - - @@ -2080,7 +280,7 @@

    Basic usage

    Atsushi YASUMOTO

    -

    2018-11-01

    +

    2018-11-29

    @@ -2088,7 +288,8 @@

    2018-11-01

    Intro

    This vignette introduce a basic procedure of analysis using qntmap package using example data.

    -

    See https://doi.org/10.2138/am-2018-6323CCBY for technical details.

    +

    See https://atusy.github.io/qntmap/#epma-analysis for preparing EPMA data.

    +

    See https://doi.org/10.2138/am-2018-6323CCBY for implementations.

    Preparation

    @@ -2112,36 +313,12 @@

    Copy example data

    #> [1] TRUE

    TRUE indicates files are successfully copied. Check if really files are copied by dir().

    +#> [1] ".map/1/0.cnd" ".map/1/1.cnd" ".map/1/1_map.txt" +#> [4] ".map/1/2.cnd" ".map/1/2_map.txt" ".qnt/.cnd/elemw.cnd" +#> [7] ".qnt/bgm.qnt" ".qnt/bgp.qnt" ".qnt/elem.qnt" +#> [10] ".qnt/elint.qnt" ".qnt/mes.qnt" ".qnt/net.qnt" +#> [13] ".qnt/pkint.qnt" ".qnt/stg.qnt" ".qnt/wt.qnt" +#> [16] "README.md"
    @@ -2156,14 +333,15 @@

    Load data

    This is an artifact example data which contains olivine and quartz within the mapping area. The phases are quantified 20 points each.

    -

    +

    Plot X-ray map data as heatmap

    -

    Plots are by default interactive. Specify ‘Si’ instead of ‘Mg’ to see Si map. Specify interactive = FALSE if necessary.

    - -
    - +

    Plots are by default interactive with webui. Selection of elements can be done on webui.

    + +

    Cluster analysis

    @@ -2217,7 +395,7 @@

    Quantify

    Plot quantified map

    Just like X-ray map.

    -

    +

    Summarize quantified map