Skip to content

feat: add support for calibration objects#1471

Merged
dbirman merged 13 commits into
devfrom
1470-20-add-subject_details-option-for-phantom-data
Jul 10, 2025
Merged

feat: add support for calibration objects#1471
dbirman merged 13 commits into
devfrom
1470-20-add-subject_details-option-for-phantom-data

Conversation

@dbirman

@dbirman dbirman commented Jun 18, 2025

Copy link
Copy Markdown
Member

This PR adds a CalibrationObject that can be used as a Subject.subject_details option.

Phantom implemented as a Device
@dbirman dbirman requested review from dyf and saskiad June 18, 2025 20:54
@dbirman dbirman linked an issue Jun 18, 2025 that may be closed by this pull request

@dyf dyf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If my phantom is a bunch of beads embedded in a gel, how would I represent that as a device?

@dbirman

dbirman commented Jun 24, 2025

Copy link
Copy Markdown
Member Author

If my phantom is a bunch of beads embedded in a gel, how would I represent that as a device?

notes: "Beads in a gel"?

I guess I was assuming phantoms here were objects purchased from somewhere whereas people here are making their own phantoms? Maybe we need to get some information about what requirements phantoms needs to have, or keep it generic and just make a class with a description: str field and let people write something down.

@dyf

dyf commented Jun 24, 2025

Copy link
Copy Markdown
Member

Okay I like that. My suggestion is

class PhantomDetails(DataModel):
   description: str
   devices: list[Device]

@dbirman dbirman requested review from dyf and removed request for saskiad June 24, 2025 20:47
@saskiad

saskiad commented Jun 27, 2025

Copy link
Copy Markdown
Collaborator

I'm really not keen on having a subject when there literally is no subject

@saskiad

saskiad commented Jun 27, 2025

Copy link
Copy Markdown
Collaborator

I'm confused why we decided not to use the solution we decided on back in the day?

@dbirman

dbirman commented Jun 27, 2025

Copy link
Copy Markdown
Member Author

I'm confused why we decided not to use the solution we decided on back in the day?

Because we didn't used to have a concept of "subject details" the subject class was a hodgepodge of fields related to the subject. Now that there's a clean differentiation between mouse/human (and other things) it's more obvious that a phantom is just an alternate set of details in the Union. See also David's original post.

I think this solution is cleaner than adding a new data level concept in my opinion, at the end of the day the data is no different than data acquired with a mouse (or human) in an instrument it's the subject of the acquisition that has changed.

@dbirman dbirman requested a review from saskiad June 29, 2025 19:58
@saskiad

saskiad commented Jul 1, 2025

Copy link
Copy Markdown
Collaborator

I still disagree.
First, The subject class is information about the animal that data is collected from. With this change, this isn't true. It's information about the object(?) data is collected from. But now, if I'm imaging a brain slice, why do I need the subject and procedures, why can't I just have "SliceDetails" for my subject? I think we're opening a slippery slope by broadening the concept in this way.
Second, I still strongly think we need a data level for calibration data.
Last, I think the term Phantom is confusing.

@saskiad

saskiad commented Jul 2, 2025

Copy link
Copy Markdown
Collaborator

Additional points:
A lot of calibration data has no subject and no device. Eg flat field correction. This doesn't address that need.
The example given (beads in a gel) is a poor motivation for me. In my experience, imaging beads is done to align the laser adjust the light path, and calibrate PSF. I didn't save any data or do anything with it outside beyond the acquisition rig. If you have a specific use case, I'd love to hear it. But I don't really think imaging beads is it.

@dbirman

dbirman commented Jul 2, 2025

Copy link
Copy Markdown
Member Author

Additional points: A lot of calibration data has no subject and no device. Eg flat field correction. This doesn't address that need. The example given (beads in a gel) is a poor motivation for me. In my experience, imaging beads is done to align the laser adjust the light path, and calibrate PSF. I didn't save any data or do anything with it outside beyond the acquisition rig.

If this is what we're discussing then we're going in circles, if there's no data asset there's no metadata...

I'm pretty sure David's intention in opening this issue was for the situation where a real data asset gets generated and sent downstream. I'm thinking about this coming from MRI where phantoms are a common thing, and they have two requirements that affect us: (1) the data asset generated with a phantom is indistinguishable from an asset from a human/animal, (2) processing pipelines can be run on these assets for testing.

The consequence of (1) is that the metadata is the only thing that tells us a phantom (or calibration object) was used. It feels very natural to put that data into the Subject.subject_details field. I hear your argument that you don't want to dilute subject as being about the original data source and I disagree that a calibration object is not an original data source in the same way that a human or animal is. I'm find finding a different place in the metadata to store this if you have an idea in mind, but I don't see another place.

The second issue is what convinces me that we shouldn't add a data level. What's different about these assets would not be the asset structure, which is really what DataLevel tells you.

@dbirman

dbirman commented Jul 2, 2025

Copy link
Copy Markdown
Member Author

I moved this issue to point at 2.x, it's not blocking for 2.0

@dbirman

dbirman commented Jul 3, 2025

Copy link
Copy Markdown
Member Author
  • CalibrationObject instead of PhantomSubject
  • CalibrationObject.empty: boolean <- no actual object was used in the calibration
  • CalibrationObject.object: Union[str, Device] <- clear description
  • Metadata-level validator that checks that the tag "calibration" shows up in data_description when a CalibrationObject is used

Base automatically changed from release-v2.0.0 to dev July 4, 2025 03:56
@dbirman dbirman changed the title feat: add support for phantoms feat: add support for calibration objects Jul 8, 2025
@dbirman dbirman added this pull request to the merge queue Jul 10, 2025
Merged via the queue into dev with commit 961761a Jul 10, 2025
5 checks passed
@dbirman dbirman deleted the 1470-20-add-subject_details-option-for-phantom-data branch July 10, 2025 04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add subject_details option for phantom data

3 participants