TL;DR

Table of Contents


Background

During the week of August 11-15 2025, I presented a workshop titled “Applying Large Language Models (LLMs) in Image Analysis” at the Laboratorio Nacional de Microscopía Avanzada (LNMA) in Cuernavaca, Morelos, Mexico. This work was sponsored through BINA’s Exchange of Experiences (EoE) Program and hosted by Dr. Adan Guerrero.

I wanted to write up an outline of the experience from beginning to end, and discuss how it’s shaping the future directions of my work at LOCI.

Course Design

In designing this course, I was looking for options to combine LLMs and Fiji/ImageJ (as I am a Fiji developer!). There was the start of a Fiji chatbot, but it didn’t work for me and it was dedicated to the Script Editor - which I didn’t want to jump into. We do have a napari-imagej bridge, and napari has the Omega plugin - but that also didn’t work for me at the time. I really wanted to go beyond “copy and paste with ChatGPT,” so I decided the ultimate goal we would work towards was using PyImageJ inside of Google Colaboratory: giving us LLM chatbot integration with a flexible ImageJ base!

My prior workshop experience was mostly limited to short “Intro to Fiji” experiences, so the prospect of a week-long course was a bit intimidating. It helped to cut down the total time: the first and last days would be reduced, where I could lecture (sharing introductions and advanced development concepts, respectively). Conceptually, I wanted to scaffold the learning from day to day: first “Chat LLMs”, then “Colab/Python”, and finally “Image Analysis”. It further relieved my mental load to standardize these core workshop days to a consistent outline of four segments: 1) a topic introduction/overview, 2) topic-specific prompt engineering/troubleshooting, 3) interactive exercises, and 4) free time where the students could explore topics of interest (or their own data).

After several weeks of intense work putting together hundreds of slides and numerous code samples, Colab notebooks, scripts, and so forth… I headed to Mexico with a mix of nerves and excitement.

The Workshop

Day 1: Welcome

Everyone was so kind! It was a pleasure to meet the students in Adan’s lab and learn about their research (Calcium ion exchange in sperm cells is a common theme). In class we did some ChatGPT-suggested icebreakers. Language was sometimes an inconvenience (it’s always easier to listen than talk) but the attendees were all enthusiastic. I talked about LLM fundamentals (tokens, prediction, context, prompts) and went through a standard “Intro to image processing in Fiji” slide deck.

I also made my first adjustment to the workshop. I had suggested the attendees use their student status to get Colab Pro upgrades, only to find out this was not available in Mexico. The attendees were “used to it;” I was more indignant and spent the evening researching methods for self-hosting LLMs.

Day 2: Chat LLMs

On our first full workshop day I spent the morning lecturing on prompt engineering and chat LLM troubleshooting (e.g. testing for hallucinations). I spent a significant chunk of time on a “postmortem” - going through a real conversation I had with ChatGPT to redesign a git repository. I wanted to set expectations that LLM use is not at a point of just providing answers: it requires back and forth discussion and exploration. At the break, one attendee approached me and said I was “teaching people how to think,” which was a compliment that stuck with me.

I started the interactive exercises with an “icebreaker,” where the attendees used an LLM to collaboratively write a poem. At the time, I did not appreciate the cultural significance of poetry in Mexico: this turned out to be a great hit, with much laughter and many poems being shared with the group. I thought they were all fantastic, but of course my favorite was the calavera Adan dedicated to me:

The Trembling, Segmenting Death

Mark arranged the bright pixels, prepared to display,
when Death strode right in, with a storm on the way.
Her rattle of bones made the tables all sway,
but Mark, without flinching, kept teaching away.

The ground softly quivered, the images blinked,
and Death leaned in closer, her sockets distinct.
“It is time,” she declared, “these frames must align,”
and asked ChatGPT how to draw the best line.

As a final task for the day, I asked attendees to use an LLM to create a “Self-assessment quiz” that could be used to study the concepts of the day, and share with the class. This proved to be a creative exercise, with some attendees creating websites - one with study flashcards and another exploring adaptive learning - and others creating elaborate quiz prompts. Reportedly they were interested in adapting these techniques in their own workshops, which I found quite satisfying.

Before the workshop, I created topic-specific “questionnaires” to collect brief ratings and feedback for each major topic day. When reviewing the feedback from today, a request for me to “be more interactive” resonated with me. I looked at my slides for the next day and found them to be incredibly text-heavy. So, I spent the rest of the evening rearranging my slide deck into something completely different.

Day 3: Python and Colab

I came to class this day unsure how all my changes would play out. We were starting to work with Python notebooks in Google Colab today, but I designed this workshop for attendees with no programming experience, so I knew I needed to introduce Python and basic programming concepts first. I originally intended to lecture first, and end the day with an exercise building a Python study/practice notebook. After last night’s redesign, I had created a starter notebook with a “system message” providing instructions for the Gemini LLM chatbot in Colab to create practice cells tailored for the user’s experience level, which we would generate interactively during the workshop.

As we started building our notebooks together, results were mixed: for some, cells were created perfectly. For others, Gemini missed some things or just “talked” back to them. Honestly I felt this “failure” was useful, because it reinforced a core message I was trying to convey: “LLMs are statistical machines that do not understand our requests.” It also provided a chance to do real-time troubleshooting and prompt engineering.

Following what I felt like was success of the poetry exercise yesterday, I wanted to continue with a “creative icebreaker” to encourage users to play with their new tools, so I challenged the students to create a Colab notebook that generates ASCII art images. I heard a lot of laughter during this exercise, but a bit less sharing than with the poems. Many attendees read input images and generated ASCII versions - which was great to see, but maybe indicated that the exercise wasn’t as well designed for my intended objectives. I was amused that someone did manage to find and ASCII-ify this picture of me though:

Me, in ASCII

Google Colaboratory has a significant number of built-in tutorials, so I ended the day with free time to explore these and provided a set of recommendations based on experience level. Ultimately I think this was a mistake - an interactive, guided exercise with clear goals would have been more engaging.

Day 4: PyImageJ and Colab

Honestly, I was fearing this day in class a bit. The previous content was so general that there was a comfort in it and an “ease” in its relative simplicity. When I was building this workshop, it was clear the documentation for PyImageJ was geared towards users with a development background. Although exercises were provided as notebooks, they were not obviously runnable or accessible for a less technical reader (and further, most did not cater to the headless runtime environment of Colab).

I decided to rework this day to interactively prompt Gemini to build a notebook reproducing the classic “Blobs” segmentation example. I provided a starting point notebook to download and setup a consistent version of Fiji (unfortunately, using PyImageJ naively from Colab can result in banning of the Runtime because it looks like spam to LOCI servers). I tried using role/persona text to guide Gemini to select PyImageJ API.

Unfortunately, this proved rather unsuccessful in practice. The guidance I provided was insufficient for Gemini to understand the differences in graphical/headless, or ImageJ 1.x vs ImageJ2, API selection.

I then thought I had a general solution for adapting the existing tutorials to the Colab environment: by loading the text of the tutorials into Gemini’s context and asking it to re-create parts of them. Unfortunately, in practice, this failed completely and we got gibberish tutorials. To recreate the PyImageJ tutorials in Colab, attendees ultimately had to copy and paste code cells from their browser.

Finally, to add insult to injury, the most impressive example notebook (combining PyImageJ, Stardist and Cellpose) that I had rescued from dependency hell the week previously, did not work this week. I later learned that over the weekend as I flew to Mexico, Colab had upgraded Python to 3.12, which completely broke my notebook.

The attendees were kind in their feedback (although I had to smile at the suggestions I “check script functionality” and “have [scripts] that would certainly work” - yes, if only). But this day definitely felt like a let-down.

Day 5: Fiji scripting and plugins

I had planned for this to be a lecture day, but given the feedback from the week I instead made it interactive. We worked through the Fiji GUI - exploring the macro recorder and script templates. This went moderately well, although felt a bit disconnected from the intended LLM focus of the workshop.

Finally, I recounted my own process of using a LLM-powered IDE to take an existing script template (Colocalisation.groovy) and create a new script-based plugin in Fiji to “teach” the user how to perform coloc. Further, the advantages of then moving to Java plugin development (e.g. more powerful code organization, GUI design). This “Coloc Teacher” plugin seemed well-received and gave me ideas for a new direction of development in Fiji.

Post-workshop

Assessments

I gave attendees a pre- and post-workshop assessment where they rated their comfort level (1 - 5) with the tools and skills used in the course. I also gave a topic-specific questionnaire on the three major content days of the workshop, as to the effectiveness of that day’s content.

Average comfort scores were around 2’s for most topics before the workshop, and 3’s afterwards. The largest changes in the average ratings were in:

  • Colab (2.08 to 2.8)
  • LLM's (2 to 2.7)
  • Scripting in Fiji (1.69 to 2.30)

The score for ChatGPT barely moved (2.92 to 3.20) suggesting I should not have spent so much time on chat-based LLMs due to the already relatively high initial comfort level.

Although Python moved from 2.15 to 2.70, Coding Concepts only moved from 2.31 to 2.60, suggesting to me that more time was needed for a general programming introduction.

For the questionnaires, I asked responders to rate the Session Utility, Clarity, Exercises, Tool Utility and Future Relevance from (1 to 5). The Chat LLM and Google Colab days were rated consistently well across the board with predominantly 5’s, a few 4’s, and fewer 3’s - with the overall ratings of the Google Colab day being even more positive (which I also take as positive feedback to the increase in interactivity).

The PyImageJ day, although still rated highly, has a comparatively clear trend lower - particularly in Clarity, Tool Utility and Future Relevance. I personally believe this reflects the definite mismatch of audience and accessibility limitations in the existing tutorial structure.

Note: I have the raw data and some visualizations if anyone is interested here. I also have never interpreted assessments of my workshop before! So would be curious to what insights others might have.

I also provided opportunities for short answers in both the assessments and questionnaires. Here were some quotes that stood out to me:

One thing that worked well was that Mark did an excellent job preparing the course materials and tailoring the content for both advanced participants and beginners. One thing I would change is that the topics we covered on days 4 and 5 felt heavier than those in the previous days, so I would recommend balancing the course more evenly.
I enjoyed python syntax practice, I learned a lot. I think it could be helpful introducing more python exercises from the start of the workshop so we can get more familiar with coding. The ASCII art was so playful and creative, thank you Mark <3
Examining the logical paths to use LLMs is a tool to examine the logical workings of our mind and would be extremely helpful for young students.
Examples of prompts getting bad answers are truly helpful. It seems to me that LLM responses are not always what we expect and see that even experts does not always get it right. For me, it is a green light to try harder.
I think the topics are already appropriate, but I would suggest shortening the review of the use of LLMs a little more and seeing more image analysis exercises like those from the last day.

Takeaways

First, I am so grateful we labeled this course “Experimental.” This definitely relieved some of the pressure as a first-time facilitator, and it gave me the confidence and freedom to change things dynamically in response to feedback. This was a benefit to the students as well - I heard attendees talking with pride when they saw their suggestions show up in the course the next day.

I wanted to highlight several aspects of this workshop that I believe were successful for teaching LLM use:

  • LLM tools change quickly. Although we may commit to a particular tool for teaching, encourage experimentation and self-directed learning. Focus on demonstrating how to break down problems, and set an expectation that failure and iteration is normal and necessary.
  • Play keeps people engaged. The “creative” exercises were well-received to the point that I saw positive changes in tone of the workshop afterwards. I would even expand their place in future workshops (I unfortunately didn’t have a “creative PyImageJ” exercise). The goal of these activities is ultimately to get users curious about the technology, and to encourage future self-directed exploration and experimentation.
  • Live workshop “failures” are a learning opportunity. I am very interested in finding more ways to illustrate process during workshops; the “postmortems” were useful, but the live debugging of prompt failures were perhaps even more so. In the future, I might even deliberately start from a “not quite working” state (especially if a known path to “working” is prepared). At the least, I will strive to embrace and accept when things don’t go as planned.

There were also many things I would now do differently in designing future workshops:

  • Don’t lecture if you can avoid it! I think having some stories mixed in was useful, like to show my own LLM use as a developer. But I felt like as much as possible everything else should have been done interactively.
  • Don’t cut days short. By the end of the week, I wished I had used all the available time for interactive exercises.
  • Use a dedicated chat group for sharing. My slides were sprinkled with QR codes and prompt text to copy, which turned out to be inefficient and impractical. I created a WhatsApp group for the workshop and this made so much more sense for sharing links and text in a standardized way. I wasn’t sure what adoption of the chat group would be in the beginning, but I wish I had leaned into it harder and built the workshop with the expectation of its use.
  • Do cultural research ahead of time. Knowing what “fun” exercises might be relevant and how to build icebreakers could have made the course even more engaging. I also could have avoided situations like suggesting Colab Pro for education (I later found that GitHub Education is available in Mexico, which could have altered the direction of the course)
  • Always do assessments in class!! I actually knew this, but thought my questionnaires were lightweight enough that I would still get responses. This led to me wrangling and requesting feedback when I was back in the US. I should have stuck to building in time for assessments at the end of each day.
  • Ensure pre-assessment questions have a place in the workshop. I thought I was asking reasonable open-ended questions, but I don’t think they were actually written in a way where I could act on their responses (e.g., “What do you hope to learn or gain from this workshop?”). I wish I had asked about concrete image analysis needs, and incorporated that directly into interactive workshop time, instead of providing “free” time for attendees to do this themselves. While some did ask me for ideas, it was usually after the day had ended and we missed out on sharing knowledge with the group.

There was a lot of interest in repeating this workshop (e.g. annually). I am also interested in providing shortened, content-focused portions of it for other audiences (e.g. Images to Knowledge / I2K). Further, I believe it would be useful to collaborate with workshop teachers to standardize this workshop in native languages; a few of the attendees who already had strong technical skills expressed interest in being future presenters.

Ultimately, I will take these lessons to heart, and apply them future iterations of this workshop (or others!).

ImageJ/Fiji Directions

I believe key elements of the ImageJ/Fiji learning ecosystem that were created pre-LLMs are difficult to access for bench scientists with little coding experience. The PyImageJ documentation and imaging tutorials on the wiki stand out to me here. There was a lot of effort put into these documents, but it was written manually largely by developers. I believe we can do better now, especially with the assistance of LLMs ourselves in creating fresh documentation.

For PyImageJ, I outlined a documentation revitalization plan to better separate concepts by audience, and to scaffold learning by starting from runnable Colab notebooks while guiding the user to eventually manage their Python environments and run notebooks locally. Colab is a great environment for immediately running code without local setup, but it is currently terrible for long-term scientific reproducibility due to the lack of environmental controls. We need to make that distinction clear, and guide users to reproducible environments.

To further the python integration, the scripting-python project built on appose has advanced significantly, such that we can now run native Python code from the Fiji script editor. This gives us a real reproducible environment for leveraging Pythonic tools in Fiji, which I tried to capture by rewriting the Cellpose + Stardist tutorial when I got back to the US. I would like this to be the eventual first recommendation for python development in Fiji, but it is still an area for requiring usability feedback and development. Furthermore, it requires a fresh look at the script template system.

This python scripting direction is one part of a new, larger Fiji Learn framework I am envisioning. I want to take the Coloc_Teacher plugin I created for this workshop and:

  • Generalize it to an extensible framework that can be repeated for other plugins
  • Use these “teacher” plugins to create an interactive, in-Fiji “image analysis workshop” (which could be extended by developers in the community with modules for their own plugins)

This would be similar to the NEUBIAS training resources, but targeting users first rather than instructors (although I think Fiji Learn could also form the basis of future guided workshops). The goal of these modules would be to guide a user through proper use of Fiji plugins to explore fundamental image processing and analysis concepts, ultimately introducing them and transitioning to the script editor as an environment for reproducible analysis workflows.

One concept that stuck out to me when I returned was that of Pedagogical Prompting: a structured syntax for learners to engineer effective prompts. I believe I was naturally doing a form of this on my Python instruction workshop day, when guiding attendees to build their own study notebooks. I would like to continue to adopt and adapt this structure formally, and include clear guidance in our training materials on prompt engineering.

Finally, I want to provide first class LLM support in Fiji. I would like to create a proper chatbot inside Fiji with user-friendly model customization. I think this will take iteration and user feedback to get right, but as a starting point I would like to aim for an interface similar to Gemini’s in Colab: with the ability to clearly establish context (e.g. selectors for particular images, script code, commands) and comprehensive script editor support, in addition to conversational responses.

I am currently less interested in an “image analysis agent” that can run commands itself, as I have concerns about the ultimate goal of serving scientific reproducibility in Fiji. But I do believe part of this LLM integration will involve developing “rule sets” for core ImageJ/Fiji API’s, to teach LLMs proper scripting usage in a variety of contexts, independent of LLM model or environment. I believe this would be valuable whether LLMs are being applied in Colab, the Fiji script editor, or a web-based chatbot. Honestly, as these API rules would necessarily be human readable, it might also prove an efficient method of documenting our API for human developers.

As a side note, as a developer I am also interested in finding or building new development tools for working with LLMs. In particular, I would think it could be useful to link prompts to Git commit history, and track what commits are essentially LLM changes and what are human: both for transparency and educational purposes (so others might try to repeat our work).

Closing

Workshop participants at LNMA, Cuernavaca, August 2025

Please let me know if you have any questions about this workshop or the topics and directions I mentioned. I appreciate that I outlined a lot of potential development outputs, some of which are quite significant and will take time to fully realize. I would love to hear if you have suggestions, feedback, or are interested in collaborating on any of these areas.

Finally, I wanted to say that this experience had a significant effect on me. It has given me many ideas and directions that I hope will positively benefit the community as a whole. I am deeply grateful to Adan, the staff, and students of UNAM in Morelos for their kindness and generosity in hosting me. I am further grateful for the Chan Zuckerberg Initiatize (CZI) and Center for Open Bioimage Analysis (COBA) for funding my work at LOCI, and again for BINA’s Exchange of Experience Program that made this event possible. In fact, this only came about because I met Adan in Madison last fall on his own EoE! I hope others can continue to benefit from this program to find collaboration and cultural exchange.

@hinerm Hi Mark–I found a recorded version of your Getting Started using Large Language Models with ImageJ talk on youtube and found it very helpful. I couldn’t find a way to PM you via the forum, so just replying here in the hopes you see it. I’m curious whether there has been any further progress on visual models for the Fiji Chat tool that you briefly mentioned in your talk. I’m trying to utilize a workflow similar to what is described by the no longer active Kymobutler plug in but want to work with LLM/visual models to see if ROI selection/image segmentation can be automated or made more efficient. I think feeding time lapse images into a visual model and then having a dialogue with the model to iteratively improve segmentation is probably how that needs to happen. I’m a wetlab stem cell biologist and don’t have much coding or macro building experience–so really need to find user friendly ways to accomplish this. Any guidance, updates or advice would be appreciated. Best, Rich Krolewski

Hi @Rich_Krolewski! Sorry I didn't get back to you earlier; I was out on parental leave and am just getting back into things. If you ever need to PM, you should be able to on a user's page (e.g. Profile - hinerm - Image.sc Forum ) or, clicking on the name/picture at the top of a post should bring up a window to start a message. But I am glad you posted here instead!

I see where you are going with the visual model support; there hasn't been any development in that direction. Based on my current knowledge, I am wondering if a vision-based LLM might be overkill for the task you're describing? Commercial LLMs are such massive, generalist models... and personally I am reluctant to rely on them for data analysis, especially if there are pretrained classification models that could work for segmenting your data.

My current goals are to produce something that is very good at helping people use and navigate Fiji/ImageJ, with a particular focus on finding the tools appropriate for your data, and building scripts to automate analysis. I actually want to go in the opposite direction: with smaller, local models that just know ImageJ/Fiji really well. I'm hoping something that like will still be appropriate for your use case.

I am not familiar with Kymobutler, but it looks like it provides a straightforward python API for use... this seems like something that could perhaps still be integrated in Fiji, and ideally that's exactly the kind of task I would want the chatbot to assist with.

If you're still looking for solutions and interested, we could chat some time about your desired workflow.