src/core/assets.cpp
void MovieAsset::Update(wxString wanted_filename, int assume_number_of_frames)
{
	filename = wanted_filename;
	is_valid = false;
	
	if (filename.IsOk() == true && filename.FileExists() == true)
	{
		if (filename.GetExt().IsSameAs("mrc",false) || filename.GetExt().IsSameAs("mrcs",false))
		{
			is_valid = GetMRCDetails(filename.GetFullPath().fn_str(), x_size, y_size, number_of_frames);
		}
		else if (filename.GetExt().IsSameAs("tif",false))
		{
			TiffFile temp_tif;
			is_valid = temp_tif.OpenFile(filename.GetFullPath().ToStdString(), false, false, assume_number_of_frames);
			x_size = temp_tif.ReturnXSize();
			y_size = temp_tif.ReturnYSize();
			number_of_frames = temp_tif.ReturnNumberOfSlices();
			temp_tif.CloseFile();
		}
		else if (filename.GetExt().IsSameAs("eer",false))
		{
			EerFile temp_eer;
			is_valid = temp_eer.OpenFile(filename.GetFullPath().ToStdString(), false, false, assume_number_of_frames,eer_super_res_factor,eer_frames_per_image);
			x_size = temp_eer.ReturnXSize();
			y_size = temp_eer.ReturnYSize();
			number_of_frames = temp_eer.ReturnNumberOfSlices();
			temp_eer.CloseFile();
		}
		else
		{
			is_valid = false;
		}
	}
}
/*
 * If you think you already know the number of frames, give it as assume_number_of_images.
 * In that case, we will only check the first frame, and assume all the others are there
 * and of the correct size. This will save a lot of time, but it is risky because
 * we may not notice that the file is corrupt or has unusual dimensions.
 * If not, just don't give assume_number_of_images, or set it to 0.
 */
If you think you already know the number of frames, give it as assume_number_of_images.
In that case, we will only check the first frame, and assume all the others are there
and of the correct size. This will save a lot of time, but it is risky because
we may not notice that the file is corrupt or has unusual dimensions.
If not, just don't give assume_number_of_images, or set it to 0.
If you think you already know the number of frames give it as assume_number_of_images . In that case we will only check the first frame and assume all the others are there and of the correct size . This will save a lot of time but it is risky because we may not notice that the file is corrupt or has unusual dimensions . If not just don ' t give assume_number_of_images or set it to 0 .
void MovieAsset::Update(wxString wanted_filename, int assume_number_of_frames)
{
	filename = wanted_filename;
	is_valid = false;
	if (filename.IsOk() == true && filename.FileExists() == true)
	{
		if (filename.GetExt().IsSameAs("mrc",false) || filename.GetExt().IsSameAs("mrcs",false))
		{
			is_valid = GetMRCDetails(filename.GetFullPath().fn_str(), x_size, y_size, number_of_frames);
		}
		else if (filename.GetExt().IsSameAs("tif",false))
		{
			TiffFile temp_tif;
			is_valid = temp_tif.OpenFile(filename.GetFullPath().ToStdString(), false, false, assume_number_of_frames);
			x_size = temp_tif.ReturnXSize();
			y_size = temp_tif.ReturnYSize();
			number_of_frames = temp_tif.ReturnNumberOfSlices();
			temp_tif.CloseFile();
		}
		else if (filename.GetExt().IsSameAs("eer",false))
		{
			EerFile temp_eer;
			is_valid = temp_eer.OpenFile(filename.GetFullPath().ToStdString(), false, false, assume_number_of_frames,eer_super_res_factor,eer_frames_per_image);
			x_size = temp_eer.ReturnXSize();
			y_size = temp_eer.ReturnYSize();
			number_of_frames = temp_eer.ReturnNumberOfSlices();
			temp_eer.CloseFile();
		}
		else
		{
			is_valid = false;
		}
	}
}
void MovieAsset :: Update ( wxString wanted_filename , int assume_number_of_frames ) { filename = wanted_filename ; is_valid = false ; if ( filename . IsOk ( ) == true && filename . FileExists ( ) == true ) { if ( filename . GetExt ( ) . IsSameAs ( " " , false ) || filename . GetExt ( ) . IsSameAs ( " " , false ) ) { is_valid = GetMRCDetails ( filename . GetFullPath ( ) . fn_str ( ) , x_size , y_size , number_of_frames ) ; } else if ( filename . GetExt ( ) . IsSameAs ( " " , false ) ) { TiffFile temp_tif ; is_valid = temp_tif . OpenFile ( filename . GetFullPath ( ) . ToStdString ( ) , false , false , assume_number_of_frames ) ; x_size = temp_tif . ReturnXSize ( ) ; y_size = temp_tif . ReturnYSize ( ) ; number_of_frames = temp_tif . ReturnNumberOfSlices ( ) ; temp_tif . CloseFile ( ) ; } else if ( filename . GetExt ( ) . IsSameAs ( " " , false ) ) { EerFile temp_eer ; is_valid = temp_eer . OpenFile ( filename . GetFullPath ( ) . ToStdString ( ) , false , false , assume_number_of_frames , eer_super_res_factor , eer_frames_per_image ) ; x_size = temp_eer . ReturnXSize ( ) ; y_size = temp_eer . ReturnYSize ( ) ; number_of_frames = temp_eer . ReturnNumberOfSlices ( ) ; temp_eer . CloseFile ( ) ; } else { is_valid = false ; } } }
If you think you already know the number of frames, give it as assume_number_of_images.
If you think you already know the number of frames give it as assume_number_of_images .