Posts

How to read dicom image metadata using dcm4che in Java

To read DICOM image metadata, we can use the dcm4che library. First, we need to download and add the dcm4che library to our project. we can do this by adding the following dependency on our project's build file (e.g., pom.xml for Maven): <dependency> <groupId>com.github.dcm4che</groupId> <artifactId>dcm4che-core</artifactId> <version>3.4.1</version> </dependency> Now, let's create the java class to read the metadata from a DICOM file: import org.dcm4che3.data.Attributes; import org.dcm4che3.io.DicomInputStream; import java.io.File; import java.io.IOException; public class DicomMetadataReader { public static void main(String[] args) throws IOException { File dicomFile = new File("/path/to/dicom/dicomfile.dcm"); DicomInputStream dis = new DicomInputStream(dicomFile); Attributes metadata = dis.readDataset(-1, -1); dis.close(); // You can now access the metadata using the

How to Install SimpleITK on Linux/Ubuntu for Java Application

Image
In this tutorial, we are going to learn how to install SimpleITK which is very handy for medical image analysis. SimpleITK is a simplified programming interface to the algorithms and data structures of the Insight Toolkit (ITK). It supports bindings for multiple programming languages including C++, Python, R, Java, C#, Lua, Ruby, and TCL. These bindings enable scientists to develop image analysis workflows in the programming language they are most familiar with. The toolkit supports more than 15 different image file formats, provides over 280 image analysis filters, and implements a unified interface to the ITK intensity-based registration framework. you can check out official documentation from here . For the windows system, we can find the prebuilt library where we can simply download and install it. But for Linux os, we need to build by ourselves. Installation: Download SimpleItk:  Clone the SimpleITK from the github .  We can select the desired version from release and download

How to Install OpenCv in Linux for Java Application

Image
1. Introduction: In this blog post, we are going to install and set up OpenCV in ubuntu os for the java applications. OpenCV is a widely used great computer vision library. You can learn more about the OpenCV tutorial from  here . For documentation, you can follow  here . We will also cover some tutorials for Java bindings too.   2. Download OpenCV: You can download OpenCV from the public Github repository of OpenCV or from their official website from  here .  Select the desired version and click "Sources", which will download the zip file. Unzip the file. unzip opencv-4.3.0.zip   3. Build OpenCV: In order to build OpenCV, go to the OpenCV path in my case it's under "/opt/opencv-4.3.0" so I will use the same. Create a directory to build. mkdir build cd build Now, if you don't have installed cmake software please install it using the below command sudo apt-get install cmake Next, i