# CEMRG Software Development getting started
## Basics
+ SSH keys so you can pull/push from github and bitbucket
+ Install docker
+ Log into docker (cemrgdev)
+ install anaconda
+ isntall poetry
+ Install IDE (vscode or whatever)
<!-- > The password for cloning the repository differs from the Bitbucket account password you set up when registering the account. On MacBook, we can follow these 4 steps to clone the repository via ssh.
> 1. Generate a ssh key: ssh-keygen -b 4096 -t rsa
> 2. Copy the key: cat ~/.ssh/id_rsa.pub | pbcopy
> 3. Paste it in: Settings -> Personal Bitbucket settings -> SSH keys.
> 4. Clone the repository by ssh: git clone git@bitbucket.org:electromechanics/meshtools3d.git -->
## Software to download and install
In a lot of these, it is useful to create a sybolic link to the `/usr/local/bin` folder
+ [Paraview](https://www.paraview.org/download/)
+ [itk-snap](http://www.itksnap.org/)
+ try to get the one that comes bundled with `c3d`
+ [meshtool](https://bitbucket.org/aneic/meshtool/src/master/)
+ [meshalyzer](https://opencarp.org/download/installation#meshalyzer)
## In-house software
+ Install the external libraries MLib and M3DLib (Ask José)
+ Get Cristobal to help you install:
+ `segtools`
+ `carp`
## For development
+ [Qt](https://download.qt.io/archive/qt/5.12/5.12.10/)
```shell=
cd ~/installs # create it if you don't have it!
wget https://download.qt.io/archive/qt/5.12/5.12.10/qt-opensource-linux-x64-5.12.10.run
chmod +x qt-opensource-linux-x64-5.12.10.run
./qt-opensource-linux-x64-5.12.10.run
# follow instructions
```
+ Clone the following
+ [CemrgApp](https://github.com/OpenHeartDevelopers/CemrgApp)
+ If you're just using it, then just get the binaries from José
+ mitk (https)
+ meshtools3d
+ [imatools](https://github.com/alonsoJASL/imatools) - this is a handy python library with basic image analysis and meshing operations
## Docker
+ Log into docker if you haven't
> ask José to help you here
+ Pull the following docker images
+ `cemrg/uac:3.0-beta`
+ `cemrg/4ch:latest`
+ `cemrg/seg-4ch:latest`
+ `cemrg/vtk_to_42:latest`
## Build CemrgApp
Use [instructions](https://github.com/OpenHeartDevelopers/CemrgApp/wiki/Build-CemrgApp-from-Scratch).
Whilst we're transitioningto version 3.0 or CemrgApp do the following to keep compatibility with VTK and old MIRTK libraries.
When CemrgApp finished building, go to the `$CEMRG_BUILD/ep/src/VTK/IO/Legacy/vtkDataWriter.cxx` file and change the line
```c++
this->FileVersion = VTK_LEGACY_READER_VERSION_5_1;
```
to
```c++
this->FileVersion = VTK_LEGACY_READER_VERSION_4_2;
```
and build again.
# Useful tools
+ Rust alternatives. [Install cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html) on linux or use homebrew in macOS to download these:
+ `exa`
+ `tldr`
+ `fd`
+ Starship promt
+ Kitty terminal
+ Run prompt rofi: `sudo apt install rofi`
## 3D printer
#### PrusaSlicer (instructions for linux)
```
sudo apt update -y
sudo apt install flatpak gnome-software-plugin-flatpak -y
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak install flathub com.prusa3d.PrusaSlicer
```
Run with:
```
flatpak run com.prusa3d.PrusaSlicer
```
### Instructions to print
#### Setup
+ To print you’ll need a surface mesh in obj format (you can convert it using meshtool)
+ In the installer, when it ask you to select the printer, scroll down and select **Original Prusa i3 MK3S & MK3S+**, with the nozzle options of **0.4, 0.6 and 0.8 mm**
#### Print
+ Select “Normal” or “advanced” mode (yellow mode)
+ Ask a previous user about the setup. The main things are the extruder is 0.8mm, temperature 220 degrees, and the support is 5% and organic.
+ When placing the object in the bed of the printer (the flat surface), I’d recommend to place it hovering a little bit. This will create the organic, tree-like supports that are really easy to snap.
+ Select “Slice” to generate the rendered/final version of the file. You’ll see the amount of material used, and the approximate time it will take to print. You can play around with the position of the object to find out how to print it more efficiently.
+ When exporting, always export both the gcode and the session. So each case should always have 3 files.