Skip to content

Commit

Permalink
Ready for CRAN 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dipterix committed Nov 1, 2024
1 parent 57c15cc commit 3369f61
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
^inst/threeBrainJS/old
^inst/threeBrainJS/src
^inst/threeBrainJS/dist/[0-9]+.threebrain-[a-zA-Z0-9]+.js
^inst/threeBrainJS/dist/threebrain-main\.js\.mapp$
^inst/threeBrainJS/dist/threebrain-worker\.js\.mapp$
^inst/threeBrainJS/dist/threebrain-main\.js\.map$
^inst/threeBrainJS/dist/threebrain-worker\.js\.map$
^inst/threeBrainJS/build\.sh
^inst/threeBrainJS/package
^inst/threeBrainJS/webpack
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Changes since last CRAN release
* `b30a2e23 (HEAD -> master, origin/master, origin/HEAD)` [_`dipterix`_]: Fixed contact-switching and highlight box
* `57c15ccd (HEAD -> master, origin/master, origin/HEAD)` [_`dipterix`_]: Fixed shiny callback when electrode contacts are double-clicked
* `b30a2e23` [_`dipterix`_]: Fixed contact-switching and highlight box
* `c80ed86d` [_`dipterix`_]: Added `PMT` electrodes
* `4c1e669d` [_`dipterix`_]: Fixed non-integer search radius issue
* `8b10f9ee` [_`dipterix`_]: Adjust electrode position can be done under volumetric mode to improve user experience; Electrodes with prototype geometries will use the prototype to infer the locations rather than spacial calculation; Added keyboard shortcut for registering from crosshair
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: threeBrain
Type: Package
Title: Your Advanced 3D Brain Visualization
Version: 1.1.1.9028
Version: 1.2.0
Authors@R: c(
person("Zhengjia", "Wang", email = "[email protected]", role = c("aut", "cre", "cph")),
person("John", "Magnotti", email = "[email protected]", role = c("ctb", "res")),
Expand All @@ -25,7 +25,7 @@ Description: A fast, interactive cross-platform, and easy to share
analyze 'iEEG' data by Magnotti, Wang, and Beauchamp (2020,
<doi:10.1016/j.neuroimage.2020.117341>). Please check
'citation("threeBrain")' for details.
License: MPL-2.0 | file LICENSE
License: MPL-2.0
Encoding: UTF-8
RoxygenNote: 7.3.2
Roxygen: list(r6 = FALSE)
Expand Down
90 changes: 86 additions & 4 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,91 @@
# `TODO` list:
# Change Log

threeBrain 1.2.0
=======

* Drag & drop atlas images cannot show on side canvas when the file name does not follow a specific regular expression. This constraint should be removed
* Improve `dispose` function such that the object can be disposed completely (from `CPU` and `GPU` memories)
* Fixed shiny callback when electrode contacts are double-clicked
* Fixed contact-switching and highlight box
* Added `PMT` electrodes
* Fixed non-integer search radius issue
* Adjust electrode position can be done under volume-mode to improve user experience
* Electrodes with prototype geometries will use the prototype to infer the locations rather than spacial calculation
* Added keyboard shortcut for registering from cross-hair
* Added `get_atlas_values` for continuous atlases such as binary or probabilistic `ROI`
* The radius refers to maximum `RAS` distance instead of `voxel` indexing distance, hence more accurate when the atlas volume has imbalanced slice count
* Renamed `active-voxel` to `column-row-slice` but still keep the naming for backward compatibility
* `Voxel` filter is linear now when displayed at side slices only and when the slice mode is not `active-voxel`
* Fixed drifting issue when visualizing via active `voxel` mode
* Added direction arrow helper to `DBS` (or electrodes with non-zero model up vectors)
* Support `WebAssembly`
* Avoid using `pandoc` to save the whole page self-contained
* Fixed the depth issue in electrode material shader
* Set maximum render length cut-off for electrode prototypes
* Added model tangent (usually the direction) to electrode shader so outlines are correctly visualized
* Fixed electrode prototype rendering issue (color) on Windows
* Fixed the color map for discrete values
* Setting electrode prototype render order to be `-500` so it does not hide behind the transparent surfaces
* Plotting electrodes on slices now takes numerical `adjust_brightness` interpreted as quantile
* Changed default color palette for discrete values, removed colors that are too dark or gray
* Change `CT` threshold back to positive (3000) when switching from `DBS` leads back to `sEEG` leads.
* Support drag and drop annotation files
* Changed electrode material to display front-side only instead of double side to avoid overlapping contacts visually when spacing is small
* Added `Abbott` segmented electrodes `6170-6173`, with segmented electrodes clockwise viewing from `proximal` end
* Fixed a bug that may change electrode coordinate hand
* All the `DBS` electrode prototype maker uses natural `cos` for `x` and `sin` for `y`. However, this will cause electrodes to rely on rendering on back side (material)
* Added missing prototype
* Fixed `BSC` and `Medtronic` electrode orientation (now is counter-clockwise when viewing from `proximal` end)
* Added more spacing for `DBS` segmented contacts
* added prototypes for `Medtronic` segmented electrodes
* Added `BSC-DB` electrodes for `2202` `2201`
* Added internal test code for depth mapping
* Surface mapping has been implemented for depth electrodes, with dynamic offset threshold
* `surface_offset` has been added to electrode field
* `cvs_avg35_inMNI152` has the correct `talXFM` (scanner to `MNI305`) now
* Added `load_mesh` to surface object so users can load surface mesh for computation in `R`
* Added internal `calculate_distances` to compute the distances from a point to its projection to a list of mesh
* `DistanceShifted` in electrode table is taken into account and will be passed to electrode instances
* Inflated surfaces have offset by default
* Fixed a singular matrix bug when the electrode prototype `up` vector is zero or is parallel with the model direction
* Allowed the surface mapped electrodes to be snapped to the surface if the surface world matrix is not identity
* Force the inflated brain to have offset positions
* Added `DBS` electrode prototype `BSC-DB-2202`
* Prototype `set_transform_from_points` now tries to set rotation from transform `Euler` angle when the prototype guided marker is 1-ranked (electrode strip, `DBS` electrodes)
* Allowed electrode prototype to display markers; added viewer options for localization
* Changed electrode direction helper to be displayed inside of cross-hair group
* Allowed side panel to be displayed with atlas column-row-slice
* Added controller to display symmetric continuous color map for volumes
* Fixed the `GLTF` not showing inner-most contact issue
* Removed `devel` version of `ravetools` from check
* Update `Github` action check script
* Added `rhub` check
* Plotting slices have correct margins with partial plot
* Allow users to drag and drop value tables
* Allow users to hide cross-hairs
* Allow `shiny` app to change current color map via proxy
* Allows drag-drop electrode color files
* Added `set_electrode_data` to brain proxy class, allowing `shiny` applications to change the electrode data, set color palettes, and set value ranges in the same call
* Allow masks to be added to `T1`
* Added `D99v2` for monkey brain
* Export `GLTF` for `datacube2`
* Fixed `fix_electrode_color` bug
* Supported `ISO` surface generation from volume
* Added white-matter segmentation as default atlas if user has this file
* Exporting `GLTF` is wrapped with try-catch
* `fix_electrode_color` is exclusive by default
* fixed color fixing issue for naive sphere electrodes
* Changed logo message
* Using better `RAVE` logo and fixed style issues
* Changed shortcut `p` to toggling the visibility and `shift+p` to switching surface types
* Added logo to control panel to advertise the project
* Added export `GLTF` binary format
* Separate `3D` and `2D` canvas;
* Converts `*h.pial.gii` to `FreeSurfer` format when the files are missing
* Allow electrode depth test to be disabled (always-depth) on contact and/or outlines
* Fixing the vertex shader output not read by fragment shader issue
* Drop-in feature support color-map for volume and surfaces
* Added contact order to display when electrode is clicked
* Added `DIXI` (`AM`, `BM`, `CM`) electrode specifications

# Change Log

threeBrain 1.1.0
=======
Expand Down
2 changes: 1 addition & 1 deletion R/class_brainelectrodes.R
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ BrainElectrodes <- R6::R6Class(
})

lapply(seq_along(self$objects2), function(ii) {
el = self$objects2[[ii]]
el <- self$objects2[[ii]]
channels <- el$prototype$channel_numbers
base_table <- data.frame( Electrode = channels )

Expand Down
8 changes: 4 additions & 4 deletions R/class_electrode_proto.R
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,13 @@ ElectrodePrototype <- R6::R6Class(

if ( abs( a_y ) < 0.9999999 ) {

a_x = atan2( m33[3, 2], m33[3, 3] );
a_z = atan2( m33[2, 1], m33[1, 1] );
a_x <- atan2( m33[3, 2], m33[3, 3] )
a_z <- atan2( m33[2, 1], m33[1, 1] )

} else {

a_x = 0;
a_z = atan2( - m33[1, 2], m33[2, 2] );
a_x <- 0
a_z <- atan2( - m33[1, 2], m33[2, 2] )

}

Expand Down
10 changes: 5 additions & 5 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Update logs (for R-cran only)

## 2024-07-16
**Version 1.1.1 (current)**
## 2024-11-01
**Version 1.2.0 (current)**

To address the `CRAN` issues:

Expand All @@ -22,16 +22,16 @@ Package `ravetools` has been updated and on `CRAN` now. The dependency is cleare

This package (`threeBrain`) is developed out of fun and used in my thesis and later projects. I am the solo developer in this project (wrote 99.99% code). Other contributors are explicitly claimed in the `DESCRIPTION`.

There is one external `JavaScript` library `three-brain-js`. The code is located at `inst/threeBrainJS`. I am also the main maintainer and contributor of that project. The distribution included is a compiled bundle that is released under `MPL-2.0` as a whole. As required, the license file has been included. There might some other external programs used by that bundle, but they can't claim the authorship of the release bundle. Their corresponding license files are included too.
There is one external `JavaScript` library `three-brain-js`. The code is located at `inst/threeBrainJS`. I am also the main maintainer and contributor of that project. The distribution included is a compiled bundle that is released under `MPL-2.0` as a whole. As required, the license file has been included when `mpn` compiles the bundles, see `inst/threeBrainJS/dist`. There might some other external programs, but they can't claim the authorship of the release bundle. Their corresponding license files are included too.


Self check: 0 errors | 0 warnings | 1 note

```
❯ checking installed package size ... NOTE
installed size is 6.9Mb
installed size is 7.3Mb
sub-directories of 1Mb or more:
R 2.1Mb
R 2.0Mb
threeBrainJS 2.9Mb
```

Expand Down
9 changes: 5 additions & 4 deletions inst/prototypes/GeometryMaker/DBS_Abbott.R
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ config <- list(
)
)

proto <- threeBrain:::ElectrodePrototype$new("")$from_list(config); proto
proto <- threeBrain:::ElectrodePrototype$new("")$from_list(config)
proto
proto$validate()

a <- invisible(proto$get_texture(seq_len(proto$n_channels), plot = TRUE))
Expand All @@ -347,9 +348,9 @@ proto$preview_3d()
proto$save_as_default(force = TRUE)


mesh = proto$as_mesh3d()
mesh$material$back = "filled"
self = proto
mesh <- proto$as_mesh3d()
mesh$material$back <- "filled"
self <- proto
ravetools::rgl_view({
ravetools::rgl_call("shade3d", mesh)
})
3 changes: 2 additions & 1 deletion inst/prototypes/GeometryMaker/DBS_BostonScientific.R
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ config <- list(
)
)

proto <- threeBrain:::ElectrodePrototype$new("")$from_list(config); proto
proto <- threeBrain:::ElectrodePrototype$new("")$from_list(config)
proto
proto$validate()

a <- invisible(proto$get_texture(seq_len(proto$n_channels), plot = TRUE))
Expand Down
9 changes: 5 additions & 4 deletions inst/prototypes/GeometryMaker/DBS_Medtronic.R
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ config <- list(
)
)

proto <- threeBrain:::ElectrodePrototype$new("")$from_list(config); proto
proto <- threeBrain:::ElectrodePrototype$new("")$from_list(config)
proto
proto$validate()

a <- invisible(proto$get_texture(seq_len(proto$n_channels), plot = TRUE))
Expand All @@ -377,9 +378,9 @@ proto$preview_3d()
proto$save_as_default(force = TRUE)


mesh = proto$as_mesh3d()
mesh$material$back = "filled"
self = proto
mesh <- proto$as_mesh3d()
mesh$material$back <- "filled"
self <- proto
ravetools::rgl_view({
ravetools::rgl_call("shade3d", mesh)
})

0 comments on commit 3369f61

Please sign in to comment.