# import smilPython
import smilPython as sp
# functions using matplotlib to display images on jupyter notebooks
from smilPlot import *
import numpy as np
from smilPython import *
imIn1 = sp.Image("http://smil.cmm.mines-paristech.fr/images/barbara.png")
imIn2 = sp.Image("http://smil.cmm.mines-paristech.fr/images/lena.png")
smilPlot([imIn1, imIn2], title = ["im1", "im2"])
im1 = sp.Image(imIn1)
sp.copy(imIn1, im1)
im2 = sp.Image(imIn2)
sp.copy(imIn2, im2)
im3 = sp.Image(imIn1)
# Crop the content of im1 from (256, 0) to im3 (which will be resized)
sp.crop(imIn1, 256, 0, 256, 256, im3)
# Copy the content of im2 and put it at position (0, 256) in im1
sp.copy(imIn2, im1, 0, 256)
# Copy the window starting at (256, 0) and with dimensions 128x128 and put it at (128, 128) in im2
sp.copy(im1, 256, 0, 128, 128, im2, 128, 128)
# Same as previous (simple way)
sp.copy(im1, 256, 0, im2, 128, 128)
smilPlot([im1, im2, im3])
# Create a 3D image (three layers) and copy slices inside it
im3D = sp.Image(im2.getWidth(), im2.getHeight(), 3)
im3D << 0
sp.copy(im1, 0, 256, im3D)
sp.copy(im3, im3D, 0, 0, 2)
sp.close(im3D, im3D, sp.cbSE())
# Unfortunately, we can't easily display here a 3D image.
smilPlot([im3D])