# Blockchain-Based Distributed Patient-Centric Image Management System
## 4 Overview of the PCIM System
### System Interaction  
Figure 3 illustrates the process of how a patient and a radiologist interact between each other in the part of the proposed PCIM system, where medical image storage and access sharing are performed. First, the patient undergoes the medical image examination performed by the radiologist. A medical image \(I_{P}\) of the patient is produced. The patient seeks to have it protected and to maintain the ownership of this image. Consequently, to address this issue, the radiologist encrypts the initial medical image and obtains encrypted image. Thereafter, the radiologist obtains the hash of the encrypted image \(h(Tp)\) from the IPFS network and provides the patient with \(h(Tp)\) for the reference purpose. \(h(Tp)\) is stored in the blockchain, while the encrypted medical image \(\overline{I}_{P}\) is stored in IPFS. Owing to the fact that the image was encrypted, the patient medical image \(I_{P}\) is accessible only to those who have the decryption key and thereby, it is protected from unauthorized access.  
As presented in Figure 3, the exact protocol for this interaction is explained in detail as follows:  
* Step 1: _Offline interaction between the patient and the radiologist_ Step 1.1: The patient requests the radiologist to store his/her medical image. Step 1.2: The radiologist asks the patient to provide its encryption key. Step 1.3: The patient generates a pair of encryption keys: public \(K_{p}^{+}\) and private \(K_{p}^{-}\). Step 1.4: The patient sends the public key \(K_{p}^{+}\) to the radiologist through a secure communication medium for creating image authentication and encrypt the original medical image. Step 1.5: \(K_{p}^{-}\) is protected and kept safe by the patient.
* Step 2: The radiologist encrypts with \(K_{p}^{+}\) while concealing the patient private information on a medical image. Encrypted image \(\overline{I}_{P}\) is uploaded to the IPFS network, which returns a hash \(h(\overline{I}p)\) to the radiologist.
* Step 3: The radiologist shares \(h(\overline{I}p)\) through a secure communication medium with the patient.
* Step 4: The patient creates a contract using the PCAC-SC protocol and executes it.
* Step 5: The created contract function signs a transaction on the Ethereum blockchain along with patient public key (\(\Phi_{p}^{+}\)), \(h(\overline{I}p)\), time, image description (\(\Delta_{P}\)) such as patient blockchain address (\(\Phi_{P}\)), and an imaging modality from which the data are obtained (e.g., CT, US, MRI, etc.). This transaction is verified by the radiologist and included in the blockchain. This verification process prevents multiple entities from executing _create_contract()_ function on the same image hash.
* Step 6: The patient owns the medical images within the PCIM system. The patient can access, audit, prove the ownership, and authorize any other \(IRs\) (e.g., clinicians, medical institutions, research groups and general practitioners) to use their medical images based on PCAC-SC. We discuss the PCAC-SC interaction sequence in Section 5.2.  
In summary, a blockchain transaction consists of the following contents signed by a patient to represent the ownership of the transaction contents:  
\[\left\{\Phi_{P},h(\overline{I}p),\Delta_{P}\right\}_{\Phi_{p}^{-1}} \tag{1}\]  
where the part given inside the parenthesis, \(\left\{\ \right\}\), is the content signed under the Ethereum blockchain private key \(\Phi_{P}^{-1}\) of the patient.