<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Md. Fahim Bin Amin</title>
    <description>The latest articles on DEV Community by Md. Fahim Bin Amin (@fahimfba).</description>
    <link>https://dev.to/fahimfba</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F609300%2F6774786e-8ae9-4b36-8988-413184ce193f.jpg</url>
      <title>DEV Community: Md. Fahim Bin Amin</title>
      <link>https://dev.to/fahimfba</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fahimfba"/>
    <language>en</language>
    <item>
      <title>[Boost]</title>
      <dc:creator>Md. Fahim Bin Amin</dc:creator>
      <pubDate>Sun, 05 Oct 2025 17:50:46 +0000</pubDate>
      <link>https://dev.to/fahimfba/-4i25</link>
      <guid>https://dev.to/fahimfba/-4i25</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/fahimfba" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F609300%2F6774786e-8ae9-4b36-8988-413184ce193f.jpg" alt="fahimfba"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/fahimfba/why-cloud-incident-response-is-critical-for-devops-and-it-teams-3foa" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Why Cloud Incident Response is Critical for DevOps and IT Teams&lt;/h2&gt;
      &lt;h3&gt;Md. Fahim Bin Amin ・ Oct 4&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#cloud&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#devops&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#cloudpractitioner&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>cloud</category>
      <category>devops</category>
      <category>cloudpractitioner</category>
    </item>
    <item>
      <title>Why Cloud Incident Response is Critical for DevOps and IT Teams</title>
      <dc:creator>Md. Fahim Bin Amin</dc:creator>
      <pubDate>Sat, 04 Oct 2025 07:36:22 +0000</pubDate>
      <link>https://dev.to/fahimfba/why-cloud-incident-response-is-critical-for-devops-and-it-teams-3foa</link>
      <guid>https://dev.to/fahimfba/why-cloud-incident-response-is-critical-for-devops-and-it-teams-3foa</guid>
      <description>&lt;p&gt;Recently major European airports including Heathrow, Brussels, and Berlin, experienced disruptions caused by a cyberattack on Collins Aerospace's cloud-based check-in system, resulting in flight delays and cancellations that affected thousands. This incident is not unique. In June 2025, Google Cloud faced a global outage impacting Gmail and Google Drive. Data breaches have exposed billions of credentials across major platforms, while ransomware and leaks challenged financial institutions and governments worldwide. (Source: Reuters, Bright Defense, Cyble)&lt;/p&gt;

&lt;p&gt;These events highlight how frequently cloud incidents occur and the critical need for effective cloud incident response. This article will explain the concept, outline the response process, and review essential tools and best practices to help organizations prepare and react swiftly to cloud security incidents.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Cloud Incident Response?
&lt;/h2&gt;

&lt;p&gt;Cloud Incident Response is a specific field of Cyber Security that includes detecting, containing and recovering from security incidents in cloud environments. It also involves a specific set of processes designed to help an organization identify potential threats, eliminate malicious activities, and recover from incidents in a structured, efficient, and timely manner.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Cloud Incident Response is Critical for DevOps and IT Teams
&lt;/h2&gt;

&lt;p&gt;This is a very crucial component for all DevOps and IT teams as it serves as a cornerstone for maintaining system reliability and minimizing downtime.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwbqd41ednbivccx05r1z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwbqd41ednbivccx05r1z.png" alt="Why Cloud Incident Response is Critical for DevOps and IT Teams" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A planned incident response system helps in the rapid detection, reporting and resolution of issues. It stops minor glitches from escalating into major failures.&lt;/li&gt;
&lt;li&gt;Timely and effective responses reduce financial losses and operational disruptions.&lt;/li&gt;
&lt;li&gt;Quick resolution of problems safeguards the service availability, and it strengthens the customer confidence in the organization's reliability and uptime.&lt;/li&gt;
&lt;li&gt;Cloud related incident response demands specialized expertise and tailored processes that address the shared responsibility and cloud native security policies. That is why it cannot be resolved easily by only following traditional approaches.&lt;/li&gt;
&lt;li&gt;Every new incident brings an opportunity to learn using post-incident reviews. It helps the team to uncover root causes, drive continuous improvements and enhance team practices.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If an organization has a good and well-structured incident management process, then it allows the team to respond swiftly and effectively.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Phases of Cloud Incident Response Process
&lt;/h2&gt;

&lt;p&gt;Although there are no specific key phases in the cloud incident response process, we often divide it into distinct steps.&lt;/p&gt;

&lt;h3&gt;
  
  
  Detection and Alerting
&lt;/h3&gt;

&lt;p&gt;The first step in incident response is recognizing that a problem exists. This is usually done through some monitoring tools, analyzing logs or automated alerts triggered by unusual changes in performance, security or availability.&lt;/p&gt;

&lt;h3&gt;
  
  
  Triage and Classification
&lt;/h3&gt;

&lt;p&gt;Once an incident is detected, it must be evaluated to understand its severity and impact. This involves categorizing the incident and prioritizing it by urgency and business risk.&lt;/p&gt;

&lt;h3&gt;
  
  
  Containment and Mitigation
&lt;/h3&gt;

&lt;p&gt;The next part of it is ensuring that further damage stops immediately. Containment actions may include isolating affected systems, revoking compromised credentials or rolling back potential problematic deployments in production. The goal is to prevent the incident from spreading and buy time for a permanent solution.&lt;/p&gt;

&lt;h3&gt;
  
  
  Recovery and Service Restoration
&lt;/h3&gt;

&lt;p&gt;Once an incident is contained, teams work to restore the normal service. This may involve redeploying services, scaling backup systems or applying configuration fixes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Postmortem and Continuous Improvement
&lt;/h3&gt;

&lt;p&gt;After resolution of the incidents, the teams need to hold a postmortem to analyze the root causes, evaluate how well the response actually worked and identify potential improvements in the future. Also, learning from past incidents builds greater resilience against future problems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cloud Incident Response Best Practices
&lt;/h2&gt;

&lt;p&gt;Here are some best practices for cloud incident response:&lt;/p&gt;

&lt;h3&gt;
  
  
  Define Clear Roles and Responsibilities
&lt;/h3&gt;

&lt;p&gt;During an incident, instead of proper resolution, if the team spends time arguing over who is responsible for what, it can delay the entire recovery process, and the impact worsens. Clearly assigning roles ensures a well-organized and coordinated approach.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use Infrastructure as Code (IaC) for Faster Recovery
&lt;/h3&gt;

&lt;p&gt;IaC tools like Terraform, CloudFormation, or Pulumi allow teams to quickly and reliably rebuild and restore cloud environments using version-controlled templates. This reduces human-made errors and accelerates recovery after a failure or security incident.&lt;/p&gt;

&lt;h3&gt;
  
  
  Implement Automated Alerting and Escalation Policies
&lt;/h3&gt;

&lt;p&gt;Manual monitoring is not sufficient at all in a dynamic cloud environment. Therefore, automated alerts help to detect issues in real time, and escalation policies ensure that the right team members are notified promptly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conduct Regular Runbooks and Chaos Drills
&lt;/h3&gt;

&lt;p&gt;Runbooks offer clear and step-by-step instructions for common incidents, reducing uncertainty and stress under pressure. Chaos drills (which involve intentionally injecting faults or failures into a system to test its ability to withstand unexpected problems) and game days (planned simulations where both systems and teams are tested through realistic failure scenarios) actively simulate failures to test both system robustness and team readiness, helping to identify weaknesses and improve overall preparedness.&lt;/p&gt;

&lt;h3&gt;
  
  
  Integrate with Monitoring, Logging and IAM
&lt;/h3&gt;

&lt;p&gt;Effective incident response depends on comprehensive visibility. Integration with monitoring and logging tools provides the data necessary to quickly identify root causes. Strong identity and access management practices ensure responders have appropriate access while protecting sensitive systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tools to Support Effective Cloud Incident Response
&lt;/h2&gt;

&lt;p&gt;If you want to respond well to cloud problems, then that means that you have to ensure the availability of the right tools to detect, understand, and fix the issues quickly. Here are some notable tools people use.&lt;/p&gt;

&lt;h3&gt;
  
  
  Monitoring and Observability
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Tools like &lt;a href="https://www.datadoghq.com/" rel="noopener noreferrer"&gt;Datadog&lt;/a&gt;, &lt;a href="https://prometheus.io/" rel="noopener noreferrer"&gt;Prometheus&lt;/a&gt;, and &lt;a href="https://grafana.com/" rel="noopener noreferrer"&gt;Grafana&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Show live data, spot unusual behaviour and provide easy-to-read dashboards.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Logging and Tracing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Services such as &lt;a href="https://www.elastic.co/elastic-stack" rel="noopener noreferrer"&gt;ELK Stack&lt;/a&gt;, &lt;a href="https://www.splunk.com/" rel="noopener noreferrer"&gt;Splunk&lt;/a&gt;, and &lt;a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/WhatIsCloudWatchLogs.html" rel="noopener noreferrer"&gt;AWS CloudWatch Logs&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Record detailed event information.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Alerting and On-Call Management
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Platforms like &lt;a href="https://taskcallapp.com/" rel="noopener noreferrer"&gt;TaskCall&lt;/a&gt; and &lt;a href="https://www.pagerduty.com/" rel="noopener noreferrer"&gt;PagerDuty&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Send alerts to the right people immediately.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Infrastructure as Code (IaC)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Tools like &lt;a href="https://developer.hashicorp.com/terraform" rel="noopener noreferrer"&gt;Terraform&lt;/a&gt;, &lt;a href="https://www.pulumi.com/" rel="noopener noreferrer"&gt;Pulumi&lt;/a&gt;, and &lt;a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html" rel="noopener noreferrer"&gt;CloudFormation&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Help rebuild or update cloud resources fast.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Security and Identity
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Utilize Identity &lt;a href="https://aws.amazon.com/iam/" rel="noopener noreferrer"&gt;Access Management (IAM)&lt;/a&gt;, Secret Managers, and vulnerability scanners.&lt;/li&gt;
&lt;li&gt;Protect systems from unauthorized access and weak settings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When these tools work together smoothly, teams can respond more quickly and with greater confidence when cloud incidents occur.&lt;/p&gt;

&lt;h2&gt;
  
  
  How We Built Our Cloud Incident Response Process
&lt;/h2&gt;

&lt;p&gt;Over the next few days I tested some other platforms, but none of them seemed to hit every box in our checklist. Some were missing heartbeats, some status pages or just did not offer enough in conditional routing and workflows. So, I started researching more until I came across &lt;a href="https://taskcallapp.com/" rel="noopener noreferrer"&gt;TaskCall&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F83r4cvcu6m8ii9z95v4e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F83r4cvcu6m8ii9z95v4e.png" alt="TaskCall" width="800" height="374"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;TaskCall had a different layout as well, but the structure of the platform actually allowed us to do more than we were able to with OpsGenie. We managed to deploy a full proof cloud incident response mechanism. Here is a quick summary of the flow we created:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We integrated with all our cloud monitoring services. We were using AWS CloudWatch and Datadog, both of which had built-in integrations with TaskCall. So, the set up was quite quick.&lt;/li&gt;
&lt;li&gt;As alerts were generated, incidents were automatically created in TaskCall.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F00qc7bk37aetzi5jlhk2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F00qc7bk37aetzi5jlhk2.png" alt="Incident Management on TaskCall" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We used conditional routing to suppress false positives. This helped reduce noise and unnecessary interruptions.&lt;/li&gt;
&lt;li&gt;TaskCall allowed us to automate validation checks and auto resolve incidents conditioned on their outcome through automated workflows. This was quite impressive as it meant that we could now reduce interruptions even further and only focus on incidents that mattered.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmq48o6senlc7oedjc7lb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmq48o6senlc7oedjc7lb.png" alt="TaskCall workflow" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the incident still remained open, then the on-call management configurations we set up with auto escalation would apply and the team responsible for the issue would be alerted.&lt;/li&gt;
&lt;li&gt;While the team got assembled, TaskCall was also able to automatically identify impact on our upstream and downstream dependencies, making it easier for us to identify the root cause.&lt;/li&gt;
&lt;li&gt;While all this was happening, it also automatically posted on our status pages (which were again hosted on TaskCall) so our stakeholders stayed updated, reducing the load on our customer support teams.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The workflow we were able to set up with TaskCall is a good example of cloud incident response for sophisticated teams. We built a workflow that utilized automation to identify issues where possible, minimize the time we spend on incidents and streamline communication across the board so we were not interrupted redundantly.&lt;/p&gt;

&lt;p&gt;Cloud environments provide flexibility, scalability, and speed but also introduce new challenges and risks. Quick, effective incident response is essential to keep operations smooth and maintain customer trust. By following best practices, using proper tools, and embracing automation, DevOps and IT teams can resolve cloud issues faster and with greater confidence.&lt;/p&gt;

&lt;p&gt;Thanks for reading. I hope this helps you to understand cloud incident response and how platforms reduce the hassle.&lt;/p&gt;

</description>
      <category>cloud</category>
      <category>devops</category>
      <category>cloudpractitioner</category>
    </item>
    <item>
      <title>How to Make Images GHIBLIFIED!</title>
      <dc:creator>Md. Fahim Bin Amin</dc:creator>
      <pubDate>Fri, 28 Mar 2025 17:05:13 +0000</pubDate>
      <link>https://dev.to/fahimfba/how-to-make-images-ghiblified-4l2i</link>
      <guid>https://dev.to/fahimfba/how-to-make-images-ghiblified-4l2i</guid>
      <description>&lt;p&gt;Currently, Ghibli-type images are trending worldwide. Under the hood, they are nothing but a kind of image transformation, which you can think of as filters or any typical image transformation.&lt;/p&gt;

&lt;p&gt;The main difference between regular filters and this is that it is done using AI explicitly. It also adds that special Studio Ghibli type nostalgic feeling around the image.&lt;/p&gt;

&lt;p&gt;It is not that much earlier, the hype has escalated rapidly after this feature got released a few hours ago (by the time I am writing this article). People are going crazy finding the website or applications by using which they can transform their existing images into Studio Ghibli-style images.&lt;/p&gt;

&lt;p&gt;Two of the most popular sources for doing that are &lt;a href="https://chat.openai.com/" rel="noopener noreferrer"&gt;ChatGPT&lt;/a&gt; and &lt;a href="https://grok.com/" rel="noopener noreferrer"&gt;Grok&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;However, today, I am going with Grok as I found that more feasible in terms of free usage right now. &lt;/p&gt;

&lt;p&gt;If you are comfortable with watching a step-by-step video tutorial, then you can directly watch the following video I created for you.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/Lut81-jnc68"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The usage criteria are very simple. If you do not have an account yet, you just need to create one on &lt;a href="https://x.com/home" rel="noopener noreferrer"&gt;Twitter/X&lt;/a&gt;. After signing into your Twitter/X account, you will instantly have access to Grok. You can also create an additional account to use explicitly on &lt;a href="https://grok.com/" rel="noopener noreferrer"&gt;https://grok.com/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F747hg0i5og8h9fglhagz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F747hg0i5og8h9fglhagz.png" alt="Grok Interface"&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now, attach an image that you want to convert to a Studio Ghibli-style image. In the chatbox, simply write a prompt. For example, you could use the prompt &lt;code&gt;Create a Ghibli-style image using this image&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;After that, you have to give it some time as image generation is a very computationally heavy task on GPUs.&lt;/p&gt;

&lt;p&gt;Usually, it provides two new images side by side. After the generation is successful, you can download the images!&lt;/p&gt;

&lt;p&gt;That's it for today! I would recommend that you do not exploit this AI feature by doing illegal stuff. 😀&lt;/p&gt;

</description>
      <category>ai</category>
      <category>unsplash</category>
    </item>
    <item>
      <title>How to Unsave All Saved Posts on Facebook in a Few Simple Steps</title>
      <dc:creator>Md. Fahim Bin Amin</dc:creator>
      <pubDate>Wed, 30 Oct 2024 15:27:58 +0000</pubDate>
      <link>https://dev.to/fahimfba/how-to-unsave-all-saved-posts-on-facebook-in-a-few-simple-steps-24ip</link>
      <guid>https://dev.to/fahimfba/how-to-unsave-all-saved-posts-on-facebook-in-a-few-simple-steps-24ip</guid>
      <description>&lt;p&gt;If you're an avid Facebook user, you've probably saved countless posts, videos, and links to revisit later. But sometimes, these saved posts accumulate and become overwhelming. You may decide to unsave them all at once rather than manually unchecking each one, especially if you've amassed a large collection. Here's a step-by-step guide to bulk unsaving all your saved items on Facebook.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Warning&lt;/strong&gt;:
&lt;/h4&gt;

&lt;p&gt;Before proceeding, note that this method will unsave all the displayed items on the page permanently. Once unsaved, the items will no longer appear in your saved list. There’s no way to retrieve them unless you manually save each post again. Please use this method with caution.&lt;/p&gt;

&lt;p&gt;Also, You might need to use &lt;code&gt;allow pasting&lt;/code&gt; and hit the Enter key if Facebook warns you before applying any JavaScript commands in the console.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step-by-Step Guide
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 1: Scroll Through Your Saved Items&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Head over to your Facebook saved items section. This can be accessed by clicking the saved section on the left-hand side of the homepage on the desktop version.&lt;/li&gt;
&lt;li&gt;Scroll down to load and display all the saved items that you want to unsave. Facebook only loads a few items at a time as you scroll, so ensure you've loaded everything you wish to unsave.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 2: Open the Developer Console&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;To start the bulk unsaving process, you’ll need to use your browser’s developer console. Here’s how to do that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On &lt;strong&gt;Google Chrome&lt;/strong&gt;: Press &lt;code&gt;Ctrl + Shift + J&lt;/code&gt; (Windows) or &lt;code&gt;Cmd + Option + J&lt;/code&gt; (Mac) to open the console.&lt;/li&gt;
&lt;li&gt;On &lt;strong&gt;Firefox&lt;/strong&gt;: Press &lt;code&gt;Ctrl + Shift + K&lt;/code&gt; (Windows) or &lt;code&gt;Cmd + Option + K&lt;/code&gt; (Mac).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once the console is open, you can start running the necessary JavaScript commands.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 3: Open the Context Menu for Each Item&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;You’ll first need to open the contextual menu (the three dots beside each saved post) for every item on the page. This is where Facebook allows you to unsave individual posts.&lt;/p&gt;

&lt;p&gt;Copy and paste the following command into the console and press &lt;strong&gt;Enter&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;[role=main]&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;[aria-label="More"]&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command finds all the “More” buttons on the page and opens the contextual menu for each saved item.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 4: Unsave Each Item&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Once the contextual menus have been opened for each saved post, it’s time to bulk unsave them. For that, run the following command in the console:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;[role=menuitem]&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command clicks on the "Unsave" option in every contextual menu that has been opened, removing the items from your saved list.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Important Reminder:&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;All the items that are displayed on the page will be unsaved &lt;strong&gt;permanently&lt;/strong&gt;. Ensure that you’ve reviewed the items before proceeding with this method.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Final Thoughts&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This method saves you the hassle of manually unsaving items one by one. Just remember to scroll through and load all the saved items before running the script to ensure nothing is left behind. Also, since this method affects only the currently displayed items, you may need to scroll and repeat the process if you have a lot of saved posts.&lt;/p&gt;

&lt;p&gt;By following these steps, you can easily declutter your Facebook saved items and keep only what truly matters!&lt;/p&gt;

&lt;p&gt;You can follow me on &lt;a href="https://github.com/FahimFBA" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;, &lt;a href="https://www.linkedin.com/in/fahimfba/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;, &lt;a href="https://youtube.com/@FahimAmin" rel="noopener noreferrer"&gt;YouTube&lt;/a&gt; for getting more content like this. Also, my &lt;a href="https://www.fahimbinamin.com/" rel="noopener noreferrer"&gt;website&lt;/a&gt; is always available for you!&lt;/p&gt;

&lt;p&gt;Cover: Photo by &lt;a href="https://unsplash.com/@nghiaagent?utm_content=creditCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=unsplash" rel="noopener noreferrer"&gt;Nghia Nguyen&lt;/a&gt; on &lt;a href="https://unsplash.com/photos/person-using-laptop-browsing-facebook-application-b8NuypQvpis?utm_content=creditCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=unsplash" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>Highlight Specific Segment Block as Notice, Tip, Caution, Important &amp; Warning in Markdown</title>
      <dc:creator>Md. Fahim Bin Amin</dc:creator>
      <pubDate>Sun, 09 Jun 2024 12:01:14 +0000</pubDate>
      <link>https://dev.to/fahimfba/highlight-specific-segment-block-as-notice-tip-caution-important-warning-in-markdown-2ne8</link>
      <guid>https://dev.to/fahimfba/highlight-specific-segment-block-as-notice-tip-caution-important-warning-in-markdown-2ne8</guid>
      <description>&lt;p&gt;Markdown is a very popular scripting language. It is used starting from writing documentation to even creating a complete website. Therefore, almost all of us frequently use this scripting language every once in a while.&lt;/p&gt;

&lt;p&gt;However, there are some limitations to this language as well. In some cases, we can not add that much styling or modification to the writing in it. Luckily for us, there are 5 highlighting features for specific segment blocks as Notice, Tip, Caution, Important, and Warning. It is also applicable in GitHub MarkDown as well. In this article, I am going to talk about it in detail.&lt;/p&gt;

&lt;h2&gt;
  
  
  Video Walkthrough
&lt;/h2&gt;

&lt;p&gt;If you like to watch a complete video with step-by-step guidelines, then you can watch the video right now!&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/HMeCXobi90E"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  "Note" Specific Block
&lt;/h2&gt;

&lt;p&gt;If you want to highlight information that users should take into account, even when skimming, then it is appropriate for you!&lt;/p&gt;

&lt;h3&gt;
  
  
  Syntax
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; [!NOTE]
&amp;gt; I want the readers to read it carefully as it contains many important docs.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw65y73enhazebw10u072.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw65y73enhazebw10u072.png" alt="Note" width="800" height="136"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You see that the preview already has a nice "Note" related symbol also!&lt;/p&gt;

&lt;p&gt;If you want to write any Note related segment, then you need to start it with an angle bracket ( &lt;code&gt;&amp;gt;&lt;/code&gt; ), and then you need to specify the highlighting block as Note with &lt;code&gt;[!NOTE]&lt;/code&gt;.&lt;br&gt;
After that, you need to add an angle bracket ( &lt;code&gt;&amp;gt;&lt;/code&gt; ) in each new line that you want to include in your specific "Note" block.&lt;/p&gt;

&lt;p&gt;If you want to close the Note block, then simply remove the additional angle bracket in the new line. That's all!&lt;/p&gt;

&lt;h2&gt;
  
  
  "Tip" Specific Block
&lt;/h2&gt;

&lt;p&gt;If you want to provide optional information to help a user to be more successful, then it is appropriate in those scenarios.&lt;/p&gt;

&lt;h3&gt;
  
  
  Syntax
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; [!TIP]
&amp;gt; Use the command line to detect and resolve the errors!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqlqn5yxlo288q65ihjm7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqlqn5yxlo288q65ihjm7.png" alt="TIP" width="800" height="142"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You see that the preview already has a nice "Tip" related symbol also!&lt;/p&gt;

&lt;p&gt;If you want to write any Tip related segment, then you need to start it with an angle bracket ( &lt;code&gt;&amp;gt;&lt;/code&gt; ), and then you need to specify the highlighting block as Tip with &lt;code&gt;[!TIP]&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;After that, you need to add an angle bracket ( &lt;code&gt;&amp;gt;&lt;/code&gt; ) in each new line that you want to include in your specific "Tip" block.&lt;/p&gt;

&lt;p&gt;If you want to close the Tip block, then simply remove the additional angle bracket in the new line. That's all!&lt;/p&gt;

&lt;h2&gt;
  
  
  "Warning" Specific Block
&lt;/h2&gt;

&lt;p&gt;If you want to provide critical content demanding immediate user attention due to potential risks, then it is an appropriate block for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Syntax
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; [!WARNING]
&amp;gt; DON'T DELETE THE `package.json` file!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp0rc4htki4r2ldly18d4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp0rc4htki4r2ldly18d4.png" alt="WARNING" width="800" height="114"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You see that the preview already has a nice "Warning" related symbol also!&lt;/p&gt;

&lt;p&gt;If you want to write any Warning related segment, then you need to start it with an angle bracket ( &lt;code&gt;&amp;gt;&lt;/code&gt; ), and then you need to specify the highlighting block as Warning with &lt;code&gt;[!WARNING]&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;After that you need to add an angle bracket ( &lt;code&gt;&amp;gt;&lt;/code&gt; ) in each new line that you want to include in your specific "Warning" block.&lt;/p&gt;

&lt;p&gt;If you want to close the Warning block, then simply remove the additional angle bracket in the new line. That's all!&lt;/p&gt;

&lt;h2&gt;
  
  
  "Caution" Specific Block
&lt;/h2&gt;

&lt;p&gt;If you want to provide negative potential consequences of an action, then you can use this.&lt;/p&gt;

&lt;h3&gt;
  
  
  Syntax
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; [!CAUTION]
&amp;gt; Don't execute the code without commenting on the test cases.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4vsz2rgc2zgbwlqighsk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4vsz2rgc2zgbwlqighsk.png" alt="CAUTION" width="800" height="133"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You see that the preview already has a nice "Caution" related symbol also!&lt;/p&gt;

&lt;p&gt;If you want to write any Caution related segment, then you need to start it with an angle bracket ( &lt;code&gt;&amp;gt;&lt;/code&gt; ), and then you need to specify the highlighting block as Warning with &lt;code&gt;[!CAUTION]&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;After that you need to add an angle bracket ( &lt;code&gt;&amp;gt;&lt;/code&gt; ) in each new line that you want to include in your specific "Caution" block.&lt;/p&gt;

&lt;p&gt;If you want to close the Caution block, then simply remove the additional angle bracket in the new line. That's all!&lt;/p&gt;

&lt;h2&gt;
  
  
  "Important" Specific Block
&lt;/h2&gt;

&lt;p&gt;If you want to provide crucial information necessary for users to succeed, then you can use this.&lt;/p&gt;

&lt;h3&gt;
  
  
  Syntax
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; [!IMPORTANT]  
&amp;gt; Read the contribution guideline before adding a pull request.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feot0a0frrowhlxlndhej.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feot0a0frrowhlxlndhej.png" alt="IMPORTANT" width="800" height="141"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You see that the preview already has a nice "Important" related symbol also!&lt;/p&gt;

&lt;p&gt;If you want to write any Important related segment, then you need to start it with an angle bracket ( &lt;code&gt;&amp;gt;&lt;/code&gt; ), and then you need to specify the highlighting block as Warning with &lt;code&gt;[!IMPORTANT]&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;After that you need to add an angle bracket ( &lt;code&gt;&amp;gt;&lt;/code&gt; ) in each new line that you want to include in your specific "Important" block.&lt;/p&gt;

&lt;p&gt;If you want to close the Important block, then simply remove the additional angle bracket in the new line. That's all!&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Thank you for reading the entire article. I hope you have learned something new here.&lt;br&gt;
If you have enjoyed the procedures step-by-step, then don't forget to let me know on &lt;a href="https://twitter.com/Fahim_FBA" rel="noopener noreferrer"&gt;Twitter/X&lt;/a&gt; or &lt;a href="https://www.linkedin.com/in/fahimfba/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;. I would appreciate it if you could endorse me for some relevant skillsets on LinkedIn. I would also recommend you to subscribe to my &lt;a href="https://youtube.com/@FahimAmin" rel="noopener noreferrer"&gt;YouTube channel&lt;/a&gt; for regular programming related content.&lt;br&gt;
You can follow me on &lt;a href="https://github.com/FahimFBA" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; as well if you are interested in open source. Make sure to check my &lt;a href="https://fahimbinamin.com/" rel="noopener noreferrer"&gt;website&lt;/a&gt; (&lt;a href="https://fahimbinamin.com/" rel="noopener noreferrer"&gt;https://fahimbinamin.com/&lt;/a&gt;) as well.&lt;br&gt;
Thank you so much! 😀&lt;/p&gt;

</description>
      <category>markdown</category>
      <category>github</category>
    </item>
    <item>
      <title>Default Parameter Value in JavaScript Functions</title>
      <dc:creator>Md. Fahim Bin Amin</dc:creator>
      <pubDate>Tue, 21 May 2024 14:46:44 +0000</pubDate>
      <link>https://dev.to/fahimfba/default-parameter-value-in-javascript-functions-3f1p</link>
      <guid>https://dev.to/fahimfba/default-parameter-value-in-javascript-functions-3f1p</guid>
      <description>&lt;p&gt;In JavaScript, we can define default values in the function's parameter to safeguard it from returning NaN.&lt;/p&gt;

&lt;p&gt;Let me give you an example of this,&lt;/p&gt;

&lt;p&gt;Let's say, we are using a function called &lt;code&gt;sum&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;sum&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This function simply receives two values as arguments and returns their summation value.&lt;/p&gt;

&lt;p&gt;Therefore, we get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// returns 5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd4dohkazno7ncfdsysx1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd4dohkazno7ncfdsysx1.png" alt="sum function" width="797" height="325"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, for some reason, if the user does not provide the value of any parameter as an argument, then it becomes &lt;strong&gt;NaN&lt;/strong&gt; as the default value of all the parameters is &lt;strong&gt;Undefined&lt;/strong&gt; in JavaScript.&lt;/p&gt;

&lt;p&gt;Therefore, the following scenario can happen:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fixnssj8xebg9v6gz3flm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fixnssj8xebg9v6gz3flm.png" alt="NaN" width="663" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, as we didn't provide the value for the second parameter in the argument, it takes the default value for variable &lt;code&gt;b&lt;/code&gt; as &lt;code&gt;Undefined&lt;/code&gt;. Therefore, &lt;code&gt;5&lt;/code&gt; &lt;code&gt;+&lt;/code&gt; &lt;code&gt;Undefined&lt;/code&gt; returns &lt;code&gt;NaN&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;However, let's say, we provide a default parameter value for the second variable for now (&lt;code&gt;b&lt;/code&gt;) to ZERO (b = 0), then we get the following output for the same input:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;sum&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;sum &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8wzi5jke95iezkrngq14.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8wzi5jke95iezkrngq14.png" alt="With default parameter value" width="800" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, you see that we have explicitly specified the initial (default) parameter value for the variable &lt;code&gt;b&lt;/code&gt; as &lt;code&gt;0&lt;/code&gt;. Therefore, if we do not pass any value during function calls, the default argument value for variable &lt;code&gt;b&lt;/code&gt; becomes 0. &lt;/p&gt;

&lt;p&gt;As &lt;code&gt;5&lt;/code&gt; &lt;code&gt;+&lt;/code&gt; &lt;code&gt;0&lt;/code&gt; = &lt;code&gt;5&lt;/code&gt;, we get &lt;code&gt;5&lt;/code&gt; as the output. &lt;/p&gt;

&lt;p&gt;However, this does not change anything crucial other than safeguarding the function. &lt;/p&gt;

&lt;p&gt;If we call the function with all the values in it via arguments, it works flawlessly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;sum&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;sum &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpqit0wv685tag0owt8ne.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpqit0wv685tag0owt8ne.png" alt="all argument values with default parameter value" width="774" height="391"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, although the initial (default) value for the second variable was zero (&lt;code&gt;0&lt;/code&gt;), the updated value was &lt;code&gt;10&lt;/code&gt; which was passed during the function call as argument value. The updated value overwrites the initial/default value. Therefore, all the calculation works seamlessly.&lt;/p&gt;

&lt;p&gt;Sometimes, we like to provide default values in all the function parameters if we want to avoid these &lt;code&gt;Undefined&lt;/code&gt; type calculations in the output.&lt;/p&gt;

&lt;p&gt;I hope you have learned something new today! Thank you for reading. 😊&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Remove Unnecessary Warnings in Tensorflow GPU</title>
      <dc:creator>Md. Fahim Bin Amin</dc:creator>
      <pubDate>Tue, 09 Apr 2024 09:07:32 +0000</pubDate>
      <link>https://dev.to/fahimfba/remove-unnecessary-warnings-in-tensorflow-gpu-39am</link>
      <guid>https://dev.to/fahimfba/remove-unnecessary-warnings-in-tensorflow-gpu-39am</guid>
      <description>&lt;p&gt;If you don't want unnecessary warning messages to distract you when using Tensorflow GPU, simply use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;TF_CPP_MIN_LOG_LEVEL&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;2&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F64ot8ehcqfg7642iebum.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F64ot8ehcqfg7642iebum.png" alt=" " width="800" height="513"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It won't show you the unnecessary warnings anymore like code block 1.&lt;/p&gt;

</description>
      <category>tensorflow</category>
      <category>notebook</category>
      <category>jupyter</category>
    </item>
    <item>
      <title>Skull Stripping 3D MRI Brain Image</title>
      <dc:creator>Md. Fahim Bin Amin</dc:creator>
      <pubDate>Tue, 30 Jan 2024 11:25:11 +0000</pubDate>
      <link>https://dev.to/fahimfba/skull-stripping-3d-mri-brain-image-5e03</link>
      <guid>https://dev.to/fahimfba/skull-stripping-3d-mri-brain-image-5e03</guid>
      <description>&lt;h2&gt;
  
  
  What is Skull Stripping?
&lt;/h2&gt;

&lt;p&gt;Skull stripping, also known as brain extraction, is a preprocessing step that removes the skull and other non-brain tissues from MRI scans. It's a crucial step in the analysis of many MRI neurological images, such as tissue classification and image registration.&lt;/p&gt;

&lt;p&gt;Skull stripping is a key area of study in brain image processing applications. It's a preliminary step in many medical applications, as it increases the speed and accuracy of diagnosis.&lt;/p&gt;

&lt;p&gt;Skull stripping involves segmenting brain tissue (cortex and cerebellum) from the surrounding region (skull and nonbrain area). It's a preprocessing step for the cortical surface reconstruction process. This procedure takes an intensity-normalized image and deforms a tessellated ellipsoidal template into the shape of the inner surface of the skull.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are we going to do exactly with the 3D MRI Brain images?
&lt;/h2&gt;

&lt;p&gt;I was researching on the early detection of the Alzheimer's Disease. Therefore, I was working on the 3D MRI images of the human brain. Therefore, let's say, I have the raw 3D MRI brain image like below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyqyl77jwrbff074y9i93.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyqyl77jwrbff074y9i93.png" alt="Raw 3D Brain MRI image from ADNI" width="800" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The output would be like below.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I want to get the brain mask that has been applied in the skull stripping process on my raw 3D image.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr5d6lyhny0ef2gs6aai8.png" alt="Applied brain mask on the raw 3D brain MRI image" width="800" height="450"&gt;
&lt;/li&gt;
&lt;li&gt;I want the preprocessed skull-stripped image that only has the brain portion excluding any non-brain tissues.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fljc8jslbzzdg5abd26pa.png" alt="Skull Stripped 3D Brain MRI image after the preprocessing" width="800" height="450"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Why Skull Stripping is a necessary thing in human brain-related research?
&lt;/h2&gt;

&lt;p&gt;Skull stripping, also known as brain extraction or skull-stripped segmentation, is a necessary step in human brain-related research for several reasons:&lt;/p&gt;

&lt;p&gt;Isolation of Brain Tissue: The skull contains bones and other tissues that are not relevant to many types of brain analysis, such as MRI or fMRI studies. Removing the skull allows researchers to focus specifically on the brain tissue itself, which is the primary object of study in neuroimaging research.&lt;/p&gt;

&lt;p&gt;Improved Accuracy: Skull stripping improves the accuracy of brain imaging analysis by removing non-brain tissues that can interfere with the interpretation of results. This interference can occur due to artifacts or inaccuracies introduced by including non-brain tissues in the analysis.&lt;/p&gt;

&lt;p&gt;Reduced Computational Load: Including the skull in the analysis increases the computational load required for processing brain images. By removing the skull, researchers can streamline the analysis process, making it more efficient and reducing computational resources.&lt;/p&gt;

&lt;p&gt;Enhanced Visualization: Skull stripping improves the visualization of brain structures in neuroimaging data. It allows for clearer and more precise rendering of brain images, which is essential for accurately identifying and studying various brain regions and structures.&lt;/p&gt;

&lt;p&gt;Standardization: Skull stripping helps standardize neuroimaging data processing pipelines across different studies and research groups. By employing consistent skull stripping techniques, researchers can ensure comparability and reproducibility of results, facilitating collaboration and meta-analyses in the field.&lt;/p&gt;

&lt;p&gt;Overall, skull stripping is a critical preprocessing step in human brain-related research, enabling more accurate analysis, improved visualization, and enhanced comparability of neuroimaging data.&lt;/p&gt;

&lt;h2&gt;
  
  
  How can Skull Stripping be performed using Python?
&lt;/h2&gt;

&lt;p&gt;There are many ways to apply skull stripping to 3D MRI images. There are also a lot of Python modules that help us to do that.&lt;/p&gt;

&lt;p&gt;However, in this article, I am going to use a very simple code to apply the skull stripping on a basic level using ANTsPy.&lt;/p&gt;

&lt;p&gt;For this, we are going to use a helper file that would help us scale up our process.&lt;/p&gt;

&lt;p&gt;Let me give it a name, helpers.py.&lt;/p&gt;

&lt;h3&gt;
  
  
  Helpers
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;plt&lt;/span&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;ipywidgets&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;interact&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;SimpleITK&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;sitk&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;cv2&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;explore_3D_array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ndarray&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cmap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;gray&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
  Given a 3D array with shape (Z,X,Y) This function will create an interactive
  widget to check out all the 2D arrays with shape (X,Y) inside the 3D array. 
  The purpose of this function to visual inspect the 2D arrays in the image. 

  Args:
    arr : 3D array with shape (Z,X,Y) that represents the volume of a MRI image
    cmap : Which color map use to plot the slices in matplotlib.pyplot
  &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SLICE&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;figure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;figsize&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;imshow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;SLICE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;:,&lt;/span&gt; &lt;span class="p"&gt;:],&lt;/span&gt; &lt;span class="n"&gt;cmap&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;cmap&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="nf"&gt;interact&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SLICE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;explore_3D_array_comparison&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr_before&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ndarray&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;arr_after&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ndarray&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cmap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;gray&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
  Given two 3D arrays with shape (Z,X,Y) This function will create an interactive
  widget to check out all the 2D arrays with shape (X,Y) inside the 3D arrays.
  The purpose of this function to visual compare the 2D arrays after some transformation. 

  Args:
    arr_before : 3D array with shape (Z,X,Y) that represents the volume of a MRI image, before any transform
    arr_after : 3D array with shape (Z,X,Y) that represents the volume of a MRI image, after some transform    
    cmap : Which color map use to plot the slices in matplotlib.pyplot
  &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;

  &lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="n"&gt;arr_after&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;arr_before&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SLICE&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;fig&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ax1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ax2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subplots&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sharex&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;col&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sharey&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;row&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;figsize&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

    &lt;span class="n"&gt;ax1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set_title&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Before&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fontsize&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;ax1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;imshow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr_before&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;SLICE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;:,&lt;/span&gt; &lt;span class="p"&gt;:],&lt;/span&gt; &lt;span class="n"&gt;cmap&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;cmap&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;ax2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set_title&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;After&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fontsize&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;ax2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;imshow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr_after&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;SLICE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;:,&lt;/span&gt; &lt;span class="p"&gt;:],&lt;/span&gt; &lt;span class="n"&gt;cmap&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;cmap&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tight_layout&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

  &lt;span class="nf"&gt;interact&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SLICE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;arr_before&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;show_sitk_img_info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;img&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;sitk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
  Given a sitk.Image instance prints the information about the MRI image contained.

  Args:
    img : instance of the sitk.Image to check out
  &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
  &lt;span class="n"&gt;pixel_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;img&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;GetPixelIDTypeAsString&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="n"&gt;origin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;img&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;GetOrigin&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="n"&gt;dimensions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;img&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;GetSize&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="n"&gt;spacing&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;img&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;GetSpacing&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="n"&gt;direction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;img&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;GetDirection&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

  &lt;span class="n"&gt;info&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Pixel Type&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;pixel_type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Dimensions&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;dimensions&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Spacing&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;spacing&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Origin&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;origin&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Direction&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;direction&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;info&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; : &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add_suffix_to_filename&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;suffix&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
  Takes a NIfTI filename and appends a suffix.

  Args:
      filename : NIfTI filename
      suffix : suffix to append

  Returns:
      str : filename after append the suffix
  &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;endswith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;.nii&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
      &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;.nii&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;_&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;suffix&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;.nii&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;
  &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;endswith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;.nii.gz&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
      &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;.nii.gz&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;_&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;suffix&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;.nii.gz&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;
  &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;RuntimeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;filename with unknown extension&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;rescale_linear&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;array&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ndarray&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;new_min&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;new_max&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Rescale an array linearly.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
  &lt;span class="n"&gt;minimum&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;maximum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;array&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;array&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;new_max&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;new_min&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;maximum&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;minimum&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;new_min&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;minimum&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;array&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;explore_3D_array_with_mask_contour&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ndarray&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mask&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ndarray&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;thickness&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
  Given a 3D array with shape (Z,X,Y) This function will create an interactive
  widget to check out all the 2D arrays with shape (X,Y) inside the 3D array. The binary
  mask provided will be used to overlay contours of the region of interest over the 
  array. The purpose of this function is to visual inspect the region delimited by the mask.

  Args:
    arr : 3D array with shape (Z,X,Y) that represents the volume of a MRI image
    mask : binary mask to obtain the region of interest
  &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
  &lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;mask&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;

  &lt;span class="n"&gt;_arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;rescale_linear&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;_mask&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;rescale_linear&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;_mask&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_mask&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;astype&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;uint8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SLICE&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;arr_rgb&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cv2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cvtColor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;SLICE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;:,&lt;/span&gt; &lt;span class="p"&gt;:],&lt;/span&gt; &lt;span class="n"&gt;cv2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;COLOR_GRAY2RGB&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;contours&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cv2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findContours&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_mask&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;SLICE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;:,&lt;/span&gt; &lt;span class="p"&gt;:],&lt;/span&gt; &lt;span class="n"&gt;cv2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RETR_TREE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cv2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CHAIN_APPROX_SIMPLE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;arr_with_contours&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cv2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;drawContours&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr_rgb&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;contours&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;thickness&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;figure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;figsize&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;imshow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr_with_contours&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="nf"&gt;interact&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SLICE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Additional required modules and libraries
&lt;/h3&gt;

&lt;p&gt;We also need some modules and Python libraries so that we can create our model based on them.&lt;/p&gt;

&lt;p&gt;I can simply create a text (.txt) file named requirements.txt where I can simply write down all the individual module/library names in separate lines.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;ipykernel
ants
ipywidgets
matplotlib
opencv-python
jupyter
notebook
antspyx
SimpleITK
antspynet
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Notebook
&lt;/h3&gt;

&lt;p&gt;We can use VSCode or any other Python IDEs for writing our code. But I like to use the Jupyter Notebook as we can run different segments of our code separately. Also, all of the outputs stay in the same notebook.&lt;/p&gt;

&lt;p&gt;You can also use the Google Colab notebook for free! Kaggle Notebook can also be used for free.&lt;/p&gt;

&lt;p&gt;If you use the Google Colab, then you need to mount the drive to Notebook so that you can directly access all the files from your Google Drive.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Connect Google Drive with Colab
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;google.colab&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;drive&lt;/span&gt;
&lt;span class="n"&gt;drive&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/content/drive&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now we can simply install all the required modules/libraries that are listed on our requirements.txt file.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Install necessary components
&lt;/span&gt;&lt;span class="err"&gt;!&lt;/span&gt; &lt;span class="n"&gt;pip&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="n"&gt;requirements&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;txt&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This will install all the packages/modules that are listed on that specific text file. If you need more modules to install, you can simply add the name in that text file. If you need a specific version of a library, then you can also do that in the text file.&lt;/p&gt;

&lt;p&gt;Now we can import modules in our code. Let me check whether it has successfully installed the AntsPy and SimpleITK or not. Those two are very important libraries for our task.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;matplotlib&lt;/span&gt; &lt;span class="n"&gt;inline&lt;/span&gt;
&lt;span class="c1"&gt;# matplotlib will be displayed inline in the notebook
&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;

&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/content/drive/MyDrive/MRI_Image_Processing/notebooks&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# appending the path to include our custom helper
&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;helpers&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;helpers&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ants&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;SimpleITK&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;sitk&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;AntsPy Version = &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;ants&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__version__&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;SimpleITK version = &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;sitk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__version__&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AntsPy Version = 0.4.2
SimpleITK version = 2.3.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The rest of the code with their output and necessary comments are given below:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Define the base directory by getting the directory name of the specified path
&lt;/span&gt;&lt;span class="n"&gt;BASE_DIR&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dirname&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/content/drive/MyDrive/MRI_Image_Processing/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Print the path to the project folder
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;project folder = &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;BASE_DIR&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;Output&lt;/span&gt;

&lt;span class="n"&gt;project&lt;/span&gt; &lt;span class="n"&gt;folder&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;drive&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;MyDrive&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;MRI_Image_Processing&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;

&lt;span class="c1"&gt;# Define the directory path
&lt;/span&gt;&lt;span class="n"&gt;directory_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/content/drive/MyDrive/MRI_Image_Processing/assets/raw_examples/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;

&lt;span class="c1"&gt;# Initialize an empty list to store filenames
&lt;/span&gt;&lt;span class="n"&gt;raw_examples&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

&lt;span class="c1"&gt;# Iterate through files in the directory and add filenames with extensions to raw_examples list
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listdir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;directory_path&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Check if the path refers to a file (not a subdirectory)
&lt;/span&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isfile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;directory_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;)):&lt;/span&gt;
        &lt;span class="n"&gt;raw_examples&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Display the updated raw_examples list
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw_examples&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;['ADNI_136_S_0184_MR_MPR____N3__Scaled_2_Br_20081008132905229_S18601_I119714.nii.gz', 'ADNI_136_S_0195_MR_MPR____N3__Scaled_Br_20090708095227200_S65770_I148270.nii.gz', 'ADNI_136_S_0184_MR_MPR____N3__Scaled_Br_20080123103107781_S18601_I88159.nii.gz', 'ADNI_136_S_0086_MR_MPR____N3__Scaled_Br_20070815111150885_S31407_I67781.nii.gz', 'ADNI_136_S_0195_MR_MPR____N3__Scaled_2_Br_20081008133516751_S12748_I119721.nii.gz', 'ADNI_136_S_0184_MR_MPR____N3__Scaled_2_Br_20081008132712063_S12474_I119712.nii.gz', 'ADNI_136_S_0195_MR_MPR____N3__Scaled_Br_20080123103529723_S19574_I88164.nii.gz', 'ADNI_136_S_0184_MR_MPR-R____N3__Scaled_Br_20080415154909319_S47135_I102840.nii.gz', 'ADNI_136_S_0196_MR_MPR____N3__Scaled_Br_20070215192140032_S13831_I40269.nii.gz', 'ADNI_136_S_0195_MR_MPR____N3__Scaled_Br_20071113184014832_S28912_I81981.nii.gz', 'ADNI_136_S_0196_MR_MPR____N3__Scaled_Br_20070809224441151_S31829_I66740.nii.gz', 'ADNI_136_S_0086_MR_MPR____N3__Scaled_Br_20081013161936541_S49691_I120416.nii.gz', 'ADNI_136_S_0195_MR_MPR____N3__Scaled_2_Br_20081008133704276_S19574_I119723.nii.gz', 'ADNI_136_S_0086_MR_MPR____N3__Scaled_Br_20070215172221943_S14069_I40172.nii.gz', 'ADNI_136_S_0184_MR_MPR____N3__Scaled_Br_20070215174801158_S12474_I40191.nii.gz', 'ADNI_136_S_0195_MR_MPR-R____N3__Scaled_Br_20071110123442398_S39882_I81460.nii.gz', 'ADNI_136_S_0184_MR_MPR____N3__Scaled_Br_20090708094745554_S64785_I148265.nii.gz', 'ADNI_136_S_0195_MR_MPR____N3__Scaled_Br_20070215185520914_S12748_I40254.nii.gz', 'ADNI_136_S_0195_MR_MPR-R____N3__Scaled_Br_20081013162450631_S47389_I120423.nii.gz', 'ADNI_136_S_0184_MR_MPR-R____N3__Scaled_Br_20070819190556867_S28430_I69136.nii.gz']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Above, we can see all the necessary input data that we want to process.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;antspynet.utilities&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;brain_extraction&lt;/span&gt;

&lt;span class="c1"&gt;# Initialize an empty list to store the generated probabilistic brain masks
&lt;/span&gt;&lt;span class="n"&gt;prob_brain_masks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

&lt;span class="c1"&gt;# Loop through all items in the raw_examples list
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;raw_example&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;raw_examples&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Create the full file path by joining the base directory with the path to the specific image file
&lt;/span&gt;    &lt;span class="n"&gt;raw_img_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BASE_DIR&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;assets&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;raw_examples&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;raw_example&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Read the image using AntsPy's image_read function, specifying reorientation to 'IAL'
&lt;/span&gt;    &lt;span class="n"&gt;raw_img_ants&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ants&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;image_read&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw_img_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reorient&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;IAL&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Print the shape of the image as a numpy array in the format (Z, X, Y)
&lt;/span&gt;    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;shape = &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;raw_img_ants&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;numpy&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; -&amp;gt; (Z, X, Y)&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Display the 3D array using a custom function 'explore_3D_array' with the image array and a specified colormap
&lt;/span&gt;    &lt;span class="nf"&gt;explore_3D_array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;raw_img_ants&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;numpy&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;cmap&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;nipy_spectral&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Generate a probabilistic brain mask using the 'brain_extraction' function
&lt;/span&gt;    &lt;span class="c1"&gt;# The 'modality' parameter specifies the imaging modality as 'bold'
&lt;/span&gt;    &lt;span class="c1"&gt;# The 'verbose' parameter is set to 'True' to display detailed progress information
&lt;/span&gt;    &lt;span class="n"&gt;prob_brain_mask&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;brain_extraction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw_img_ants&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;modality&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;bold&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;verbose&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Append the generated probabilistic brain mask to the list
&lt;/span&gt;    &lt;span class="n"&gt;prob_brain_masks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prob_brain_mask&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Print the filename or any relevant information about the current image (optional)
&lt;/span&gt;    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Probabilistic Brain Mask for: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;raw_example&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Print the probabilistic brain mask
&lt;/span&gt;    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prob_brain_mask&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Visualize the probabilistic brain mask using the 'explore_3D_array' function
&lt;/span&gt;    &lt;span class="c1"&gt;# This function displays the 3D array representation of the brain mask
&lt;/span&gt;    &lt;span class="nf"&gt;explore_3D_array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prob_brain_mask&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;numpy&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

    &lt;span class="c1"&gt;# Generate a binary brain mask from the probabilistic brain mask using a threshold
&lt;/span&gt;    &lt;span class="n"&gt;brain_mask&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ants&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_mask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prob_brain_mask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;low_thresh&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Visualize the original image overlaid with the brain mask contour
&lt;/span&gt;    &lt;span class="nf"&gt;explore_3D_array_with_mask_contour&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw_img_ants&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;numpy&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;brain_mask&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;numpy&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

    &lt;span class="c1"&gt;# Define the output folder path by joining the base directory with the 'assets' and 'preprocessed' directories
&lt;/span&gt;    &lt;span class="n"&gt;out_folder&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BASE_DIR&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;assets&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;preprocessed&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Create a subfolder within the 'preprocessed' directory named after the raw file (without extension)
&lt;/span&gt;    &lt;span class="n"&gt;out_folder&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;out_folder&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;raw_example&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;.&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;  &lt;span class="c1"&gt;# Create folder with name of the raw file
&lt;/span&gt;
    &lt;span class="c1"&gt;# Create the output folder if it doesn't exist already
&lt;/span&gt;    &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;makedirs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;out_folder&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;exist_ok&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# Create folder if it doesn't exist
&lt;/span&gt;
    &lt;span class="c1"&gt;# Generate a filename by adding the suffix 'brainMaskByDL' to the original raw file name
&lt;/span&gt;    &lt;span class="n"&gt;out_filename&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;add_suffix_to_filename&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw_example&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;suffix&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;brainMaskByDL&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Create the full output file path by joining the output folder with the generated filename
&lt;/span&gt;    &lt;span class="n"&gt;out_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;out_folder&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;out_filename&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Print the relative path of the input raw image file (excluding the base directory)
&lt;/span&gt;    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw_img_path&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BASE_DIR&lt;/span&gt;&lt;span class="p"&gt;):])&lt;/span&gt;

    &lt;span class="c1"&gt;# Print the relative path of the output file (excluding the base directory)
&lt;/span&gt;    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;out_path&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BASE_DIR&lt;/span&gt;&lt;span class="p"&gt;):])&lt;/span&gt;

    &lt;span class="c1"&gt;# Save the brain mask to a file
&lt;/span&gt;    &lt;span class="n"&gt;brain_mask&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;out_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Create a masked image by applying the binary brain mask ('brain_mask') to the original image ('raw_img_ants')
&lt;/span&gt;    &lt;span class="n"&gt;masked&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ants&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mask_image&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw_img_ants&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;brain_mask&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Visualize the 3D array representation of the masked image
&lt;/span&gt;    &lt;span class="nf"&gt;explore_3D_array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;masked&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;numpy&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

    &lt;span class="c1"&gt;# Generate a filename by adding the suffix 'brainMaskedByDL' to the original raw file name
&lt;/span&gt;    &lt;span class="n"&gt;out_filename&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;add_suffix_to_filename&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw_example&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;suffix&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;brainMaskedByDL&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Create the full output file path by joining the output folder with the generated filename
&lt;/span&gt;    &lt;span class="n"&gt;out_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;out_folder&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;out_filename&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Print the relative path of the input raw image file (excluding the base directory)
&lt;/span&gt;    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw_img_path&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BASE_DIR&lt;/span&gt;&lt;span class="p"&gt;):])&lt;/span&gt;

    &lt;span class="c1"&gt;# Print the relative path of the output file (excluding the base directory)
&lt;/span&gt;    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;out_path&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BASE_DIR&lt;/span&gt;&lt;span class="p"&gt;):])&lt;/span&gt;

    &lt;span class="c1"&gt;# Save the masked image ('masked') to a file specified by 'out_path'
&lt;/span&gt;    &lt;span class="n"&gt;masked&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;out_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The output is very huge.&lt;/p&gt;

&lt;p&gt;But you can check the entire project from here: &lt;a href="https://github.com/FahimFBA/skull-stripping-3D-brain-mri/" rel="noopener noreferrer"&gt;FahimFBA/skull-stripping-3D-brain-mri/&lt;/a&gt;&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/FahimFBA" rel="noopener noreferrer"&gt;
        FahimFBA
      &lt;/a&gt; / &lt;a href="https://github.com/FahimFBA/skull-stripping-3D-brain-mri" rel="noopener noreferrer"&gt;
        skull-stripping-3D-brain-mri
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Apply Skulll Stripping to any 3D Brain MRI images
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;skull-stripping-3D-brain-mri&lt;/h1&gt;

&lt;/div&gt;

&lt;p&gt;Apply Skulll Stripping to any 3D Brain MRI images&lt;/p&gt;

&lt;/div&gt;
&lt;br&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/FahimFBA/skull-stripping-3D-brain-mri" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;Also, you will find a warning in the output like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;WARNING:tensorflow:5 out of the last 5 calls to &amp;lt;function Model.make_predict_function.&amp;lt;locals&amp;gt;.predict_function at 0x792af6defe20&amp;gt; triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has reduce_retracing=True option that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for  more details.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I can solve it for you. But I am leaving this task for you to resolve! 😉&lt;/p&gt;

&lt;p&gt;You can find my raw data and the preprocessed data in the &lt;a href="https://github.com/FahimFBA/skull-stripping-3D-brain-mri/tree/main/assets" rel="noopener noreferrer"&gt;assets&lt;/a&gt; directory.&lt;/p&gt;

&lt;p&gt;The complete notebook with all the outputs is &lt;a href="https://github.com/FahimFBA/skull-stripping-3D-brain-mri/blob/main/notebooks/Skull_Stripping.ipynb" rel="noopener noreferrer"&gt;here&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Some sample images of the output images are given below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbam7cxnn58xyh9tg6vor.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbam7cxnn58xyh9tg6vor.png" alt="Brain Mask" width="405" height="572"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzaeu73iyez3o2p0l820p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzaeu73iyez3o2p0l820p.png" alt="Brain Area" width="404" height="585"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F86rith4fg72xbti674tt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F86rith4fg72xbti674tt.png" alt="image" width="403" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmeefxzlazcpmxkfx6j2e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmeefxzlazcpmxkfx6j2e.png" alt="Image" width="401" height="584"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Make sure to ⭐ the repository if you like this!&lt;/p&gt;

&lt;p&gt;Cheers! 😊&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>deeplearning</category>
      <category>brain</category>
      <category>mri</category>
    </item>
    <item>
      <title>How To Create GUI Window Using Python's Tkinter</title>
      <dc:creator>Md. Fahim Bin Amin</dc:creator>
      <pubDate>Fri, 22 Dec 2023 08:55:00 +0000</pubDate>
      <link>https://dev.to/fahimfba/how-to-create-gui-window-using-pythons-tkinter-48fn</link>
      <guid>https://dev.to/fahimfba/how-to-create-gui-window-using-pythons-tkinter-48fn</guid>
      <description>&lt;p&gt;You can create GUI (Graphical User Interface) based applications using Tkinter (Tkinter is a graphical user interface (GUI) library for Python scripts. It's the only framework built into the Python standard library and is included in all standard Python distributions). In this article, I will show you how you can create a very basic simple GUI window in Python just using a few lines of code. I have also created a video for you! 😊&lt;/p&gt;

&lt;h2&gt;
  
  
  Video Tutorial
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/k_ToCC4-pe8"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;This Python script creates a basic graphical user interface (GUI) application using &lt;code&gt;tkinter&lt;/code&gt;, a standard GUI toolkit in Python.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tkinter&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;tk&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tkinter.font&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;tkFont&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;App&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="c1"&gt;# Setting the title
&lt;/span&gt;        &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;title&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;My First GUI Window&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="c1"&gt;# Setting the window size
&lt;/span&gt;        &lt;span class="n"&gt;height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;720&lt;/span&gt;
        &lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1280&lt;/span&gt;
        &lt;span class="n"&gt;screenheight&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;winfo_screenheight&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;screenwidth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;winfo_screenwidth&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;alignstr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;%dx%d+%d+%d&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;screenwidth&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;screenheight&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;geometry&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;alignstr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resizable&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Tk&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;App&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mainloop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Output
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frvpdb8aw2zpac7k3j5e9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frvpdb8aw2zpac7k3j5e9.png" alt="GUI Window" width="800" height="473"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's break down the script:&lt;/p&gt;

&lt;h3&gt;
  
  
  Import Statements
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;import tkinter as tk&lt;/code&gt;: Imports the &lt;code&gt;tkinter&lt;/code&gt; module and gives it an alias &lt;code&gt;tk&lt;/code&gt;. This module provides classes and methods to create GUI elements.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;import tkinter.font as tkFont&lt;/code&gt;: Imports the &lt;code&gt;font&lt;/code&gt; submodule from &lt;code&gt;tkinter&lt;/code&gt;. It's used to deal with fonts, though it's not explicitly used in this script.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Class Definition: &lt;code&gt;App&lt;/code&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;class App:&lt;/code&gt;: Defines a new class &lt;code&gt;App&lt;/code&gt;, which will contain the components of the GUI.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Constructor: &lt;code&gt;__init__&lt;/code&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;def __init__(self, root):&lt;/code&gt;: The constructor of the &lt;code&gt;App&lt;/code&gt; class. It initializes a new instance of the class. &lt;code&gt;root&lt;/code&gt; is the main window of the application, typically an instance of &lt;code&gt;Tk&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Inside the Constructor
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Setting Title&lt;/strong&gt;: &lt;code&gt;root.title("undefined")&lt;/code&gt;: Sets the title of the window to "undefined".&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Setting Window Size&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;width=600&lt;/code&gt; and &lt;code&gt;height=500&lt;/code&gt;: Sets the width and height of the window in pixels.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;screenwidth = root.winfo_screenwidth()&lt;/code&gt; and &lt;code&gt;screenheight = root.winfo_screenheight()&lt;/code&gt;: Retrieves the width and height of the screen.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;alignstr = '%dx%d+%d+%d' % (width, height, (screenwidth - width) / 2, (screenheight - height) / 2)&lt;/code&gt;: Creates a string to specify the size and position of the window. It centers the window on the screen.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;root.geometry(alignstr)&lt;/code&gt;: Applies the size and position settings to the window.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;root.resizable(width=False, height=False)&lt;/code&gt;: Disables resizing of the window.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Main Block
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;if __name__ == "__main__":&lt;/code&gt;: Checks if the script is being run directly (not imported as a module).

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;root = tk.Tk()&lt;/code&gt;: Creates the main window (&lt;code&gt;root&lt;/code&gt;) of the application.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;app = App(root)&lt;/code&gt;: Instantiates the &lt;code&gt;App&lt;/code&gt; class with &lt;code&gt;root&lt;/code&gt; as the argument.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;root.mainloop()&lt;/code&gt;: Starts the main event loop of the program. This keeps the window open and waits for user interaction.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Limitations and Further Development
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The script only sets up a window without any widgets (like buttons, labels, or text fields).&lt;/li&gt;
&lt;li&gt;To make it a functional application, you would need to add widgets inside the &lt;code&gt;App&lt;/code&gt; class.&lt;/li&gt;
&lt;li&gt;The script also does not handle any events or user interactions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is a foundational script for a tkinter application, providing a window setup, but it lacks the interactive components typical of GUI applications.&lt;/p&gt;

&lt;p&gt;I will try to make more videos and articles on Python Tkinter-based projects later.&lt;/p&gt;

</description>
      <category>python</category>
      <category>tkinter</category>
      <category>gui</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>A Helper Agent That Became My Friend</title>
      <dc:creator>Md. Fahim Bin Amin</dc:creator>
      <pubDate>Mon, 04 Dec 2023 13:08:35 +0000</pubDate>
      <link>https://dev.to/fahimfba/a-helper-agent-that-became-my-friend-1egg</link>
      <guid>https://dev.to/fahimfba/a-helper-agent-that-became-my-friend-1egg</guid>
      <description>&lt;p&gt;The title seems pretty intuitive and clickbait, right? But I promise that it isn't!&lt;/p&gt;

&lt;p&gt;As an open-source contributor, I struggle to check out all the GitHub notifications I get each hour. Sometimes, it burns me out to check them on a daily basis, and I also get a lot of notifications from people complaining about not checking their issues or pull requests.&lt;/p&gt;

&lt;p&gt;Pull requests are one of the most important things in our lives if we are developers. Pull requests can contain a fix of a bug that you have been struggling to resolve for a very long time. Pull requests can contain new enhancement features, documentation, and a lot of things that can not be described in sentences.&lt;/p&gt;

&lt;p&gt;As for me, I find pull requests need more attention than the issues themselves. Why is that? Let me clarify.&lt;/p&gt;

&lt;p&gt;Pull requests indeed require significant attention in the software development process. Here are a few reasons why they might demand more focus than issues:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Complexity&lt;/strong&gt;: Pull requests often involve changes across multiple files or even entire systems. They may include multiple solutions or features, making them more intricate than individual issues.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Code Quality and Review&lt;/strong&gt;: Pull requests necessitate thorough code reviews to ensure the quality, correctness, and adherence to coding standards. This involves analyzing the changes made, checking for bugs, and ensuring that the code integrates smoothly with the existing codebase.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Integration and Testing&lt;/strong&gt;: Pull requests need to be integrated into the main codebase seamlessly. This involves running various tests to ensure that the changes do not introduce new bugs or regressions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Collaboration and Discussion&lt;/strong&gt;: Pull Requests are often the focus of collaboration between team members. Discussions, suggestions, and improvements might occur within the PR itself, making it a focal point for teamwork and iteration.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Impact on the Project&lt;/strong&gt;: Unlike issues, which often describe problems or feature requests, pull requests directly implement changes. Their impact on the project can be more profound, making careful attention essential.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Merge Process&lt;/strong&gt;: Before merging a pull request, it's essential to consider the implications it might have on the codebase and the project as a whole. Handling conflicts and ensuring a smooth merge is critical.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;While issues define problems or tasks, pull requests represent the proposed solutions or changes to address those issues. Hence, they demand more attention due to their direct influence on the codebase and the project's progress.&lt;/p&gt;

&lt;p&gt;As we need to do most of the tasks manually in the pull requests, it takes a lot of time and effort to check them. &lt;/p&gt;

&lt;p&gt;What if we had an Artificial Intelligence agent that does the job for us? That sounds interesting, in fact too amazing and too good to be true, right?&lt;/p&gt;

&lt;p&gt;Well, luckily for me, I have already found an interesting tool that does exactly what I struggle to do in the pull requests. That is none other than the &lt;a href="https://www.codium.ai/products/git-plugin/" rel="noopener noreferrer"&gt;PR Agent of Codium AI&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwyuouo0uw27ugzgvnsk4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwyuouo0uw27ugzgvnsk4.png" alt="Website for the Git Plugin of CodiumAI" width="800" height="376"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, I know that a lot of you are thinking about the existing GitHub copilot. Don't get me wrong, I was there too. I was an avid Copilot user, but after checking out CodiumAI, I have become their fan, to be honest. The detailed comparison can take a lot of pages here, but I am going to make it simple so that you can get to know the differences at a glance.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;GitHub Next (Copilot for Pull Request)&lt;/th&gt;
&lt;th&gt;PR Agent of Codium AI&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Closed Source&lt;/td&gt;
&lt;td&gt;Open Source&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Limited amount of commands&lt;/td&gt;
&lt;td&gt;Supports many commands&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Supports only GitHub&lt;/td&gt;
&lt;td&gt;Supports all Git platforms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Supports GitHub only&lt;/td&gt;
&lt;td&gt;Supports GitHub and IDEs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  How To Add Codium AI's PR Agent Into Your GitHub Repository
&lt;/h2&gt;

&lt;p&gt;There are many ways to add the PR agent to your new or existing GitHub repository, but I find it useful to do that as a GitHub action. If you are interested in checking the other available installation methods, then you can simply head over to their &lt;a href="https://github.com/Codium-ai/pr-agent/blob/main/INSTALL.md" rel="noopener noreferrer"&gt;official documentation&lt;/a&gt; where they described each of them really well.&lt;/p&gt;

&lt;p&gt;I will specifically show the hands-on procedure of how you can do that too.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You have to create a &lt;code&gt;.github&lt;/code&gt; directory in your repository's root directory. In that &lt;code&gt;.github&lt;/code&gt; directory/folder, you can create another sub-directory/folder named &lt;code&gt;workflows&lt;/code&gt; which is useful especially when you are planning to use multiple workflows in a repository.
For the sake of this article, I am creating a brand new repository named &lt;strong&gt;test-pr-agent&lt;/strong&gt; on GitHub.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwk2m8alor3hfxwbf3f2l.png" alt="Creating a new GitHub repository" width="800" height="745"&gt;
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F38mbdqlsbngln24xikv3.png" alt="Creating a new GitHub repository" width="800" height="853"&gt;
&lt;/li&gt;
&lt;li&gt;The new repository has been created.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3q8cl1ebesbfx5i83u4v.png" alt="A new GitHub repository" width="800" height="761"&gt;
&lt;/li&gt;
&lt;li&gt;For all of the later tasks, you can directly use your browser and make the changes, or you can also open the VSCode dev edition on your browser/codespace. You can also make the changes locally after cloning the repository. I like to work on local machines, therefore, I will clone the repository and make the changes.&lt;/li&gt;
&lt;li&gt;For cloning my repository, I would simply copy the &lt;code&gt;SSH&lt;/code&gt; URL.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgt2fi549jr7b65y77lwi.png" alt="Clone using SSH" width="800" height="514"&gt;
&lt;/li&gt;
&lt;li&gt;Now I will open my terminal. You can use any terminal you want. Then you can also change the directory if you want to clone the repository in a different location. For example, I am changing my current directory to the Desktop as I want to clone the repository in my Desktop directory.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyumar94enm7rtkndnmd1.png" alt="Changing the current directory to the Desktop" width="800" height="442"&gt;
&lt;/li&gt;
&lt;li&gt;Make sure that you already have configured your local machine for GitHub usage, like installing Git if you are on Windows, adding the SSH keys, and so on. To clone the repository, I can simply use the &lt;code&gt;git clone SSH-URL&lt;/code&gt; command. For me, it is &lt;code&gt;git clone git@github.com:FahimFBA/test-pr-agent.git&lt;/code&gt;
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcf87kq2kijzcb3uviaiw.png" alt="Cloning the repository in the local machine" width="800" height="443"&gt;
&lt;/li&gt;
&lt;li&gt;As I already have the VS Code installed on my local machine, I can simply open the VS Code in that cloned repository's directory.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnmn8kiec9610h84pbogb.png" alt="Opening VS Code" width="800" height="675"&gt;
&lt;/li&gt;
&lt;li&gt;For now, I am creating a new &lt;code&gt;yml&lt;/code&gt; file under &lt;code&gt;.github/workflows/&lt;/code&gt;. I am naming the file as &lt;code&gt;pr_agent.yml&lt;/code&gt;. You can give it other names if you want, but you can not keep space between the words in the file name. After this, the file is residing within &lt;code&gt;.github/workflows/pr_agent.yml&lt;/code&gt;. &lt;/li&gt;
&lt;li&gt;Now I can copy the relevant lines of code from the official documentation.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;pull_request&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;issue_comment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;pr_agent_job&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;permissions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;issues&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;
      &lt;span class="na"&gt;pull-requests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;
      &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Run pr agent on every pull request, respond to user comments&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;PR Agent action step&lt;/span&gt;
        &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;pragent&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Codium-ai/pr-agent@main&lt;/span&gt;
        &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;OPENAI_KEY&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.OPENAI_KEY }}&lt;/span&gt;
          &lt;span class="na"&gt;GITHUB_TOKEN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.GITHUB_TOKEN }}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now I can simply commit the changes and push to the origin.&lt;/li&gt;
&lt;li&gt;Maybe you can already understand that we need to enable the GitHub action to write settings on the repository. We also need to generate our OpenAI Key and add that as a repository secret in the GitHub repository.&lt;/li&gt;
&lt;li&gt;Every GitHub repository has a specified GitHub token, and that is generally used as &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; in the code. But we need to enable the write access from that specific repository settings. To do that, simply head over to the GitHub repository in your browser, and go to the &lt;strong&gt;Settings&lt;/strong&gt; tab.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwzt0zu8flnb3z4an50kl.png" alt="Go to repository settings" width="800" height="452"&gt; 
&lt;/li&gt;
&lt;li&gt;Click on the &lt;strong&gt;Actions&lt;/strong&gt; menu and then click on the &lt;strong&gt;General&lt;/strong&gt; submenu.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkifw6dgbvwout9wy7jjk.png" alt="GitHub action settings" width="800" height="764"&gt;
&lt;/li&gt;
&lt;li&gt;Make sure that you have selected &lt;strong&gt;Allow all actions and reusable workflows&lt;/strong&gt; within the Actions permission section.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq4e585dgjiyqt3ji952p.png" alt="Actions permission" width="682" height="389"&gt;
&lt;/li&gt;
&lt;li&gt;You can keep the &lt;strong&gt;Fork pull request workflows from outside collaborators&lt;/strong&gt; section as it was. I keep it in &lt;code&gt;Require approval for first-time contributors&lt;/code&gt;.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fia5mhit2avmk9619s7j3.png" alt="Fork pull request workflows from outside collaborators section" width="640" height="292"&gt;
&lt;/li&gt;
&lt;li&gt;Make sure to select &lt;code&gt;Read and write permissions&lt;/code&gt; within the &lt;strong&gt;Workflow permissions&lt;/strong&gt; section.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F38rcsdn1cnktszd51bdl.png" alt="Workflow permissions" width="682" height="512"&gt;
Also, make sure that you have added a tick (✅) mark in the &lt;code&gt;Allow GitHub Actions to create and approve pull requests&lt;/code&gt; section.&lt;/li&gt;
&lt;li&gt;Click &lt;code&gt;Save&lt;/code&gt; to save all newly customized settings.&lt;/li&gt;
&lt;li&gt;Now we need the API Key from OpenAI. Simply head over to the &lt;a href="https://platform.openai.com/api-keys" rel="noopener noreferrer"&gt;official website&lt;/a&gt; to get the API key. Login to your OpenAI/ChatGPT account.&lt;/li&gt;
&lt;li&gt;We need to generate a new secret API key to use in that repository. Simply click on "Create new secret key".
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fizjv7ape8q5n0zoga3bu.png" alt="Create new secret key" width="800" height="524"&gt;
&lt;/li&gt;
&lt;li&gt;Give a name to your new secret key so that you can understand afterward which key you used for the PR-agent. 
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmz6v5rymfw6xnictxyou.png" alt="Name your secret key" width="667" height="337"&gt;
For me, let me name it "PR-agent secret key". Then click on "Create secret key".
This will provide you with a new secret key. Make sure to copy it, as we need it right after this. Also, it is a sensitive key, therefore, make sure no one else gets to know this key. For security purposes, I have also tried to hide the key.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fat2kig4omt0r6to4fa79.png" alt="My Secret key" width="651" height="436"&gt;
Click on "Done".&lt;/li&gt;
&lt;li&gt;Now head over to your repository where you have added the &lt;code&gt;yml&lt;/code&gt; file to use the PR-agent. Go to the repository settings, Click on "Secrets and variables" and lastly click on "Actions".
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F51ujiyushkd663w43wck.png" alt="repo actions" width="800" height="758"&gt;
&lt;/li&gt;
&lt;li&gt;Click on "New repository secret".
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftoaacjo0hml77jcodxqc.png" alt="repo secret" width="749" height="725"&gt;
&lt;/li&gt;
&lt;li&gt;Now paste your OpenAI Secret key in the Secret box and give it a name that you used in the &lt;code&gt;yml&lt;/code&gt; file. As I used &lt;code&gt;OPENAI_KEY&lt;/code&gt; as the variable name in the &lt;code&gt;yml&lt;/code&gt; file, I am going to give the same name here as well.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8yml9g7hlj7rqnoflyv4.png" alt="my repo secret for the OpenAI key" width="684" height="477"&gt;
&lt;/li&gt;
&lt;li&gt;Click on "Add secret". Now you are good to go!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Let us test it out!
&lt;/h2&gt;

&lt;p&gt;Now it is the time to check whether that is working or not. For simplicity, I am creating a new branch locally where I am making some changes. Later I am going to add a new pull request.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fziemhyhao033el7levlr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fziemhyhao033el7levlr.png" alt="New PR" width="800" height="743"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you see that the PR-Agent has already started working in the PR.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ugq7w8ee5f2oumxlyok.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ugq7w8ee5f2oumxlyok.png" alt="actions on the go" width="711" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I can call the CodiumAI-Agent by mentioning it with a &lt;code&gt;@&lt;/code&gt; and I can pass the pre-defined commands. For now, let's see what it reviews on the new pull request.&lt;/p&gt;

&lt;p&gt;I can simply use &lt;code&gt;@CodiumAI-Agent /review&lt;/code&gt;, and then click on "Comment".&lt;/p&gt;

&lt;p&gt;The PR-agent has started working instantly, and I can also check that from the Actions &amp;gt; Workflows tab.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcmtisniuc3t5dr1h7p1e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcmtisniuc3t5dr1h7p1e.png" alt="PR-agent has started working" width="800" height="498"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you see that the PR-agent has responded to my comment with an eye emoji (👀), and it immediately provided me with its review. It also gives feedback, how to use, instructions, etc. data so that others can also use it.&lt;/p&gt;

&lt;p&gt;After calling once, the PR-agent would become available in the mentions, and you can call it using the &lt;code&gt;@&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwtl356tmacbiejhek9vb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwtl356tmacbiejhek9vb.png" alt="Call the PR-agent" width="721" height="305"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Currently available commands for the PR-agent are:
&lt;/h2&gt;

&lt;p&gt;You can tag &lt;code&gt;@CodiumAI-Agent&lt;/code&gt; in a comment '@CodiumAI-Agent' and add one of the following commands:&lt;br&gt;
&lt;code&gt;/review&lt;/code&gt;: Request a review of your Pull Request.&lt;br&gt;
&lt;code&gt;/describe&lt;/code&gt;: Update the PR title and description based on the contents of the PR.&lt;br&gt;
&lt;code&gt;/improve [--extended]&lt;/code&gt;: Suggest code improvements. Extended mode provides a higher quality feedback.&lt;br&gt;
&lt;code&gt;/ask &amp;lt;QUESTION&amp;gt;&lt;/code&gt;: Ask a question about the PR.&lt;br&gt;
/update_changelog: Update the changelog based on the PR's contents.&lt;br&gt;
&lt;code&gt;/add_docs&lt;/code&gt;: Generate docstring for new components introduced in the PR.&lt;br&gt;
&lt;code&gt;/generate_labels&lt;/code&gt;: Generate labels for the PR based on the PR's contents.&lt;br&gt;
You can also see the &lt;a href="https://github.com/Codium-ai/pr-agent/blob/main/docs/TOOLS_GUIDE.md" rel="noopener noreferrer"&gt;tools guide&lt;/a&gt; for more details.&lt;/p&gt;

&lt;p&gt;I love asking questions using this!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3gqo2b1crjdkerqehqo8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3gqo2b1crjdkerqehqo8.png" alt="A silly conversation" width="610" height="583"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  On a serious note
&lt;/h2&gt;

&lt;p&gt;Enough chatting! Now it is the time to test it in action. I am working on a project named &lt;a href="https://github.com/FahimFBA/assist-me/" rel="noopener noreferrer"&gt;AssistMe&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now I am going to integrate PR-agent into this existing repository, and then I am going to check whether it performs well on the older Pull Requests.&lt;/p&gt;

&lt;p&gt;Voila! 🎊&lt;/p&gt;

&lt;p&gt;It also works with the earlier pull requests.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Test: review &lt;a href="https://github.com/FahimFBA/assist-me/pull/136" rel="noopener noreferrer"&gt;Old pull request 1&lt;/a&gt;
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiux5gak8jrkpz20bxl8n.png" alt="old PR" width="745" height="747"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1mr1bdtbeabqnt9yv6hk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1mr1bdtbeabqnt9yv6hk.png" alt="Code feedback" width="519" height="724"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Test: add_docs &lt;a href="https://github.com/FahimFBA/assist-me/pull/14" rel="noopener noreferrer"&gt;Old pull request 2&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzvlgm667ys3iy4ot7y7l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzvlgm667ys3iy4ot7y7l.png" alt="old PR 2" width="673" height="666"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Test: improve &lt;a href="https://github.com/FahimFBA/assist-me/pull/71" rel="noopener noreferrer"&gt;Old pull request 3&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Froewzzyd2ri3bxhfg3r3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Froewzzyd2ri3bxhfg3r3.png" alt="old PR 3" width="648" height="776"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Thanks for reading the entire article. Now you see how I scaled up my open source project progress and made myself more productive while CodiumAI's PR-Agent is doing my task for me more efficiently!&lt;/p&gt;

&lt;p&gt;It's really a blessing to have this type of AI tool for us. Surprisingly enough, CodiumAI's PR-agent also offers a free tier, and the examples I have shown above, all of them have been done using the free tier account. So, just think how many things can be done if you want to scale it more!&lt;/p&gt;

&lt;p&gt;This is it for today. Hope to see you again someday.&lt;/p&gt;

&lt;p&gt;Cheers! 🥂&lt;/p&gt;

&lt;p&gt;Cover Image Credit: Photo by &lt;a href="https://unsplash.com/@neonbrand?utm_content=creditCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=unsplash" rel="noopener noreferrer"&gt;Kenny Eliason&lt;/a&gt; on &lt;a href="https://unsplash.com/photos/man-wearing-white-and-black-plaid-button-up-sports-shirt-pointing-the-silver-macbook-y_6rqStQBYQ?utm_content=creditCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=unsplash" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Start Learning Python</title>
      <dc:creator>Md. Fahim Bin Amin</dc:creator>
      <pubDate>Sun, 05 Nov 2023 16:00:57 +0000</pubDate>
      <link>https://dev.to/fahimfba/how-to-start-learning-python-248b</link>
      <guid>https://dev.to/fahimfba/how-to-start-learning-python-248b</guid>
      <description>&lt;p&gt;If you are thinking about learning Python, then this article is for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why You Should Learn Python
&lt;/h2&gt;

&lt;p&gt;Learning Python is a smart thing to do for various reasons:&lt;/p&gt;

&lt;h3&gt;
  
  
  Versatility and Popularity
&lt;/h3&gt;

&lt;p&gt;Python is a widely used, versatile programming language that is applicable in diverse domains such as web development, data analysis, artificial intelligence, machine learning, scientific computing, automation, and more.&lt;/p&gt;

&lt;p&gt;It's also one of the most popular languages out there these days, so it's a smart programming language to learn.&lt;/p&gt;

&lt;p&gt;Many job positions across different industries require Python skills. So learning Python increases your employability and job market competitiveness.&lt;/p&gt;

&lt;h3&gt;
  
  
  Data Analysis and Visualization
&lt;/h3&gt;

&lt;p&gt;Python has a robust ecosystem of libraries and tools (like Pandas, NumPy, Matplotlib, and Seaborn) for data analysis and visualization. These skills are in high demand as businesses increasingly rely on data-driven insights.&lt;/p&gt;

&lt;h3&gt;
  
  
  Machine Learning and AI
&lt;/h3&gt;

&lt;p&gt;Python is a preferred language for machine learning and artificial intelligence due to libraries like TensorFlow, PyTorch, and scikit-learn. Understanding Python is essential for anyone interested in these rapidly evolving fields.&lt;/p&gt;

&lt;h3&gt;
  
  
  Web Development
&lt;/h3&gt;

&lt;p&gt;Python has frameworks like Django and Flask that simplify web development, making it a great choice for both beginners and experienced developers looking to build web applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Automation and Scripting
&lt;/h3&gt;

&lt;p&gt;Python's simplicity and readability make it an excellent choice for automating tasks and writing scripts. It can be used to automate repetitive tasks, saving time and effort.&lt;/p&gt;

&lt;h3&gt;
  
  
  Community and Support
&lt;/h3&gt;

&lt;p&gt;Python has a vast and active community. While you're learning it, you'll have access to a wealth of tutorials, documentation, and forums which makes it easier to learn and solve problems.&lt;/p&gt;

&lt;h3&gt;
  
  
  Easy to Learn
&lt;/h3&gt;

&lt;p&gt;Python is known for its clear and readable syntax, making it easier for beginners to learn and understand basic programming concepts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Problem-Solving Skills
&lt;/h3&gt;

&lt;p&gt;Learning Python teaches you essential problem-solving and algorithmic thinking skills that are transferable to other programming languages and domains.&lt;/p&gt;

&lt;h3&gt;
  
  
  Future-Proofing
&lt;/h3&gt;

&lt;p&gt;As technology advances, Python remains at the forefront of emerging trends due to its adaptability and continuous development.&lt;/p&gt;

&lt;p&gt;As you can see, learning Python can equip you with essential skills needed in various industries. It'll also enhance your career prospects, and enable you to contribute to current and future technological advancements.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Write Your First Python Code 🙌
&lt;/h2&gt;

&lt;p&gt;When we start learning any programming language, we begin by writing "Hello World" in the terminal.&lt;/p&gt;

&lt;p&gt;This is very easy, and it gives us the pleasure of doing something in a programming language, even if we've just started learning that language.&lt;/p&gt;

&lt;p&gt;So we're going to do this in Python – but first, I would like to explain some prerequisites that you'll need on your computer.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to install Python on your machine
&lt;/h3&gt;

&lt;p&gt;There are many ways to code on your computer, or even on your phone – I'm not joking!&lt;/p&gt;

&lt;p&gt;Nowadays, it is very easy to code even from your smartphone or a tablet, as there are a ton of websites that help you write, debug, and run your code directly from a browser.&lt;/p&gt;

&lt;p&gt;If you think that your computer/device might not be good enough for installing the programming software locally, then you can easily use any cloud-based popular platforms. Among these, GitHub Codespace and Replit are my favorites. You can check them out too:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbkvy699rkip14knv6y62.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbkvy699rkip14knv6y62.png" alt="GitHub Codespace" width="800" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fysn2isayjgbxjzrzg602.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fysn2isayjgbxjzrzg602.png" alt="Replit" width="800" height="356"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to set up Python locally on your machine, then you are in luck because there are a ton of resources widely available on the internet to guide you through.&lt;/p&gt;

&lt;p&gt;I have also written an depth article to show you the whole process step by step. You can read that article directly from here if you'd like. I also included a video tutorial to help you out.&lt;/p&gt;

&lt;p&gt;If you are a Linux user, then Python already comes pre-installed. You can check whether you have Python installed on your system by using the command &lt;code&gt;python3 --version&lt;/code&gt; also.&lt;/p&gt;

&lt;p&gt;And if you are a Mac user, then you can check out this guide to help you get Python installed and make sure you have the latest version.&lt;/p&gt;

&lt;p&gt;There are various ways to write Python code on your local machine. You can use Notepad, Notepad++, Sublime Text, VS Code, or any other text editor. You can also use IDEs like PyCharm.&lt;/p&gt;

&lt;p&gt;I will use VS Code for this article. If you're doing the same, you'll want to install the &lt;a href="https://code.visualstudio.com/docs/languages/python" rel="noopener noreferrer"&gt;Python extension in VS Code&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We will install more extensions later if we need them.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Create a Python File
&lt;/h2&gt;

&lt;p&gt;If we want to create a file for writing Python code, we have to ensure that we add the &lt;code&gt;.py&lt;/code&gt; as the extension to the file name.&lt;/p&gt;

&lt;p&gt;When you're naming your file, there are a few things to keep in mind. For example, you can add spaces between two words in the file name, but that is not recommended. Instead, you can either use an underscore ( &lt;code&gt;_&lt;/code&gt; ), use camel case ( &lt;code&gt;firstName&lt;/code&gt; ), or use the snake case ( &lt;code&gt;first_name&lt;/code&gt; ) to better handle spaces.&lt;/p&gt;

&lt;p&gt;For now, I am creating a file named &lt;code&gt;Main.py&lt;/code&gt;. In that file, I'll write my first Python code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello World&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This prints the string in the terminal:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hello World&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We use the print function whenever we want to print something in the terminal. We use single quotes or double quotes in the print function, and we write whatever we want to print in the terminal within the quotes.&lt;/p&gt;

&lt;p&gt;This also gives the exact output.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hello World&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Just keep in mind that there are certain scenarios when we should use single quotes and double quotes. But you don't need to worry about that right now – you can learn those later.&lt;/p&gt;

&lt;p&gt;Just note that you can't mix the two types of quotes in a single print statement. If you are using single quotes at the start, for example, then make sure you use single quotes for the end. The same thing is applicable in the case of double quotes as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Video Walkthrough
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/playlist?list=PL7ZCWbO2Dbl5S2SlRcfKNk2x6njQrHMTt" rel="noopener noreferrer"&gt;I have started a complete Python playlist to teach you Python from basic to advanced&lt;/a&gt;. As I am currently a final year computer science student in the Machine Learning major, and I am also researching Machine Learning, Artificial Intelligence, and Neural Networks along with some relevant technologies. This also helps me to keep my knowledge fresh and updated continuously.&lt;/p&gt;

&lt;p&gt;The first video from that specific playlist demonstrates everything I have told you up until now. Make sure to watch the video here:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/1g0pWjJWW4M"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Thank you for reading the entire article.&lt;/p&gt;

&lt;p&gt;If you have any questions please let me know by reaching out on &lt;a href="https://twitter.com/Fahim_FBA" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; or &lt;a href="https://www.linkedin.com/in/fahimfba/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can also follow me on:🎁GitHub: &lt;a href="https://github.com/FahimFBA" rel="noopener noreferrer"&gt;FahimFBA&lt;/a&gt;🎁YouTube: &lt;a href="https://www.youtube.com/@FahimAmin?sub_confirmation=1" rel="noopener noreferrer"&gt;@FahimAmin&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you are interested then you can also check my website: &lt;a href="https://fahimbinamin.com/" rel="noopener noreferrer"&gt;https://fahimbinamin.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy Coding! 😊&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How To Convert Multiple Images Into A Single PDF File Using 4 Lines of Python Code</title>
      <dc:creator>Md. Fahim Bin Amin</dc:creator>
      <pubDate>Tue, 18 Jul 2023 18:51:57 +0000</pubDate>
      <link>https://dev.to/fahimfba/how-to-convert-multiple-images-into-a-single-pdf-file-using-4-lines-of-python-code-4ee5</link>
      <guid>https://dev.to/fahimfba/how-to-convert-multiple-images-into-a-single-pdf-file-using-4-lines-of-python-code-4ee5</guid>
      <description>&lt;p&gt;Today, you will create a project that will grab all of the image files from a particular directory and create a single PDF file including all of the images. &lt;/p&gt;

&lt;p&gt;The interesting thing about Python is, you will need &lt;strong&gt;only 4 lines of code&lt;/strong&gt; to achieve that! So, let's get started, shall we?&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Detailed Article
&lt;/h2&gt;

&lt;p&gt;I have written the complete article on &lt;a href="https://www.freecodecamp.org/news/convert-multiple-images-into-a-single-pdf-file-with-python/" rel="noopener noreferrer"&gt;freeCodeCamp&lt;/a&gt;. Make sure to read that too!&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://www.freecodecamp.org/news/convert-multiple-images-into-a-single-pdf-file-with-python/" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.freecodecamp.org%2Fnews%2Fcontent%2Fimages%2F2023%2F07%2Falvaro-reyes-fSWOVc3e06w-unsplash.jpg" height="533" class="m-0" width="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://www.freecodecamp.org/news/convert-multiple-images-into-a-single-pdf-file-with-python/" rel="noopener noreferrer" class="c-link"&gt;
            Python Project – How to Convert Multiple Images into a Single PDF File
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            Creating projects is the best way to learn a programming language. It is fun and it's a creative way to learn new things. Whenever I try to learn a new language or new technology, I try to create a project, whether it's a small byte-sized or big proj...
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.freecodecamp.org%2Funiversal%2Ffavicons%2Ffavicon.ico" width="48" height="48"&gt;
          freecodecamp.org
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  📺 Video Guideline
&lt;/h2&gt;

&lt;p&gt;I know that many of you like to watch video instead of following a complete article. Fear not! I have also created a complete video tutorial just for you!&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/zBZhfzgahsk"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  🎯 Pre Requisite
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Simply create a new folder for the project. Please make sure that you do not keep any spaces in the folder's name.&lt;/li&gt;
&lt;li&gt;Keep some image files in that directory. For this project, I am going to use the &lt;code&gt;.jpg&lt;/code&gt; image files. Therefore I would suggest you to do the same thing!&lt;/li&gt;
&lt;li&gt;You can download the royalty free images from &lt;a href="https://unsplash.com/" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt; or &lt;a href="https://unsplash.com/" rel="noopener noreferrer"&gt;Pexels&lt;/a&gt;. Keep in mind that our project can't handle large image files. Therefore, try to download those image files which are smaller in file size. You can select small files during downloading them from Unsplash.&lt;/li&gt;
&lt;li&gt;Now simply open the Visual Studio Code. If you want, then obviously you can use other text editors or IDEs. But for simplicity, I like to use widely used free software. And VS Code is the best in this sector.&lt;/li&gt;
&lt;li&gt;Create a Python file where you will write down the entire code with me. I am going to create a file named &lt;code&gt;Script.py&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Install the package/library named &lt;code&gt;img2pdf&lt;/code&gt;. This library is used for converting images to PDF via direct JPEG inclusion. You can check this &lt;a href="https://pypi.org/project/img2pdf/" rel="noopener noreferrer"&gt;website&lt;/a&gt; for more details. I am going to install it using pip. Simply open a terminal and use the command, &lt;code&gt;pip install img2pdf&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  💻 Code
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import os
import img2pdf
with open("ImageContainingBook.pdf", "wb") as file:
    file.write(img2pdf.convert([i for i in os.listdir("C:\\Users\\fahim\\Desktop\\ImageToPdf") if i.endswith(".jpg")])) # Change the file directory accordingly
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;⭐ The complete project is available on &lt;a href="https://github.com/FahimFBA/img2singlePDF" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here, I imported two necessary packages first, &lt;code&gt;os&lt;/code&gt; and &lt;code&gt;img2pdf&lt;/code&gt;. Then I need to specify exactly in which file format and file name I want to place my image files. As I want to generate a PDF file to include all of my image files, I have specified that.&lt;/p&gt;

&lt;p&gt;Then I need to specify what I want to do with the file. I want to write in that file and I want the conversion functionality of the &lt;code&gt;img2pdf&lt;/code&gt; library. In my specified directory, there might be a lot of different files and that is natural. But as I only want to convert the image files which have a &lt;code&gt;.jpeg&lt;/code&gt; extension in them, I need to specify that explicitly. Also, I definitely need to include the file directory where it will get all of the images.&lt;/p&gt;

&lt;h2&gt;
  
  
  🏃‍♂️ Run
&lt;/h2&gt;

&lt;p&gt;If you have the Code Runner extension installed on your VS Code, then you can simply run the file using that extension.&lt;/p&gt;

&lt;p&gt;As my filename is Script.py and I am using my Windows machine, my command would be &lt;code&gt;python Script.py&lt;/code&gt;. If you are a Linux or Mac user, then use the command &lt;code&gt;python3 Script.py&lt;/code&gt; or &lt;code&gt;python3 filename.py&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  💁‍♂️ Conclusion
&lt;/h2&gt;

&lt;p&gt;I hope you have enjoyed this short article.  😊&lt;/p&gt;

&lt;p&gt;If you have any questions then please let me know using &lt;a href="https://twitter.com/Fahim_FBA" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; or &lt;a href="https://www.linkedin.com/in/fahimfba/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can also follow me on:&lt;br&gt;
🎁GitHub: &lt;a href="https://github.com/FahimFBA" rel="noopener noreferrer"&gt;FahimFBA&lt;/a&gt;&lt;br&gt;
🎁YouTube: &lt;a href="https://www.youtube.com/@FahimAmin?sub_confirmation=1" rel="noopener noreferrer"&gt;@FahimAmin&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are interested then you can also check my website: &lt;a href="https://fahimbinamin.com/" rel="noopener noreferrer"&gt;https://fahimbinamin.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Have a great day! 😊&lt;/p&gt;

&lt;p&gt;🖼️ Cover: Photo by Christina Morillo: &lt;a href="https://www.pexels.com/photo/woman-programming-on-a-notebook-1181359/" rel="noopener noreferrer"&gt;https://www.pexels.com/photo/woman-programming-on-a-notebook-1181359/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>codenewbie</category>
      <category>tutorial</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
