deepem3d icon indicating copy to clipboard operation
deepem3d copied to clipboard

snemi3d_train_full_stacks_label100 missing

Open islamtashfiq opened this issue 8 years ago • 13 comments

What is the purpose of snemi3d_train_full_stacks_label100 hdf5 file and how can someone make it from raw/label images?

islamtashfiq avatar Apr 11 '17 11:04 islamtashfiq

It stores training raw image and labels as 3d image stack so that network can randomly get training patches from the image stack. following is a Matlab code example for generating hdf5 from raw image and labels.

if ~ispc train_dir='../images/train-input'; train_lb_dir='../images/train-label2d_widen'; save_dir ='../data'; test_dir='../images/test-input'; else train_dir='..\images\train-input'; train_lb_dir='..\images\train-label2d_widen'; test_dir='..\images\test-input'; save_dir ='..\data'; end d_details.location = '/'; d_details.Name = 'data'; l_details.location = '/'; l_details.Name = 'label';

d_file_name_base='train-input_slice_'; l_file_name_base='label2d_widen_';

enhanced_label_file='../data/vertical_enhanced_thin_label3x3.h5';

enhanced_label = hdf5read(enhanced_label_file,'/labels'); size(enhanced_label) enhanced_label=permute(enhanced_label,[3 1 2]);

%%-----------------------train full 100 stacks ----------------------------------- data_arr=zeros(100,1024,1024); elm_labels_arr=zeros(100,1024,1024); for i=1:100 d_filename= [d_file_name_base num2str(i) '.tif']; d_file_full_name=[train_dir filesep d_filename]; tr_img_data=imread(d_file_full_name); data_arr(i,:,:)=tr_img_data;

l_filename= [l_file_name_base num2str(i) '.tif'];
l_file_full_name=[train_lb_dir filesep l_filename];
tr_img_lb_data=imread(l_file_full_name);
elm_labels_arr(i,:,:)=tr_img_lb_data;
disp(['reading ' num2str(i) ' images ...' ]);

end %elm_labels_arr(elm_labels_arr==255)=1;

elm_labels_arr=enhanced_label; data{1}=data_arr; elm_labels{1}=elm_labels_arr;

size(data_arr) d_tr =single(data_arr); l_tr =single(elm_labels_arr);

figure,imshow(uint8(squeeze(d_tr(50,:,:)))) figure,imshow(squeeze(l_tr(50,:,:)))

[data,labels]=augment_data(d_tr,l_tr) for i=1:length(data) d_tr=data{i}; l_tr=labels{i}; hdf5write([save_dir filesep 'snemi3d_train_full_stacks_v' num2str(i) '.h5'],d_details,d_tr,l_details,l_tr); end

savefile=[save_dir filesep 'snemi3d_train_full_stacks_v16.mat']; save(savefile,'data','labels','-v7.3');

Xiaomi2008 avatar Apr 11 '17 18:04 Xiaomi2008

but it reads from the vertical_enhanced_thin_label3x3.h5 file. How can I make that file?

islamtashfiq avatar Apr 12 '17 02:04 islamtashfiq

it is generated from segmentation label by another matlab code. which I can't find it now, but I will send it to later tomorrow

On Tue, Apr 11, 2017 at 7:47 PM, islamtashfiq [email protected] wrote:

but it reads from the vertical_enhanced_thin_label3x3.h5 file. How can I make that file?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/divelab/deepem3d/issues/1#issuecomment-293457060, or mute the thread https://github.com/notifications/unsubscribe-auth/AF6XBY8KbWNrVGMdYfYHSF8Jj7bLBsyxks5rvDs_gaJpZM4M5-Rf .

Xiaomi2008 avatar Apr 12 '17 10:04 Xiaomi2008

Did you find the script? If not could you describe what is the function doing?

islamtashfiq avatar Apr 14 '17 05:04 islamtashfiq

gt_labels=h5read('../hd5/train_labelEM.h5','/label'); bw_labels=h5read('../data/snemi3d_train_full_stacks_label100.h5','/label');

gt_labels=permute( gt_labels, [2 3 1]); bw_labels=permute( bw_labels, [2 3 1]);

fun =@my_border_labeling new_labels_1 =zeros(size(gt_labels)); new_labels_2 =zeros(size(gt_labels)); parfor i=1:1024 gt_2d=squeeze(gt_labels(i,:,:)); new_labels_1_1(i,:,:) = nlfilter(gt_2d,[1 3],fun); new_labels_1_2(i,:,:) = nlfilter(gt_2d,[3 1],fun); end

parfor i=1:1024 gt_2d=squeeze(gt_labels(:,i,:)); new_labels_2_1(:,i,:) = nlfilter(gt_2d,[1 3],fun); new_labels_2_2(:,i,:) = nlfilter(gt_2d,[3 1],fun); end

bw_labels(1:2,:,:)=1; bw_labels(1023:1024,:,:)=1;

bw_labels(:,1:2,:)=1; bw_labels(:,1023:1024,:,:)=1; combine_new_labels= (1-new_labels_1_1)+(1-new_labels_1_2)+(1-new_labels_2_1)+(1-new_labels_2_2)+(1-bw_labels); combine_new_labels(combine_new_labels>1)=1;

combine_new_labels=1-combine_new_labels; save_h5_file='../data/vertical_enhanced_thin_label3x3.h5' d_details.location = '/'; d_details.Name = 'labels'; hdf5write(save_h5_file,d_details,combine_new_labels);

On Thu, Apr 13, 2017 at 10:50 PM, islamtashfiq [email protected] wrote:

Did you find the script? If not could you describe what is the function doing?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/divelab/deepem3d/issues/1#issuecomment-294095300, or mute the thread https://github.com/notifications/unsubscribe-auth/AF6XBfJ62IblmzuSx1f-soodCutxKymkks5rvwk-gaJpZM4M5-Rf .

Xiaomi2008 avatar Apr 14 '17 21:04 Xiaomi2008

you can download "snemi3d_train_full_stacks_label100.h5" file from: https://www.dropbox.com/s/7ceaqcznzyd31l6/snemi3d_train_full_stacks_label100.h5?dl=0

Xiaomi2008 avatar Apr 14 '17 21:04 Xiaomi2008

Could you share your train_labelEM.h5 and snemi3d_train_v5.h5 as well? Also what are the train-label2d_widen folder images?

islamtashfiq avatar Apr 17 '17 05:04 islamtashfiq

v# files(v1,v2...v15) are generated from "augment_data.m" code

Xiaomi2008 avatar Apr 20 '17 22:04 Xiaomi2008

train-label2d_widen contain widened boundary label it can be downloaded from here: https://www.dropbox.com/s/rzdoldu5jq6e5k1/train-label2d_widen.zip?dl=0

Xiaomi2008 avatar Apr 20 '17 22:04 Xiaomi2008

augment_data.m code needs two arguments (x,y), what are those? It's data and boundary label

islamtashfiq avatar May 02 '17 05:05 islamtashfiq

Hello, can you please share or point me to the location of train_labelEM.hdf5? Thank you!

tavramov avatar Nov 17 '17 07:11 tavramov

Some related h5 files can be downloaded here. https://www.dropbox.com/sh/p0as6r2hcglmyn7/AADToNn1k_b5s2OGeoYywtUWa?dl=0

Xiaomi2008 avatar Apr 21 '18 00:04 Xiaomi2008

Hello, I've been trying to run this script /scripts/read_data_write_data_with_enhanced_labels.m However, Following error was reported ''' File "../images/train-input/train-input_slice_1.tif" does not exist. ''' Does anyone know where could I find/create them? Thanks in advance!

PG-Gu avatar Mar 15 '24 08:03 PG-Gu