{"id":37890336,"url":"https://github.com/bunpc/ninjacap2","last_synced_at":"2026-01-16T16:55:53.338Z","repository":{"id":261450575,"uuid":"333829419","full_name":"BUNPC/ninjaCap2","owner":"BUNPC","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-03T14:09:43.000Z","size":33097,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-09T20:40:50.492Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"MATLAB","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BUNPC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-01-28T17:13:19.000Z","updated_at":"2025-06-06T00:26:35.000Z","dependencies_parsed_at":"2025-02-03T15:34:44.805Z","dependency_job_id":null,"html_url":"https://github.com/BUNPC/ninjaCap2","commit_stats":null,"previous_names":["bunpc/ninjacap2"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BUNPC/ninjaCap2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BUNPC%2FninjaCap2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BUNPC%2FninjaCap2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BUNPC%2FninjaCap2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BUNPC%2FninjaCap2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BUNPC","download_url":"https://codeload.github.com/BUNPC/ninjaCap2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BUNPC%2FninjaCap2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28480081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-16T16:55:52.675Z","updated_at":"2026-01-16T16:55:53.328Z","avatar_url":"https://github.com/BUNPC.png","language":"MATLAB","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ninjaCap2 Repo: BRIEF DESCRIPTION\nThis repository contains the complete framework necessary to generate ninjaCaps. \nThis help file explains how to set up and run the ninjacap code using matlab and the blender-python integration. \nLast major version: Feb 2021.\n\nInputs to this framework are\n1. a \"probe.SD\" file that describes the geometrical setup (as documented in the Homer3 / AtlasViewer toolbox)\n1. the desired headcircumference in cm.\n\nOutputs of this code are four .stl files for 3D printing with ninjaflex.\n\n# HOW TO SET EVERYTHING UP\n\n## 1. Install Matlab and the AtlasViewer (Homer3) toolbox for Matlab\nThe latest Matlab version that the ninjaCap code was successfully tested with is R2019b.\nInstall the latest version of AtlasViewer and Homer3 (sourcecode, not the executable) for Matlab. You can get them here:\thttps://github.com/BUNPC/AtlasViewer\nhttps://github.com/BUNPC/Homer3\nDon't forget to install the toolbox by running \"setpaths\" (see AtlasViewer/Homer3 documentation).\n\n## 2. Get the latest version of ninjaCap2 code\nyou are already here: make a local copy of this repository (https://github.com/neuluce/ninjaCap2).\n\n## 3. Install Blender 2.82 64Bit \nPlease note that the ninjacap2 python script may or may not be compatible with older/other versions, \nas blender python commands might be subject to changes over time.\nYou can get it here:\t\thttps://www.blender.org/download/releases/2-82/\n\n## 4. Add necessary Python modules to Blender's Python\nBlender uses its own Python. Blender 2.80 upwards uses Python 3.7.\nFor this reason, you need to install necessary modules (scipy) explicitly into Blender's Python.\nIf you have your own Python distribution + modules such as Anaconda installed,\nblender's Python will not natively find those modules. \nIf you manage modules with pip, make sure they are installed into Blender's Python!\nIn the instructions below, \u003c \u003e defines commands to run in the console and\npaths are example paths that need to be adapted to the directories in your installation.\n1. Start your Python CMD shell (e.g. Anaconda Prompt) or the Windows CMD console as *administrator*\n1. move to the blender\\python folder, (e.g. C:\\Program Files\\Blender Foundation\\Blender\\2.82\\python\\bin)\n1. from this folder, run *\u003cpython -m ensurepip\u003e*. This will link and install pip for python module management. Please note that Blender 2.81 and following versions might not need you to run the ensurepip command. If you get an error when running this command in version(s) 2.81+ just skip this step.\n1. update pip and pip wheel by running *\u003cpython -m pip install --upgrade pip\u003e* and\n\t*\u003cpython -m pip install --upgrade pip setuptools wheel\u003e*\n1. install the **scipy module** using pip. specify the target folder (--target), otherwise the modules might end up in your\n\tOS python folders and will not be found by Blender. E.g. *\u003c\tpython -m pip install scipy --target=\"C:\\Program Files\\Blender Foundation\\Blender\\2.80\\python\\lib\"\u003e* \n  (adapt directory to your folder structure accordingly).\n\n# PREPARING FILES FOR A CAP BUILD\n\n## 1. Create your \"probe.SD\" using the newest AtlasViewer GUI. \nFollow the typical process to generate a probe with the AtlasViewer SDgui. Then, for each source, detector AND dummy optode, select the Grommet Type of that optode. The Grommet Type is an identifier that is used in the cap generation to place the desired element (holder, grommet, …) at the position of the corresponding optode. A brief instruction and list of currently supported grommets/holders, including their IDs, is provided [here](https://github.com/neuluce/ninjaCap/blob/master/docu/grommet_lookup.pdf). Selecting the type “#NONE” will skip the placement of a holder/ an element for this optode. You can assign any Grommet Type identifier to any optode (source, detector, and dummy optodes)!\n\n![](https://github.com/neuluce/ninjaCap/blob/master/docu/grommetType.png)\n\nPlease note for Short Separation (SS) channels: Depending on the type of grommet you choose, short separation channels (holes for a SS fiber) are typically already included. In your SD probe layout, you might have added dedicated SS optodes. If you did, just give those a “#NONE” ID to skip the placement of a dedicated element at the SS optode location.\n\nPlease make sure you follow the keep out guidelines shown [here](https://github.com/neuluce/ninjaCap/blob/master/docu/guidelines_keepOutRegions): If you place grommets in the keep out region, they will overlap with the ear slits.\n![](https://github.com/neuluce/ninjaCap/blob/master/docu/keepout.png)\n\n# HOW TO BUILD A CAP \n\n## 1. Provide all relevant files:\n1. place the \"probe.SD\" file in a new directory.\n1. the following **optional** steps are available, but are not necessary by default:\n    1. (optional) provide your own 'atlasViewer.mat' headmodel in the root '.../ninjaCap/' directory\n    1. (optional) provide your custom side outline .svg file in the '.../ninjaCap/svg/' directory. -\u003e change the filename in 'ninjaCap/matfun/cap.m' accordingly, if you did not use the default names 'side_piece1.svg' and 'side_piece2.svg'.\n    1. (optional, advanced) provide your custom .STL elements to be placed with corresponding grommet IDs. These elements can be grommets, straps, cases, anything. Place them in '.../ninjaCap/stl/elements/\u003cidentifier\u003e/'. For this to work, you need to follow the ID-/file-/folder- naming conventions outlined [here](https://github.com/neuluce/ninjaCap/blob/master/docu/grommet_lookup.pdf).\n\t\n## 2. Generate the ninjaCap \n1. Open matlab, go to AtlasViewer directory and add AtlasViewer directory to matlab path by running the command 'setpaths' in the matlab command line. \n\n2. Go to ninjaCap2 directory and add ninjaCap2 directory to matlab path by running the command 'addpath(genpath('.'))' in the matlab command line.\n\n3. Now go to the \"probe.SD\" directory and run the function '* generateNinjaCap.m*'. The only argument for this function is the desired head circumference in cm. To generate a cap with 56cm headcircumference, run ' generateNinjaCap(56)'. If you do not provide an argument, 56cm is assumed per default. Watch your cap being built. By the end of the process, matlab open a Blender3D workspace.\n\n4. In the Blender workspace, the python script 'nynja_blender_exec.py' (ninjaCap root directory) should already be loaded per default on the right hand side. If for any case it isnt or you have your own Blender workspace, open the script window and load the script. Run the script by pressing ALT+P or clicking on 'Text -\u003e Run Script' in the script window.\n\n![](https://github.com/neuluce/ninjaCap/blob/master/docu/blender.png)\n\nWhen blender has done its work, close it. This will also terminate the running matlab script.\n\n## 3. Get and print the ninjaCap files\nThe fully generated and assembled ninjaCap panels are saved in the '.../ninjaCap2/print/' subdirectory.\nYou should find four .STL files there: 'sideLeft_proc.STL', 'sideRight_proc.STL', 'top1_proc.STL' and 'top2_proc_STL'.\nThese files can now be 3D printed. For this, use ninjaflex material with the CURA LulzBot Taz 6 Aerostruder and the printing profile 'ninjaCap_profile.curaprofile' that is also provided in the '.../ninjaCap2/print/' subdirectory.\nIf you want to view the files before moving on to the 3D printing step, you can open them with any STL viewer, such as for example [Meshlab](https://sourceforge.net/projects/meshlab/).\n\n![](https://github.com/neuluce/ninjaCap/blob/master/docu/cap.PNG)\n\n\n## 4. Finish the cap\nWith all the panels printed, you now need to assemble the cap, e.g. with an ultrasonic welder. Done.\n\n# DIRECTORY AND FILE STRUCTURE\nThe ninjaCap2 repository has all main scripts and workspaces that need to be executed in the root directory. The subdirectories provide documentation, auxiliary functions, templates, user inputs, generated files, and so forth. This structure is documented in the following:\n\n* /docu/ - contains images and grommet ID manual and documentation\n* /extfun/ - contains external matlab scripts, e.g. from matlab central, including the corresponding license files\n* /fw/ - a default AtlasViewer directory (**ignore**)\n* /imagerecon/ - a default AtlasViewer directory (**ignore**)\n* /scripts/ - contains all ninjaCapw matlab scripts and functions called by 'generateNinjaCap.m' and its subroutines.\n* /print/ - contains the results of the ninjaCap generation process. You find your .STL files for 3D printing, and the 3D printing profile in here.\n* /stl/ - contains (subfolders with) the cap elements that are generated by the matlab routines, as well as element templates (grommets, chinstraps, etc..). The Blender Python script assembles the cap using these elements.\n* /svg/ - contains .svg files for the outline of the sidepieces. \n* /template/ - contains templates for the projection of 3D AtlasViewer probe coordinates relative to the EEG 10-10 system onto 2D cap panels.\n* / - contains the necessary files for cap generation that the user needs to provide: 'probe.SD'.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbunpc%2Fninjacap2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbunpc%2Fninjacap2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbunpc%2Fninjacap2/lists"}