Nutrient Deficiency Image Manager - A beautiful Shiny application for standardized renaming and compression of research images.
ShinyRenamingNDIDI is an R package that provides an intuitive Shiny web application designed for agricultural researchers working with nutrient deficiency images and supporting NDIDI. The app standardizes image naming conventions, making it easier to organize and manage large collections of experimental images.
- 🎨 Beautiful Modern UI: Clean, responsive interface with gradient designs and smooth animations
- 📁 Batch Image Upload: Upload multiple images at once via drag-and-drop or file selection
- ➕ Multiple Batch Support: Add images in different batches with different settings before downloading
- 👁️ Image Preview: View thumbnails of uploaded images with file information
- 🗑️ Selective Removal: Remove individual images or entire batches before processing
- 🏷️ Standardized Naming: Automatic renaming following the pattern:
crop_deficiency_phenologicalStage_deficiencyStage_userName_originalName.ext - 📦 Automatic Compression: All processed images are packaged into a single ZIP file
- 💾 Easy Download: One-click download of all renamed and compressed images
- 🔄 Quick Reset: Clear all inputs and batches and start fresh with a single click
- R (>= 4.0.0)
- RStudio (recommended)
# Install devtools if you haven't already
install.packages("devtools")
# Install ShinyRenamingNDIDI
devtools::install_github("Ciampitti-Lab/ShinyRenamingNDIDI")# Navigate to the package directory
setwd("path/to/ShinyRenamingNDIDI")
# Install required dependencies
install.packages(c("shiny", "bslib", "shinyjs", "zip", "tools", "base64enc", "htmltools"))
# Install the package
devtools::install()# Load the package
library(ShinyRenamingNDIDI)
# Run the app
run_app()The application will open in your default web browser.
-
Select Metadata (Left Panel):
- Choose the crop type (corn, soybean, wheat, etc.)
- Select the nutrient deficiency (N, P, K, etc.)
- Pick the phenological stage (vegetative, reproductive, etc.)
- Specify the deficiency stage (none, mild, moderate, severe)
- Enter your name
-
Upload Images (Left Panel):
- Click the upload area or drag-and-drop your images
- Supported formats: PNG, JPEG, JPG, TIFF, BMP
- Preview thumbnails appear in the middle panel
-
Review Current Upload (Middle Panel):
- Check the uploaded images
- Remove any unwanted images using the "Remove" button
-
Add to Batch (Middle Panel):
- Click the "+ Add to Batch" button
- Images are saved with current metadata settings
- Batch appears in the right panel
-
Repeat for Different Settings (Optional):
- Change metadata settings in left panel
- Upload new images
- Add another batch
- Repeat as needed for different crops/deficiencies/stages
-
Review All Batches (Right Panel):
- See all saved batches with their settings
- Remove individual batches if needed
-
Download All:
- Click the "📥 Download All" button
- All images from all batches are renamed and compressed
- ZIP file downloads with timestamp:
NDIDI_Images_userName_YYYYMMDD_HHMMSS.zip
-
Start Fresh:
- Click "↻ Clear All" to reset all fields, images, and batches
Batch 1 Input:
- Crop: Corn
- Deficiency: Nitrogen
- Phenological Stage: VE (Vegetative Early)
- Deficiency Stage: Severe
- User Name: JohnDoe
- Original Images:
IMG_001.jpg,IMG_002.jpg
Batch 2 Input:
- Crop: Wheat
- Deficiency: Phosphorus
- Phenological Stage: RM (Reproductive Mid)
- Deficiency Stage: Moderate
- User Name: JohnDoe
- Original Image:
IMG_003.jpg
Output Filenames in ZIP:
corn_nitrogen_VE_severe_JohnDoe_IMG_001.jpg
corn_nitrogen_VE_severe_JohnDoe_IMG_002.jpg
wheat_phosphorus_RM_moderate_JohnDoe_IMG_003.jpg
ZIP Archive:
NDIDI_Images_JohnDoe_20251118_143022.zip
Open R or RStudio and run:
source("setup.R")This will automatically install all required packages.
# Option A: Run without installing
devtools::load_all()
run_app()
# Option B: Install and run
devtools::install()
library(ShinyRenamingNDIDI)
run_app()- Fill in metadata (left panel):
- Select crop type
- Select nutrient deficiency
- Select phenological stage
- Select deficiency stage
- Enter your name
- Upload images (left panel):
- Click the upload area or drag & drop
- Accepts: PNG, JPEG, JPG, TIFF, BMP
- Review images (middle panel):
- See thumbnails of uploaded images
- Remove unwanted images
- Add to batch (middle panel):
- Click "+ Add to Batch"
- Batch is saved with current settings
- Add more batches (optional):
- Change settings in left panel
- Upload new images
- Click "+ Add to Batch" again
- Review batches (right panel):
- See all saved batches
- Remove unwanted batches
- Download:
- Click "📥 Download All"
- ZIP file downloads with all images
- Reset:
- Click "↻ Clear All" to start over
Solution:
# Update R and install packages from CRAN
update.packages(ask = FALSE)
install.packages(c("shiny", "bslib", "shinyjs", "zip", "base64enc", "htmltools"))Solution:
install.packages("devtools")Solution:
# Try installing dependencies manually
install.packages("shiny")
install.packages("bslib")
install.packages("shinyjs")
install.packages("zip")
# Then try again
devtools::install()Solution:
# Make sure you're in the package directory
setwd("path/to/ShinyRenamingNDIDI")
# Load the package first
devtools::load_all()
# Then run
run_app()Solution:
# Check if all packages are loaded
library(shiny)
library(bslib)
library(shinyjs)
# Try running directly from the app folder
shiny::runApp("inst/app")Solution:
# Specify a different port
shiny::runApp("inst/app", port = 3838)Solution:
- Check file format (must be PNG, JPEG, JPG, TIFF, or BMP)
- Check file size (very large files may take time)
- Check browser console for errors (F12)
- Try smaller number of files first
Solution:
# Restart the R session
.rs.restartR()
# Reload and try again
devtools::load_all()
run_app()Solution:
- Ensure
base64encpackage is installed:install.packages("base64enc") - Check if image files are corrupted
- Try with PNG files first
Solution:
- Check browser popup blocker settings
- Allow downloads from localhost
- Check disk space
- Try different browser
Solution:
- Check if
zippackage is installed:install.packages("zip") - Check temporary directory has write permissions:
tempdir() file.access(tempdir(), 2) # Should return 0
Solution:
- Check R console for errors
- Restart app
- Try with fewer images
- Check available memory
Solution:
- Verify all metadata fields are filled
- Check for special characters in your name
- Review naming pattern in documentation
Solution:
- Clear browser cache (Ctrl+F5)
- Try different browser (Chrome, Firefox, Edge)
- Check browser zoom level (should be 100%)
- Disable browser extensions
Solution:
- Ensure JavaScript is enabled
- Check browser console for errors (F12)
- Try incognito/private mode
- Update browser to latest version
Solution:
- Upload images in smaller batches
- Close other R sessions
- Increase R memory limit:
memory.limit(size = 8000) # Windows
- Use lower resolution images if possible
Solution:
- Reduce number of images
- Check available RAM
- Close unnecessary programs
- Update R to latest version
Solution:
- Make sure all dropdown menus have selections (not "Select...")
- Ensure name field is not empty
- Upload at least one image
Solution:
- Click directly on the dropdown text
- Try using keyboard (Tab + Arrow keys)
- Refresh the page
Solution:
# Use quotes around paths
setwd("C:/Users/My Name/Documents/ShinyRenamingNDIDI")
# Or use short path
setwd("C:/Users/MYNAME~1/Documents/SHINYR~1")Solution:
- Run RStudio as Administrator
- Check folder permissions
- Use a different temporary directory:
Sys.setenv(TMPDIR = "C:/Temp")
# See what's happening in the console
options(shiny.trace = TRUE)
run_app()# Verify package is installed correctly
packageVersion("ShinyRenamingNDIDI")
# Check dependencies
tools::package_dependencies("ShinyRenamingNDIDI",
which = "Imports")# Test file operations
test_file <- tempfile(fileext = ".jpg")
file.create(test_file)
file.exists(test_file)
# Test ZIP creation
zip::zip("test.zip", test_file)
file.exists("test.zip")# Run with error catching
tryCatch(
run_app(),
error = function(e) {
print(e)
traceback()
}
)If you still have issues:
- Check R Console: Look for error messages
- Browser Console: Press F12, check Console tab
- Session Info: Run
sessionInfo()and share output - Create Issue: Open GitHub issue with:
- R version
- Package versions
- Error messages
- Steps to reproduce
**Environment:**
- R Version: [e.g., 4.3.0]
- OS: [e.g., Windows 10]
- Browser: [e.g., Chrome 120]
**Package Versions:**
[Run sessionInfo() and paste output]
**Problem Description:**
[Describe what happened]
**Expected Behavior:**
[Describe what should happen]
**Steps to Reproduce:**
1. [First step]
2. [Second step]
3. [etc.]
**Error Messages:**
[Paste any error messages]
**Screenshots:**
[If applicable]
Before asking for help, try this checklist:
- R is up to date (>= 4.0.0)
- All packages are installed
- RStudio is restarted
- Browser cache is cleared
- No popup blocker active
- Sufficient disk space
- Working internet connection
- No other R sessions running
- File permissions are correct
- Antivirus not blocking
Most issues can be solved by restarting R and reinstalling packages!