Creating flat images from a three-dimensional volume

Currently, I am working on generating real-time mock-ultrasound images using volumetric CT data. A unique aspect of this project is that the user can control the position of the probe, determining the plane they are viewing.

My approach so far involves extracting pixel data from all DICOM images and combining them into a single 3D pixel array. The next step is to slice this 3D array at different angles. To visualize this process, picture a 3D rectangular box (100 pixels wide and deep [x,z] and 500 long [y]) with a 2D "viewing plane" (50 x 50 pixels). Initially, the viewing plane's position starts at [0,25] with the origin at [50,250,0] (center of the top surface, looking down). It is oriented left to right, cutting straight through the rectangle. Three parameters govern the placement of the viewing plane - location of the origin, rotation around the vertical axis, and tilt around the intersection line within the box. By adjusting these parameters, users can create an image composed of the pixels intersected by the viewing plane.

Although my explanation might be unclear due to my limited mathematics background as a medical student, I would greatly appreciate any assistance or guidance in this project.

Answer №1

Using the 2D equation for a line and solving for each x value while rounding the y variable to the nearest integer was suggested by Edje09 yesterday.

However, there are two main issues with this method in the 2D case:

  1. If the line has a gradient steeper than 1, some pixels may be missed.
  2. Rounding can result in choosing a pixel above the intended choice.

This pdf addresses these issues and presents a possible solution for the 2D scenario which can later be extended to 3D.

UPDATE: I have outlined a potential solution for the 3D case in another pdf. This outline can potentially be translated into an algorithm and then code. Please note that I haven't done any verification yet, but it should help you progress further.

CODE ADDED: The following Javascript code appears to meet your requirements. It might run slow, so patience is advised after clicking SET. Additionally, the 'pane' doesn't clear between views, making it hard to notice any changes until the 'pane' refreshes. I've only tested using two images to represent 100 pixels in the z direction. The first code line in the function getPixels handles this limitation; remove it for a full set of images in the z direction. The tests conducted are somewhat basic but seem satisfactory. A complete set of images would provide more accurate testing results.

In my conception, the 3D array is viewed as a series of D images where image(0) lies at the back and running in the z direction towards image(D-1) at the front. Each image has a width W in the x direction and height H in the y direction. Thanks for presenting this challenge; I found it quite enjoyable.

The links to a zipped folder containing the images used can be found at the end of the code.

<!DOCTYPE HTML>
<html>
...
Above javascript code continues here...
... 
</body>
</html>

Images used in the code

Answer №2

This problem has really caught my attention, and I began dissecting it only to encounter some significant roadblocks. The task is far more complex than it initially appears! To simplify things, I started by considering a 1D slice through a 2D array. However, it quickly became apparent that determining which pixels belong to the slice isn't straightforward for every scenario. I've prepared a comprehensive PDF document illustrating this issue. If you'd like to take a look, here's the link to the PDF file: Issues 2D. More contemplation is needed before a viable solution can be proposed. I regret not being able to provide further assistance at this moment.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How to Resize a div Using Vue.js without el.style.attr Command

I've been attempting to create something similar to the image using Vue, but I'm struggling with resizing the div elements. Group of Circles: Vue Warning: Error in mounted hook: "TypeError: Cannot read property 'style' of undefined ...

Server-side error encountered during a file upload using Ajax

I am attempting to set up ajax file upload using the HTML5 File API, following Afzaal Ahmad Zeeshan's guidance in response to this query. Even though I have replicated the entire code he provided, I am unable to make it function. The primary objecti ...

Elegant Bootstrap 4 Carousel featuring a glimpse of the upcoming slide alongside the primary carousel item

I am in search of a straightforward Bootstrap 4 carousel that showcases a glimpse of the next slide on the right. Despite exploring similar questions, I have not found a suitable solution. The links to those questions are: 1)Bootstrap carousel reveal part ...

The directive is becoming unbound

Currently, I am facing an issue with my code. I have set up a fiddle that demonstrates a directive displaying an alert and also a controller with an alert function. Everything is functioning correctly except for the fact that the binding for the text on th ...

What is the best method for retrieving the entire row data based on the maximum value in a column?

function findMaxValue() { var highestValue = Math.max.apply(Math, $('.sira').map(function() { return $(this).text() })) alert(highestValue); } <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"& ...

What is the method for combining two box geometries together?

I am looking to connect two Box Geometries together (shown in the image below) so that they can be dragged and rotated as one object. The code provided is for a drag-rotatable boxgeometry (var geometry1). What additional code do I need to include to join t ...

A Comprehensive Guide to Handling Errors in Angular 4: Passing the err Object from Service to Component

Currently, I am in the process of developing a login page using Angular for the front-end and Spring Security for the back-end. Everything appears to be functioning correctly, except for handling exceptions when attempting to catch errors from the service ...

The Chrome debugger will pause execution at a function without needing a DOM break point

Greetings! I am currently working on an angular js application. One issue that I have encountered is when I run the application and open the debugger by hitting F12, I notice that for every page it continuously calls a certain function and seems to stop th ...

What is the best way to pass a multidimensional table from a C function to Lua?

I am trying to send a table back to Lua in the following format: { [0] = { ["field1"] = "1", ["field2"] = "2" , ["field3"] = "3" }, [1] = { ["field1"] = "10" , ["field2"] = "20", ["field3"] = "30" } } From a C perspective, I need to accomplish th ...

How to pass GetServerSideProps into Page component props in Next.js with custom _app.js

Having issues integrating GetServerSideProps into my Next.js app. Despite the network call successfully fetching data and generating the pageName.json, the response data is not being injected into the page props as expected. Below is a snippet of my page ...

What is causing my HTML to not recognize my Angular JS code?

Trying to dive into Angular JS, I wrote a small piece of code but for some reason, the HTML is not recognizing Angular JS. This is my index.html file: <!DOCTYPE HTML> <html ng-app="store"> <head> <link rel="stylesheet" type=" ...

Is it correct that when values are saved without being paired with keys, they are stored as keys within a JavaScript object?

Consider a scenario where you have an object: const obj = { time, difficulty, distance, } Are the values inside the object saved as keys? If I were to use Object.keys() on the object, would I get an array of individual string elements? ...

Using AngularJS to dynamically update the DOM with the response from a service method

Here's the HTML code: <div ng-controller="AutoDeployController as autoDeploy"> <input type="text" ng-model="autoDeploy.message"> <p>Message: {{ autoDeploy.message }}</p> </div> <button ng-click="autoDeploy.chan ...

Utilize the identical ReactJS hook across multiple components

I've created a hook that pulls data from an API and stores the result in my component's state using setAllCommunitiesFromSponsor. Now I want to use this same hook in another component. Instead of copying and pasting, what is the best way to imp ...

Configuring babel-loader in webpack for optimal HMR functionality

Recently, I encountered an issue while trying to add Hot Module Replacement (HMR) to my project. Despite the console showing that HMR was enabled and detecting changes in files, the view was not re-rendering. The console would display: [HMR] Updated modul ...

Encountering an error when trying to set the value in an array dynamically

I am a beginner in VB and I am attempting to identify the indexes of selected values in ListBox1 and display those indexes in ListBox2 without specifying the length of the array. I want the values to be taken dynamically. Below is the code snippet I am usi ...

VueJS component experiencing stagnant DOM updates

I have reviewed similar posts on "DOM not updating", but have yet to find a solution. I am working on a task app and it can successfully load, add, and delete tasks from Firestore. However, I'm facing two issues and would like to address the first one ...

Leveraging the outcome of a for loop in order to set a condition within an else if statement

How can I condition my third else if statement based on the result of a for loop? //If player clicks centre on first move go in corner square if (current[4] === playerToken && this.state.stepNumber === 1) { let move = c ...

The front-facing camera lacks both auto focus and manual focus capabilities

Current Issue While using react-native-camera on iPads/iPhones, the front-facing camera does not focus properly when scanning barcodes like Code39, Code128, or QR codes. The rear camera works fine, but the front camera fails to focus on the barcode or any ...

Guide on integrating a JavaScript file for user scripts into a Chrome extension

Lately, I've been working on creating user scripts for Chrome that can operate without relying on Tampermonkey. Recently, I integrated a third-party extension (a userscript js) into my Chrome extensions: // ==UserScript== // @name "job changer" ...