 # Particle brain

In this tutorial we’re making a brain consisting of particles.

Requirements:

• Fiji is just ImageJ (https://imagej.net/Fiji)
• Cinema 4D
• X-particles
• Redshift

First of all, we need a brain. Luckily of use we are living in times of open data. There’s plenty of brain MRI data we can use. For instance, have a look at http://www.openfmri.org/dataset/. Here you can download a dataset for a certain subject in a certain study. It will take you some time to download the data as the datasets are quite large.

You’ll end up with an nii.gz file which is quite useless in Cinema 4D. So here’s where Fiji comes in. Open the file using the default settings.

We can now export the brain data to image slices, which will look like this.

Have a look at these pictures and determine a start and end image if needed (in my case the first and last images contained noise). I made a small Python script to convert these images to a point cloud.

` import matplotlib.pyplot as plt import matplotlib.image as mpimg dir = "C:\Users\Linda\Desktop\brain\" filename_prefix = "T1.nii0" output = "output.txt"  startimage = 17 endimage = 196 threshold = 50 print("Starting!" ) o = open(dir + output, "w") o.write("x y z gr\n") maxvalue = 0 z = ""  for f in range(startimage, endimage):     z = str(f)     filename = dir + filename_prefix + str(f).zfill(3) + ".jpg"      img=mpimg.imread(filename)           for x in range(0, img.shape - 1):         for y in range(0, img.shape - 1):             value = img[x][y]             if value > threshold:                 #you could use the greyscale value for shading                 o.write(str(x) + " " + str(y) + " " + str(z) + " " + str(value) + "\n")          o.close() print("Done!" )`

Create a particle system in Cinema 4D and include a data importer. Import the file and make sure the delimiter is set to tabs. Also, make sure the maximum amount of rows is equal or larger than the actual amount of rows.

Now map the x, y and z values. If you want to, you can also map the greyscale value to a color.

Now you can press load data and start the animation. The emitter now starts showing the particles.

In order to render it in Redshift, we need to add a Redshift object tag to the particle emitter. Select the mode sphere instances in this Redshift tag and now we’ve make a very basic brain render.

The scale multiplier can be used to make the spheres smaller.

Now we add a background plane, some lighting and materials.

In the final versions I decided to use a random particle color and a gradient.