---
title: "X-Ray Computed Tomography JSON-LD"
author: "Thomas Ciardi, Roger H. French"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{X-Ray Computed Tomography JSON-LD}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

XCT JSON-LD Description
-----------------------------------
In XCT JSON-LD template, a sample corresponds to an XCT image taken during an experiment. It encloses relevant experimental metadata from the sample being imaged, machinery used, and image information. More detailed structure is shown in the schema diagram below.

Creating JSON-LD for XCT in R
------------------------------------------
```{r, message=FALSE, eval=FALSE}
library(FAIRmaterials)

# An example data frame for XCT
xct_data <- data.frame(
  'SampleID' = c('sx_0001_0000', 'sx_0032_1245'),
  'Alloy' = c('AlMg', 'AlMg'),
  'SequenceNumber' = c('0001', '0032'),
  'StackNumber' = c('0000', '1245'),
  'FilePath' = c('/home/0001_0000.tiff', '/home/0032_1245.tiff'),
  'Load' = c(10, 16)
)

# This will generate json-ld files for the example data
# Be sure to put in exact domain name as shown in fairify_data documentation. 
# See ?fairify_data for domain names.
xct_output <- fairify_data(xct_data, domain = 'XCT')
```

Creating JSON-LD for XCT in Python
------------------------------------------

```{python, eval = FALSE, message = FALSE, python.reticulate = FALSE}
from fairmaterials.fairify_data import *
import pandas as pd

# Create an example data frame for XCT
data = pd.DataFrame(
  'SampleID' = ['sx_0001_0000', 'sx_0032_1245'],
  'Alloy' = ['AlMg', 'AlMg'],
  'SequenceNumber' = ['0001', '0032'],
  'StackNumber' = ['0000', '1245'],
  'FilePath' = ['/home/0001_0000.tiff', '/home/0032_1245.tiff'],
  'Load' = [10, 16]
)

# This will generate JSON-LD file for the example data
output <- fairify_data(data, domain = 'XCT')
```

XCT schema diagram
--------------------------

```{r, out.width="1200px", echo=FALSE, fig.cap="XCT schema diagram"}
knitr::include_graphics("computedTomographyXRay.png")
```

Acknowledgment
--------------------------
This material is based upon work supported by the Department of Energy (National Nuclear Security Administration) under Award Number(s) DE-NA0004104.
