Repository navigation
NWB Validation Errors #200
|
Reposting (with permission) an issue sent to us via email:
GitHub does not allow uploading matlab files, so they are pasted in below: nwb_file_Preparer_NEW.mload('ROI_lists.mat', 'CellPose_im','cur_mask','im_file_green','im_file_red')
RG=RGR;
NumFrames=1;
image_mask=zeros(1,1024*1024);
image_mask=~cur_mask==0;
% counter=1;
% for i=1:NumFrames
% input=sprintf('%02d',i);
% txt=['cur_ROI_list=ROI_list_' input ';'];
% eval(txt)
% for j=1:length(cur_ROI_list)
% image_mask(cur_ROI_list(j).pixel_list)=1;
% %counter= counter +1;
% end
%
% end
image_mask=double(image_mask);
image_mask=reshape(image_mask,1,1024,1024);
%image_mask=reshape(image_mask,[1,size(image_mask)]);
Im_both=[];
Im_both=cat(3,im_file_green,im_file_red);
%Im_both=reshape(Im_both,[1,size(Im_both)]);
%%
nwb = NwbFile( ...
'session_description', 'in vivo Mouse Brain Imaging and Photoconversion',...
'identifier', 'AAV V15-D5_FOV3_V_PostPC80_mW100_x2_um175_pwr30_avrg200_pxl1024', ... % Unique indetifier for the file (Viral construct used?)14
'session_start_time', datetime(2025, 06, 09, 10, 00, 0, 'TimeZone', 'America/New_York'), ... % Check date of session(YYYY, M, D)
'timestamps_reference_time', datetime(2025, 06, 09, 10, 0, 0, 'TimeZone', 'America/New_York'), ...
'general_experimenter', 'Das, Ani', ...
'general_institution', 'Lerner Research Institute' ...
);
subject = types.core.Subject( ...
'subject_id', 'AAV V15-D5', ... % Animal's ID number, or name
'age', 'P60D', ... % Should be written in P{Number of days since birth}D How specific should this be?
'description', 'local injection of an AAV viral capsid virus, Variant 15 CaMPARI 3', ... % name written out in words
'species', 'Mus musculus', ...
'sex', 'M' );
nwb.general_subject = subject;
% subjectNWB2_file_write_3.m% nwb = NwbFile( ...
% 'session_description', 'mouse brain imaging',...
% 'identifier', 'hSyn-AAV2/1-Addgene', ...
% 'session_start_time', datetime(2022, 1, 27), ...
% 'general_experimenter', 'Dan', ...
% 'general_institution', 'Lerner Research Institute', ...
% 'general_related_publications', 'TBD');
%
% subject = types.core.Subject( ...
% 'subject_id', 'D20', ...
% 'age', 'P90D', ...
% 'description', 'AAV2/1 mouse', ...
% 'species', 'Mus musculus', ...
% 'sex', 'M' ...
% );
% nwb.general_subject = subject;
optical_channel = types.core.OpticalChannel( ...
'description', 'two channels green/red', ...
'emission_lambda', 550);
device = types.core.Device();
nwb.general_devices.set('Device', device);
imaging_plane_name = 'imaging_plane';
imaging_plane = types.core.ImagingPlane( ...
'optical_channel', optical_channel, ...
'description', 'Photoconversion of Neurons', ...
'device', types.untyped.SoftLink(device), ...
'excitation_lambda', 1000, ...
'indicator', 'CaMPARI', ...
'location', 'Visual cortex');
nwb.general_optophysiology.set(imaging_plane_name, imaging_plane);
%%
blue_channel = zeros(1024, 1024, 'uint16');
red = Im_both(:,:,1);
green = Im_both(:,:,2);
image_data = cat(3, red, green, blue_channel);
rgb_image = types.core.RGBImage( ...
'data', permute(image_data, [3 2 1]), ... % required
'description', 'RGB image of neurons from two photon' ...
);
%%
%image_series = types.core.TwoPhotonSeries( ...
% 'imaging_plane', types.untyped.SoftLink(imaging_plane), ...
% 'starting_time', 0.0, ...
% 'starting_time_rate', 3.0, ...
% 'data', Im_both, ...
% 'data_unit', 'unit16',...
% 'description', 'This is a image, and reads as Time(1), Column*Row*Channel');
%nwb.acquisition.set('TwoPhotonSeries', image_series);
plane_segmentation = types.core.PlaneSegmentation( ...
'colnames', {'image_mask'}, ...
'description', 'Cells segmented from visual cortex, n_rois*x*y', ...
'image_mask', types.hdmf_common.VectorData('data', image_mask, 'description', 'image masks'), ...
'id', types.hdmf_common.ElementIdentifiers('data', int64(1:1024)), ...
'imaging_plane', types.untyped.SoftLink(imaging_plane));
% plane_segmentation.image_mask = types.hdmf_common.VectorData( ...
% 'data', image_mask, 'description', 'image masks');
img_seg = types.core.ImageSegmentation();
img_seg.planesegmentation.set('PlaneSegmentation', plane_segmentation);
ophys_module = types.core.ProcessingModule( ...
'description', 'contains optical physiology data');
ophys_module.nwbdatainterface.set('ImageSegmentation', img_seg);
nwb.processing.set('ophys', ophys_module);
% Fluorescence and dF/F responces
roi_table_region = types.hdmf_common.DynamicTableRegion( ...
'table', types.untyped.ObjectView(plane_segmentation), ...
'description', 'all ROIs', ...
'data', int64((0:length(RG)-1)'));
roi_response_series = types.core.RoiResponseSeries( ...
'rois', roi_table_region, ...
'data', RG, ...
'data_unit', 'red to green ratio', ...
'description', 'red to green ratio from same cell',...
'starting_time_rate', 15.0,...
'starting_time',0.0);
fluorescence = types.core.Fluorescence();
fluorescence.roiresponseseries.set('RoiResponseSeries', roi_response_series);
ophys_module.nwbdatainterface.set('Fluorescence', fluorescence);
nwb.processing.set('ophys', ophys_module);
nwb.general_was_generated_by = { ...
'software', 'MatNWB'; ...
'version', 'v2.6.0' ...
};
nwbExport(nwb, 'new_AAV V15-D5_FOV3_V_PostPC80_mW100_x2_um175_pwr30_avrg200_pxl1024.nwb');
clearHi @CodyCBakerPhD, could you please look into this issue? Thanks. |
Replies: 3 comments
|
Looks like there are many things going on here
This seems like some kind of HDMF/MatNWB mismatch @rly and @ehennestad would be the ones to dig into that
This one should not be blocking validation, as it is a heuristic and that is why it is reduced to a violation (not critical) in the DANDI config: https://github.com/NeurodataWithoutBorders/nwbinspector/blob/dev/src/nwbinspector/_internal_configs/dandi.inspector_config.yaml#L12 If that truly is blocking, then something may have gone awry recently
I've requested if possible to see the file myself to confirm this aspect |
|
I am unable to reproduce the original reported errors on the shared file # After renaming file to conform to dandi standard (e.g., `dandi organize`)
dandi validate .prints No errors found.and nwbinspector new_AAV V15-D5_FOV3_V_PostPC80_mW100_x2_um175_pwr30_avrg200_pxl1024.nwbgives **************************************************
NWBInspector Report Summary
Timestamp: 2025-12-19 12:54:04.121296-05:00
Platform: Windows-10-10.0.26200-SP0
NWBInspector version: 0.6.5
Found 3 issues over 1 files:
3 - BEST_PRACTICE_SUGGESTION
**************************************************
0 BEST_PRACTICE_SUGGESTION
===========================
0.0 new_AAV V15-D5_FOV3_V_PostPC80_mW100_x2_um175_pwr30_avrg200_pxl1024.nwb: check_description - 'Device' object at location '/general/devices/Device'
Message: Description is missing.
0.1 new_AAV V15-D5_FOV3_V_PostPC80_mW100_x2_um175_pwr30_avrg200_pxl1024: check_experiment_description - 'NWBFile' object at location '/'
Message: Experiment description is missing.
0.2 new_AAV V15-D5_FOV3_V_PostPC80_mW100_x2_um175_pwr30_avrg200_pxl1024: check_keywords - 'NWBFile' object at location '/'
Message: Metadata /general/keywords is missing.Has the user tried updating their environment to use the latest versions of dandi, pynwb, hdmf, nwbinspector, etc.? |
|
Through email conversation with the user, it was determined that they did not originally send the problematic files. Their use case is that they are adding new files to an older Dandiset ( The problematic older files are
They indeed suffer from the problems originally pointed out in the origination of this post. The solution for the user, since they are merely adding new files (and not interacting with these older files at all), was to simply to drop these files during re-upload. They also could have begun the process with |
Through email conversation with the user, it was determined that they did not originally send the problematic files. Their use case is that they are adding new files to an older Dandiset (
000246to be specific), but some of the older files are invalid by modern standards.The problematic older files are
They indeed suffer from the problems originally pointed out in the origination of this post.
The solution for the user, since they are merely adding new files (and not interacting with these older files at all), was to simply to drop these files during re-upload.
They also …